|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Didn't Like Digital Handling
I am used to having 0 mean that the circuit is open and 1 meaning that the circuit is closed, so I did this to the rc digital input portion of ifi_aliases.h:
Code:
/* Aliases used to read the pins when used as INPUTS. */ #define rc_dig_in01 !(PORTBbits.RB2) /* external interrupt RB2/INT2 */ #define rc_dig_in02 !(PORTBbits.RB3) /* external interrupt RB3/INT3 */ #define rc_dig_in03 !(PORTBbits.RB4) /* external interrupt-on-change RB4 */ #define rc_dig_in04 !(PORTBbits.RB5) /* external interrupt-on-change RB5 */ #define rc_dig_in05 !(PORTBbits.RB6) /* external interrupt-on-change RB6 */ #define rc_dig_in06 !(PORTBbits.RB7) /* external interrupt-on-change RB7 */ #define rc_dig_in07 !(PORTHbits.RH0) #define rc_dig_in08 !(PORTHbits.RH1) #define rc_dig_in09 !(PORTHbits.RH2) #define rc_dig_in10 !(PORTHbits.RH3) #define rc_dig_in11 !(PORTJbits.RJ1) #define rc_dig_in12 !(PORTJbits.RJ2) #define rc_dig_in13 !(PORTJbits.RJ3) #define rc_dig_in14 !(PORTCbits.RC0) #define rc_dig_in15 !(PORTJbits.RJ4) #define rc_dig_in16 !(PORTJbits.RJ5) #define rc_dig_in17 !(PORTJbits.RJ6) #define rc_dig_in18 !(PORTJbits.RJ7 feel free to comment my methods |
|
#2
|
|||||
|
|||||
|
Re: Didn't Like Digital Handling
You're likely to cause great confusion by redefining things that everyone else programming the robots in MicroChip C understands in a specific way. I suggest instead that you leave the existing #defines alone and create your own aliases for your own use, like this:
Code:
/* Digital input aliases that evaluate to 0 when the input is open and 1 when grounded by a switch. */ #define rc_sw01 !(PORTBbits.RB2) #define rc_sw02 !(PORTBbits.RB3) #define rc_sw03 !(PORTBbits.RB4) ... |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Digital Caliper as a Digital Readout on Small Mill | sanddrag | Technical Discussion | 9 | 13-10-2005 22:51 |
| Hanging yourself or Handling Big Ball? | punarhero | General Forum | 15 | 27-05-2004 17:57 |
| Detecting and handling sensor failure gracefully | mtrawls | Programming | 9 | 20-04-2004 17:19 |
| handling loose wires/hose/cable | Max Lobovsky | Technical Discussion | 5 | 24-02-2004 16:53 |
| A New Method of Handling Nationals | archiver | 2001 | 9 | 24-06-2002 03:30 |