Thread: Autonomous Help
View Single Post
  #9   Spotlight this post!  
Unread 06-01-2004, 01:29
rwaliany's Avatar
rwaliany rwaliany is offline
R
None #0691 (HartBurn)
Team Role: Programmer
 
Join Date: Jan 2003
Rookie Year: 2000
Location: http://www.hartrobot.com
Posts: 137
rwaliany will become famous soon enough
Re: Autonomous Help

Think of a light switch, it either emits light or it doesn't. That's how programming digital outputs are. You can turn a light switch on by flipping it up lets say, right? Now lets give the on position (state) of the light the value 1, and when it's off its zero.
rc_dig_out01
rc_dig_out02
rc_dig_out03...
rc_dig_out16 are all variables that act like these switch, but if you are going to use one of these, you must set the corresponding IO pin to Input or output

to use rc_dig_out01
do

IO(x) : x (pin)

IO1= OUTPUT; // so you can OUTPUT data using rc_dig_out01

Remember to put OUTPUT/INPUT declarations in the initialization or whereever all of the OTHER similar statements are.



void Process_Data_From_Master_uP(void)
{
Getdata(&rxdata); /* Get fresh data from the master microprocessor. */
/*... then somewhere in here you can do check statements and set statements */
rc_dig_out01 = 1; // This will turn on output 1,


Putdata(&txdata);
}

// To use this on the actual controller, there are three pins, you would simply hook up a LED (it's a diode so it only goes one way remember) to ground and signal, that would turn on an LED. If your utterly confused, this should help a little, if you can get this working then read some sample code, that's always a good way to go.
GPS (Ground Positive Signal)
1XoX
2ooo
3ooo
__________________
R