Go to Post we used to walk barefoot through five feet of snow to get to school, uphill both ways, with just barbed wire for mittens, and we liked it! - dlavery [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 03-04-2012, 19:08
ferret_guy ferret_guy is offline
Registered User
AKA: Mark Omo
FRC #1703 (RATS)
Team Role: Leadership
 
Join Date: Mar 2012
Rookie Year: 2008
Location: Henderson
Posts: 97
ferret_guy is on a distinguished road
How to read relay state?

How can I read the relay state?

Last edited by ferret_guy : 03-04-2012 at 20:44.
Reply With Quote
  #2   Spotlight this post!  
Unread 03-04-2012, 21:28
Jay1986's Avatar
Jay1986 Jay1986 is offline
Programmer and Driver
AKA: Jay Urban
FRC #1986 (Team Titanium)
Team Role: Alumni
 
Join Date: Mar 2011
Rookie Year: 2010
Location: Lees Summit
Posts: 67
Jay1986 is a jewel in the roughJay1986 is a jewel in the roughJay1986 is a jewel in the roughJay1986 is a jewel in the rough
Re: How to read relay state?

the light on the relay. orange means no value, green means true and red means false
__________________

2013 Oklahoma Regional (Regional Winner, Gracious Professionalism, [and judges voted me star of the day])
2013 KC Regional (Regional Winner, Woodie Flowers, Industrial Design)
2013 Hub City Regional (Regional Winner, Entrepreneurship, Quality, Dean's List)
Reply With Quote
  #3   Spotlight this post!  
Unread 03-04-2012, 21:59
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: How to read relay state?

I think he's asking how to have his code know how the relay is current set, rather than his eyes.

You can see how it's done in the default project by looking at the Build Dashboard Data.vi. That retrieves the values of the Relays and sends it off to be displayed by the default Dashboard.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #4   Spotlight this post!  
Unread 03-04-2012, 22:17
kstl99's Avatar
kstl99 kstl99 is offline
Registered User
AKA: Kevin
FRC #1922 (Oz-Ram)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2010
Location: Hopkinton, NH
Posts: 404
kstl99 has a reputation beyond reputekstl99 has a reputation beyond reputekstl99 has a reputation beyond reputekstl99 has a reputation beyond reputekstl99 has a reputation beyond reputekstl99 has a reputation beyond reputekstl99 has a reputation beyond reputekstl99 has a reputation beyond reputekstl99 has a reputation beyond reputekstl99 has a reputation beyond reputekstl99 has a reputation beyond repute
Send a message via AIM to kstl99
Re: How to read relay state?

Quote:
Originally Posted by Jay1986 View Post
the light on the relay. orange means no value, green means true and red means false
Close. These Spike relays had me confused for a while. First you must think of them as 2 relays,each with one contact. Each contact connects its output terminal (M+ or M-) to either the 12V or the GND terminal.

When the light is orange both are connected to GND.

When the light is green M+ is connected to +12 and M- is connected to GND.

When the light is red M+ is connected to GND and M- is connected to +12.

When the light is off M+ and M- are connected to +12

The PWM cable can be confusing also as it is not really PWM. It is connected to a relay output on the Digital Sidecar. The black wire is tied to the negative. The red and white wires are connected to + 5 when the cRIO wants to activate a contact. I cannot remember which controls which.

Here is a link to the manual: http://www.robotmarketplace.com/prod...sersManual.pdf

(If you are right, Mark, Maybe my explanation will help someone)
__________________

Last edited by kstl99 : 03-04-2012 at 22:19.
Reply With Quote
  #5   Spotlight this post!  
Unread 03-04-2012, 22:39
Jay1986's Avatar
Jay1986 Jay1986 is offline
Programmer and Driver
AKA: Jay Urban
FRC #1986 (Team Titanium)
Team Role: Alumni
 
Join Date: Mar 2011
Rookie Year: 2010
Location: Lees Summit
Posts: 67
Jay1986 is a jewel in the roughJay1986 is a jewel in the roughJay1986 is a jewel in the roughJay1986 is a jewel in the rough
Re: How to read relay state?

in code, if you run debug mode(running robot main) to your robot, than you can probe your relay state by clicking on the wire while the code is running.
__________________

2013 Oklahoma Regional (Regional Winner, Gracious Professionalism, [and judges voted me star of the day])
2013 KC Regional (Regional Winner, Woodie Flowers, Industrial Design)
2013 Hub City Regional (Regional Winner, Entrepreneurship, Quality, Dean's List)
Reply With Quote
  #6   Spotlight this post!  
Unread 04-04-2012, 12:14
ferret_guy ferret_guy is offline
Registered User
AKA: Mark Omo
FRC #1703 (RATS)
Team Role: Leadership
 
Join Date: Mar 2012
Rookie Year: 2008
Location: Henderson
Posts: 97
ferret_guy is on a distinguished road
Re: How to read relay state?

so I looked in the dashboard build code and there are two sections under digital IO Relay forward and relay reverse witch output an unsigned integer 0 to 255 but I cannot find out how this is correlated to the relay states
Reply With Quote
  #7   Spotlight this post!  
Unread 04-04-2012, 14:47
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: How to read relay state?

The short answer is, each Relay has a Forward side as well as a Reverse side.
We have 8 Relays per Digital Sidecar.
So we can represent the state of all Relays by using just two 8-bit integers where each bit indicates if the Relay position is on or off (1 or 0).

Instead of thinking of it as a number 0-255, think of each bit position being on or off. The first bit of the Forward integer represents Relay 1's forward setting (on=1, off=0). The 8th bit represents Relay 8.
The same with the Reverse bit values.

There are two distinct parts to a Spike relay that kstl99 referred to in his description earlier. Essentially, a Spike is really two relays in one.

So, because there are two parts, each Spike has 4 states where each of the two parts is either on or off. These are the enumerated choices you get in the code for a Relay:
  1. Off (all off)
  2. On (all on)
  3. Forward (one side on, the other off)
  4. Reverse (one side off, the other on)
If you look at the Digital Sidecar while your Relays are in use, you will see a double row of LEDs with green lights going on when any of the Relays are set to Forward, red lights when the Relays are set to Reverse, and both on if both are set at the same time.
Those rows of green and red lights are the bit values in your integers.


One way to use these numbers is to run the integer through a "Number to Boolean Array" function and an "Array to Cluster" followed by an Unbundle (from the right-click cluster menu).
An alternative is to use the array index functions to pick out the values you want.
I've attached an example. Beware, the array starts with zero, so the Relay 1 is zero and Relay 8 is seven.
The "Number to Boolean Array" function can be found in the block diagram palette under Programming->Boolean
The "Array to Cluster" function is under Programming->Array
Attached Thumbnails
Click image for larger version

Name:	RelayValues.png
Views:	33
Size:	15.8 KB
ID:	12538  
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 04-04-2012 at 20:41.
Reply With Quote
  #8   Spotlight this post!  
Unread 04-04-2012, 20:31
ferret_guy ferret_guy is offline
Registered User
AKA: Mark Omo
FRC #1703 (RATS)
Team Role: Leadership
 
Join Date: Mar 2012
Rookie Year: 2008
Location: Henderson
Posts: 97
ferret_guy is on a distinguished road
Re: How to read relay state?

thanks!
Reply With Quote
Reply


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


All times are GMT -5. The time now is 21: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