![]() |
LED drivers on OI
Howdy,
I am the lead sponsor and just barely keep up with the programmers on principles of the code. We are researching options to add two LEDs to our control system so that a driver would get an indication of which drive state they are using. I.e. a linear mapping of the sticks verses a peicewise function. Our initial research finds that IFI has built in the ability to drive LEDs on ports 1 & 3 that are the same ones mapped on the OI. As I understand it the default mapping of the OI LEDs can be customized for user defined values such as we propose. Please point out flaws in my understanding or highlight better options that you see. A question that I have is if the joystick ports are the same why isn't there an option to drive LEDs in all four ports? Does this option already exist and I just don't realize it? Please explain as best you can to me who has a marginal understanding of the default code. Thanks, APS |
Re: LED drivers on OI
Quote:
In User_routines.C there is a section called "robot feedback LEDs" I'm not sure which ones the LED drivers in the port use, but it is some of the ones in there. |
Re: LED drivers on OI
The 11 leds you see on your OI box can be controlled (in order) by the following variables from code:
Pwm1_red, Pwm1_green, Pwm2_red, Pwm2_green Relay1_red, Relay1_green, Relay2_red, Relay2_green Switch1_LED, Switch2_LED, Switch3_LED Set any of these variables to true (that is, a non-zero integer, normally 1) to light them up, and false (0) to turn them off. I have in my code "Pwm1_green = (filter == PWMC_LINEAR);" for example, where filter is a variable and PWMC_LINEAR is a constant, but you could just as easily (and less cryptically) do "if(filter == PWMC_LINEAR) Pwm1_green = 1; else Pwm1_green = 0;". Two of the joystick ports (1 and 3) have the so called "Led Drivers" that allow you to connect your own leds (I believe between the driver pin and +5, but check the OI pdf to make sure and also to check the proper current level). The other two (2 and 4) provide access to the same buttons that are on the two first two, in addition to their own buttons. This hasn't proven very useful to my team, however. For some reason, the led drivers are controlled by the exact same variables that control the normal leds embedded on the OI, making them totally redundant. You're better off just using the OI leds and not worrying about making an adapter for the port. By the way, the led data is sent to the OI on the same byte as the User_Mode_byte, so the leds will only display if your OI is not set in user mode (just toggle the button to battery power or something). Hope this helped. :) |
Re: LED drivers on OI
Quote:
|
Re: LED drivers on OI
Quote:
Thanks a bunch so far, APS :) |
Re: LED drivers on OI
Quote:
More likely .... I have it completely wrong :yikes: APS |
Re: LED drivers on OI
Andrew, look at the documentation available online for the pinout guides and the manual for the OI and RC. These will tell you more that you would ever want to know. As previously stated, there are 11 LED's available. The proper pins should be in the docs. To wire them, get a DB-15 hood or a "game" cable (they are the kind on the joysticks. You could use a joystick that you don't want anymore and cut the cable off). You will want a good pair of strippers because of all of the wires. Strip the wires and have them separated somewhat. following the pinout, use a multimeter to check which wire is on which pin (there are some standards, but this will nearly always work). Hook the LEDs to the pins you want and then place and hide the wires (if you want to look good, or you could display it for all of it's ugly glory). For the extra buttons, you can splice a cable into the joystick cable or into your new LED cable.
(I'm not completly sure about the rest of this): Switches are between ground and a wire. close it and it is on (logic 0) or open and it is off (logic 1). For multiple postion switches, wire the ground to the grounds and the multiple wires to the other side. For POTs, I think the input could be an analog value and you can deal with it in your program. But read the documentation. They tell you what pins you need and what things do. Those documents are your friend. |
Re: LED drivers on OI
As far as the pin outs go: You have +5V and ground pins, analog inputs, and digital inputs on all four ports. The analog inputs are mapped on the kit's joysticks to the y axis, x axis, and the wheel on top (I think the last one is unused). The digital inputs are for the trigger, the hat (on the left side), and the two auxiliary switches on either side of the wheel.
After these standard pins, ports 1 and 3 have an additional four pins each that are used for the leds - between the two of them, those 8 leds mirror what I assume are Pwm1_red through Relay2_green. Ports 2 and 4 have, instead of led drivers, four pins that act exactly the same as ports 1 and 3's four standard digital inputs. That is, they are connected in the same way as any other digital input, but they are not unique, they overlap with the buttons connected to the other ports. If you already have a joystick plugged into every port then these pins are redundant. Activating one of these pins on joystick 2 would set one of the p1_sw_**** variables true, not any of the p2_sw_**** ones. |
Re: LED drivers on OI
Depends how good your programmers are... I'd honesty suggest using a microcontroller to intervene before the joystick got to the OI, a 8052 should be good, those also run C and can be programed with MPLAB.
|
Re: LED drivers on OI
Quote:
|
| All times are GMT -5. The time now is 04:43. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi