Go to Post Wow, 4 pages of arguments over water...... Is it the off season or what? - Botsup [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 12-04-2005, 23:17
Andrew Schuetze's Avatar
Andrew Schuetze Andrew Schuetze is offline
499 Founder / Alamo FTC & FLL AP
no team
Team Role: Leadership
 
Join Date: Jan 2002
Rookie Year: 2001
Location: San Antonio, Texas
Posts: 689
Andrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond repute
Question 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
__________________
APS

Founder FRC 499
Parent alumni FRC 2745 & 4219
Co-Coach FTC 4549 & 6407
Alamo FTC Affiliate Partner
Alamo FLL Affiliate Partner
  #2   Spotlight this post!  
Unread 12-04-2005, 23:28
ConKbot of Doom ConKbot of Doom is offline
Team Alumni
FRC #1184 (Cobra Robotics)
Team Role: Leadership
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Maryland
Posts: 153
ConKbot of Doom has a spectacular aura aboutConKbot of Doom has a spectacular aura aboutConKbot of Doom has a spectacular aura about
Re: LED drivers on OI

Quote:
Originally Posted by Andrew Schuetze
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.
The 4 ports aren't all the same, rather than LEDs, ports 2&4 have connections for the buttons on ports 1 and 3 respectively. That way you can access 8 buttons on one joystick port.

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.
__________________
2005 Philly #1 seeded team, highest average points, and semi-finalists
Thanks to 103 and 484 for being alliance mates.
  #3   Spotlight this post!  
Unread 16-04-2005, 15:40
Workaphobia Workaphobia is offline
Registered User
AKA: Jon
FRC #1546 (Chaos Inc.)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Long Island
Posts: 26
Workaphobia will become famous soon enough
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.
  #4   Spotlight this post!  
Unread 16-04-2005, 16:33
jdiwnab's Avatar
jdiwnab jdiwnab is offline
Really the Inventor Guy
AKA: Bryan Hartley
FRC #0617
Team Role: College Student
 
Join Date: Nov 2004
Rookie Year: 2002
Location: Highland Springs, VA
Posts: 260
jdiwnab is a jewel in the roughjdiwnab is a jewel in the roughjdiwnab is a jewel in the rough
Re: LED drivers on OI

Quote:
Originally Posted by Workaphobia
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.
Sometimes you want to have the lights next to what you are controlling or in a particular order. We had lights next to some switches so people will know what mode the robot is in better. We also had LEDs set up as a main battery indicator and needed the LEDs in a virtical row with certain colors. This made it better to know at a glance what the battery was like. It isn't really necessary in the compitition, but is nice in demonstrations. And it looks cool to have LEDs sticking out of dimond plating with built in switches...
__________________
Proof that Macs will win the platform war: How did Scotty know how to use MacDraft in Star Trek IV?
// random()
I have 100 gmail invites. PM me if you want one.
If they want us to think outside of the box, why do they make us fit in a 38x28x60 inch box?
Beware of Geeks bearing GIFs
Help me test my server software
  #5   Spotlight this post!  
Unread 16-04-2005, 21:48
Andrew Schuetze's Avatar
Andrew Schuetze Andrew Schuetze is offline
499 Founder / Alamo FTC & FLL AP
no team
Team Role: Leadership
 
Join Date: Jan 2002
Rookie Year: 2001
Location: San Antonio, Texas
Posts: 689
Andrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond repute
Thumbs up Re: LED drivers on OI

Quote:
Originally Posted by jdiwnab
Sometimes you want to have the lights next to what you are controlling or in a particular order. We had lights next to some switches so people will know what mode the robot is in better. We also had LEDs set up as a main battery indicator and needed the LEDs in a virtical row with certain colors. This made it better to know at a glance what the battery was like. ...
May be a not so informed question but, is there a limit to the number of LEDs that one can control via the OI? Is it possible to map pins from any of the ports to control an LED? Like I mentioned in my original post, I am just barely up to speed with the user code.

Thanks a bunch so far,


APS
__________________
APS

Founder FRC 499
Parent alumni FRC 2745 & 4219
Co-Coach FTC 4549 & 6407
Alamo FTC Affiliate Partner
Alamo FLL Affiliate Partner
  #6   Spotlight this post!  
Unread 16-04-2005, 22:15
Andrew Schuetze's Avatar
Andrew Schuetze Andrew Schuetze is offline
499 Founder / Alamo FTC & FLL AP
no team
Team Role: Leadership
 
Join Date: Jan 2002
Rookie Year: 2001
Location: San Antonio, Texas
Posts: 689
Andrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond repute
Re: LED drivers on OI

Quote:
Originally Posted by ConKbot of Doom
The 4 ports aren't all the same, rather than LEDs, ports 2&4 have connections for the buttons on ports 1 and 3 respectively. That way you can access 8 buttons on one joystick port.
Okay once again a not so informed question. Exactly how does this map to the hardware Does the pinout on 1 and 3 map to 8 buttons on one of the joysticks? top hat, trigger, thumb, 4-point rocker switch being those eight... Or does this allow one to build a custom switch box with some combination of rocker/toggle switches ... Or both ...

More likely ....
I have it completely wrong


APS
__________________
APS

Founder FRC 499
Parent alumni FRC 2745 & 4219
Co-Coach FTC 4549 & 6407
Alamo FTC Affiliate Partner
Alamo FLL Affiliate Partner
  #7   Spotlight this post!  
Unread 16-04-2005, 23:24
jdiwnab's Avatar
jdiwnab jdiwnab is offline
Really the Inventor Guy
AKA: Bryan Hartley
FRC #0617
Team Role: College Student
 
Join Date: Nov 2004
Rookie Year: 2002
Location: Highland Springs, VA
Posts: 260
jdiwnab is a jewel in the roughjdiwnab is a jewel in the roughjdiwnab is a jewel in the rough
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.
__________________
Proof that Macs will win the platform war: How did Scotty know how to use MacDraft in Star Trek IV?
// random()
I have 100 gmail invites. PM me if you want one.
If they want us to think outside of the box, why do they make us fit in a 38x28x60 inch box?
Beware of Geeks bearing GIFs
Help me test my server software
  #8   Spotlight this post!  
Unread 16-04-2005, 23:29
Workaphobia Workaphobia is offline
Registered User
AKA: Jon
FRC #1546 (Chaos Inc.)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Long Island
Posts: 26
Workaphobia will become famous soon enough
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.
  #9   Spotlight this post!  
Unread 17-04-2005, 15:41
Kyle T Kyle T is offline
waiting for next season...
FRC #0810 (Mechanical Bulls)
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 2004
Location: Smithtown
Posts: 20
Kyle T is an unknown quantity at this point
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.
__________________
  #10   Spotlight this post!  
Unread 22-04-2005, 16:14
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: LED drivers on OI

Quote:
Originally Posted by Kyle T
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.
This has been discussed for use of mice or other seiral controllers (eg, modern game controllers). Some have said that it may be a non-IFI circuit controlling the robot.
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
Operator Interface LED Drivers Andrew Programming 7 15-03-2004 11:27
Making a beacon indicator LED burn its brightest without burning out DanL Electrical 7 26-01-2004 08:05
Help On Coding 2K1 Controller GregTheGreat Programming 9 05-12-2003 18:35
Rookie Programmer has question about the default code DanL Programming 3 26-01-2002 19:59


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

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