View Full Version : Sending data from RC to OI
We'd like to have an LED on our control panel light up if the robot's in a certain state.
Is it possible to send data from the Robot Controller and have it received at the Operator Interface?
Thanks,
Nathan
wt200999
02-02-2008, 11:33
There are a couple of ways you could do that. First the dashboard port on the side can provide feedback if you are planning on using an external light or something like that. They have the dashboard viewer application that works with that. You would have to look into it a bit more but it could work. If you are using the default code there are a bunch of things on the bottom of user_routines.c that define all of the user lights that are on the OI on the right had side.
EHaskins
02-02-2008, 11:47
This code is from the IFI code.
if(user_display_mode == 0)
{
// update the "PWM 1" LED
if(p1_y >= 0 && p1_y <= 56)
{ // joystick is in full reverse position
Pwm1_green = 0; // turn PWM1 green LED off
Pwm1_red = 1; // turn PWM1 red LED on
}
else if(p1_y >= 125 && p1_y <= 129)
{ // joystick is in neutral position
Pwm1_green = 1; // turn PWM1 green LED on
Pwm1_red = 1; // turn PWM1 red LED on
}
else if(p1_y >= 216 && p1_y <= 255)
{ // joystick is in full forward position
Pwm1_green = 1; // turn PWM1 green LED on
Pwm1_red = 0; // turn PWM1 red LED off
}
else
{ // in either forward or reverse position
Pwm1_green = 0; // turn PWM1 green LED off
Pwm1_red = 0; // turn PWM1 red LED off
}
// update the "PWM 2" LED
if(p2_y >= 0 && p2_y <= 56)
{ // joystick is in full reverse position
Pwm2_green = 0; // turn pwm2 green LED off
Pwm2_red = 1; // turn pwm2 red LED on
}
else if(p2_y >= 125 && p2_y <= 129)
{ // joystick is in neutral position
Pwm2_green = 1; // turn PWM2 green LED on
Pwm2_red = 1; // turn PWM2 red LED on
}
else if(p2_y >= 216 && p2_y <= 255)
{ // joystick is in full forward position
Pwm2_green = 1; // turn PWM2 green LED on
Pwm2_red = 0; // turn PWM2 red LED off
}
else
{ // in either forward or reverse position
Pwm2_green = 0; // turn PWM2 green LED off
Pwm2_red = 0; // turn PWM2 red LED off
}
// update the "Relay 1" and "Relay 2" LEDs
Relay1_green = relay1_fwd; // LED is on when Relay 1 is FWD
Relay1_red = relay1_rev; // LED is on when Relay 1 is REV
Relay2_green = relay2_fwd; // LED is on when Relay 2 is FWD
Relay2_red = relay2_rev; // LED is on when Relay 2 is REV
// update the "Switch 1", "Switch 2" and "Switch 3" LEDs
Switch1_LED = !(int)rc_dig_in01;
Switch2_LED = !(int)rc_dig_in02;
Switch3_LED = !(int)rc_dig_in03;
}
else /* User Mode is On - displays data in OI 4-digit display*/
{
User_Mode_byte = backup_voltage * 10;
}
Gamer930
02-02-2008, 12:14
If you look on Page 7 and 9 of OI Ref Guide (http://www.ifirobotics.com/docs/oi-ref-guide-5-8-07.pdf) . You can see the pins for the LEDs. Those LEDs coordinate to the code at the bottom of user_routines.c so you will want to modify that.
Now are the examples above for the LEDs on the OI? We wanted to have an external LED that's a couple feet away from the OI controller.
So how do you send stuff to the dashboard port, if that's what we need to do?
Thanks,
Nathan
wt200999
02-02-2008, 19:23
Yes the example in the default code if for the LEDson the far right side of the OI.The dashboard port is output only. It automatically sends back data at high speeds. Each packet of info is 26 bytes, and is outlined on a datasheet that is included in a zip of the program here: http://ifirobotics.com/dashboard_viewer.shtml In it there are a couple of different things like "USER_BYTE1" or something like that. You can set those in your code I think its just
user_byte1 = x;
but you can look that up in p18f8722.h
Alan Anderson
02-02-2008, 22:09
Now are the examples above for the LEDs on the OI? We wanted to have an external LED that's a couple feet away from the OI controller.
Look at the OI Reference Guide (http://www.ifirobotics.com/docs/oi-ref-guide-5-8-07.pdf) for the pinout of the joystick ports. Two of the ports have LED output pins that will do exactly what you want. They duplicate the state of eight of the red and green LEDs controlled using the code that EHaskins showed.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.