Go to Post Your drivetrain might make my girlfriend break up with me :D - Tottanka [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 05-02-2007, 13:28
Anime-niac_2.9's Avatar
Anime-niac_2.9 Anime-niac_2.9 is offline
Japanese-crap freak(NOTE AVATAR)
AKA: Alex Abenoja, A-Squared, & Anime
FRC #0599 (Robodox)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Northridge, California
Posts: 88
Anime-niac_2.9 will become famous soon enough
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
i know it says at the top not to edit the file at all, but I am doing what feels comfortable to me.

feel free to comment my methods
  #2   Spotlight this post!  
Unread 05-02-2007, 13:46
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
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)
...
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


All times are GMT -5. The time now is 00:22.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi