Go to Post I believe with every fiber of my being that Engineering is an Art. It is a beautiful, wonderful, delightful art. - Joe Johnson [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-02-2008, 16:50
B_Dubbs B_Dubbs is offline
Registered User
AKA: Brian
FRC #1153
Team Role: Programmer
 
Join Date: Mar 2007
Rookie Year: 2006
Location: Walpole, MA
Posts: 29
B_Dubbs is an unknown quantity at this point
OI LEDs

Hi, team 1153 has been trying to get our OI LEDs, Pwm1_green, Pwm1_red, Relay1_green etc., to work when a button is pressed.

We have tried many various solutions but the only lights we could get to work properly in Manual mode was the Switch LEDS. The only light we get on in Manual is Pwm1_green and whenever the aux1 button is pressed on the Port 1 joystick will it change and it changes in a type of bianary going from green to red to green and red to pwm2_green and etc in that order. We have a feeling that the code causing the OI to work under that system is interferring with our code but we couldn't find it anywhere in the code. If you could please help us get the Red LEDs to work, it would be greatly appreciated. Here is our code in question if it will help:

Code:
   if      (p4_sw_trig == 1)  {ElevW= 0; DesiredHeight=   0; }  //Lowest
   else if (p4_sw_top  == 1)  {ElevW= 1; DesiredHeight=  20; }  //Medium
   else if (p4_sw_aux1 == 1)  {ElevW= 2; DesiredHeight=  50; }  //High
   else if (p4_sw_aux2 == 1)  {ElevW= 3; DesiredHeight= 100; }  //Very High

      if (ElevW == 0)
      { 
          //printf("ELEVW=0\n\r");
          Pwm1_red = 1;           //Pwm1_red LED is on
          Pwm1_green= Pwm2_green= Pwm2_red= Relay1_green= 0; // LEDs off
          Relay1_red= Relay2_green= Relay2_red= 0; //LEDs off	
      }
      else if (ElevW == 1)
      {
          //printf("ELEVW=1\n\r"); 
          Pwm2_red  = 1;          //Pwm2_red LED is on
          Pwm1_green= Pwm1_red= Pwm2_green= Relay1_green= 0; // LEDs off
          Relay1_red= Relay2_green= Relay2_red= 0; //LEDs off	
      }
      else if (ElevW == 2)
      { 
          //printf("ELEVW=2\n\r");
          Relay1_red  = 1;  // Relay1_red LED is on
          Pwm1_green= Pwm1_red= Pwm2_green= Pwm2_red= 0;  //LEDs off
          Relay1_green= Relay2_green= Relay2_red= 0;   //LEDS off	
      }
      else if (ElevW == 3)
      {
          //printf("ELEVW=3\n\r");
          Relay2_red  = 1;  //Relay2_red LED is on
          Pwm1_green= Pwm1_red= Pwm2_green= Pwm2_red= 0; //LEDs off
          Relay1_green= Relay1_red= Relay2_green= 0;	 //LEDs off
      }
By using the printfs we are sure the code is working as it prints out the numbers and if we switch the LEDs to the Switch LEDs they will change also. Any help is greatly appreciated.
  #2   Spotlight this post!  
Unread 12-02-2008, 17:25
dcbrown dcbrown is offline
Registered User
AKA: Bud
no team
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Hollis,NH
Posts: 236
dcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud of
Re: OI LEDs

From IFI docs on the software/OI

Quote:
User Mode
Bit 5 of rc_mode_byte (aliased as user_display_mode) indicates when the user selects the
"User Mode" on the OI. In "User Mode", user_display_mode is set to 1. When the user selects
channel, team number, or voltage, user_display_mode is set to 0. When in "User Mode", Robot
Feedback LEDs are turned off and the value stored in txdata.LED_byte1.data is displayed on the
multi-segment display on the Operator Interface. By default this is set to the value of the backup
battery. "User Mode" is identified by the letter “u” in the left digit of the display on the Operator
Interface.
So make sure the OI display is not showing "u000" in the OI-4 digit display. This is changed with the "Select" button on the OI.

Also, the LED byte in the txdata packet is shared:

Code:
#define User_Mode_byte  txdata.LED_byte1.data

#define Pwm1_green      txdata.LED_byte1.bitselect.bit0
#define Pwm1_red        txdata.LED_byte1.bitselect.bit1 
#define Pwm2_green      txdata.LED_byte1.bitselect.bit2
#define Pwm2_red        txdata.LED_byte1.bitselect.bit3 
#define Relay1_red      txdata.LED_byte1.bitselect.bit4 
#define Relay1_green    txdata.LED_byte1.bitselect.bit5
#define Relay2_red      txdata.LED_byte1.bitselect.bit6 
#define Relay2_green    txdata.LED_byte1.bitselect.bit7
Make sure no one is clearing or setting User_Mode_byte after you setup the LEDs.
  #3   Spotlight this post!  
Unread 12-02-2008, 17:46
B_Dubbs B_Dubbs is offline
Registered User
AKA: Brian
FRC #1153
Team Role: Programmer
 
Join Date: Mar 2007
Rookie Year: 2006
Location: Walpole, MA
Posts: 29
B_Dubbs is an unknown quantity at this point
Re: OI LEDs

Thank you very much for your help. We had User_Mode_byte set to our autonomous selector to show which autonomous code we were running. It seems odd that we can only do lights or user number. Do you know of any way to display the lights and the user number on the OI display?
  #4   Spotlight this post!  
Unread 13-02-2008, 00:20
popo308's Avatar
popo308 popo308 is offline
Registered User
AKA: Brent
FRC #1625 (Winnovation)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Winnebago, IL
Posts: 312
popo308 is a name known to allpopo308 is a name known to allpopo308 is a name known to allpopo308 is a name known to allpopo308 is a name known to allpopo308 is a name known to all
Send a message via AIM to popo308
Re: OI LEDs

when you use the LED control pins in port 1 and 3....

a 1 is off
and a 0 is on for the external led the pins are "ground" you will need to wire up a power and get some resistors on it as well
  #5   Spotlight this post!  
Unread 13-02-2008, 21:35
dcbrown dcbrown is offline
Registered User
AKA: Bud
no team
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Hollis,NH
Posts: 236
dcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud of
Re: OI LEDs

Quote:
Originally Posted by B_Dubbs View Post
Thank you very much for your help. We had User_Mode_byte set to our autonomous selector to show which autonomous code we were running. It seems odd that we can only do lights or user number. Do you know of any way to display the lights and the user number on the OI display?
Although you can't display both simultaneously, you can select between them. The OI sends back to the user processor which mode is being displayed in the rxdata packet.

For example:

Code:
ifi_aliases.h:311: #define user_display_mode   rxdata.rc_mode_byte.mode.user_display


  if (user_display_mode == 0) /* User Mode is Off */
  {
       set LED code
   }

:
.
{somewhere else in the code}
   if (user_display_mode == 1) /* User Mode is On */
  {
       User_Mode_byte = autonomous selectore
   }
Then the operator can choose which to look at using the selector button on the OI. The code they will send back when the operator is interested in looking at.
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
OI and LEDs Precious Control System 1 23-01-2007 19:53
LEDs on CMUCam JJMax7 Programming 2 03-02-2006 12:28
Lighted LEDs Jaime65 Technical Discussion 8 12-01-2005 09:48
cooding(leds) hi_im_sean Programming 2 05-02-2003 07:02


All times are GMT -5. The time now is 01:46.

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