Go to Post We don't use fancy tools like that, but we might need some wood glue or something :) - MrForbes [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 05-02-2009, 19:27
windell747 windell747 is offline
Registered User
FRC #2477
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2001
Location: Hawaii
Posts: 158
windell747 will become famous soon enoughwindell747 will become famous soon enough
boolean selector for relay control

I would like to use a boolean selector to choose forward or off for a relay. When I put the boolean selector in the code it only allows me to set the true/false conditions to be constants. I've seen the true/false conditions actually be "forward" or "off". How do I do this? Thanks!
Reply With Quote
  #2   Spotlight this post!  
Unread 05-02-2009, 20:12
airnate airnate is offline
Registered User
FRC #0236 (Techno Ticks)
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2009
Location: southeastern CT
Posts: 93
airnate is a jewel in the roughairnate is a jewel in the roughairnate is a jewel in the rough
Re: boolean selector for relay control

All Booleans in LabVIEW are green in color and can only be True or False. Alternatively, you can use an enum (short for "enumerated type"), which is actually an unsigned 16-bit integer. You'll find it in the Numerics palette. Once you drop an enum into the diagram or front panel, right click it and select Edit Items (there are quicker ways to edit the names, but not as self-explanatory).

You can then add as many items as you like. In your case you would add a "Forward" and an "Off" item.
Reply With Quote
  #3   Spotlight this post!  
Unread 05-02-2009, 22:09
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,587
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
Re: boolean selector for relay control

What you probably want is a Select block. You'll find it in the Programming>Comparison palette. It takes a boolean input and uses it to decide which of two other inputs it should output. So you'd use it in combination with the relay enum constants described by airnate to control the relay. You'd wire an "Off" constant to one input, a "Forward" constant to the other input, and then have the boolean input pick which one is actually sent to the relay set vi.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
Reply With Quote
  #4   Spotlight this post!  
Unread 05-02-2009, 23:55
windell747 windell747 is offline
Registered User
FRC #2477
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2001
Location: Hawaii
Posts: 158
windell747 will become famous soon enoughwindell747 will become famous soon enough
Re: boolean selector for relay control

Where do you get the "Off", "Forward" and "Reverse" constants from?
Reply With Quote
  #5   Spotlight this post!  
Unread 06-02-2009, 00:19
airnate airnate is offline
Registered User
FRC #0236 (Techno Ticks)
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2009
Location: southeastern CT
Posts: 93
airnate is a jewel in the roughairnate is a jewel in the roughairnate is a jewel in the rough
Re: boolean selector for relay control

If you create the enumerated type on the block diagram, it becomes a blue constant. Once you right click on the constant and select Edit Items, you can add any text you want and create your "Off", "Forward", and "Reverse".

The enumerated type can be found in the Numeric sub palette in the Programming palette as shown in the attached picture. My cursor didn't show up in the picture, but look for the highlighted square surrounding the enum on the palette.

For a more detailed explanation,

1. Go look at the LabVIEW help. From the LabVIEW Help menu, select Search the LabVIEW Help...
2. Select the Search tab.
3. Type enum constant and press enter.
4. In the list that shows up, select Enum Constant and the help will appear in the right pane.

One other word of caution, if you make multiple constants (which I presume you're doing), you should really make a typedef out of one and use the typedef wherever you have an instance of it. Search for Custom Controls in the LabVIEW help for the topic, Creating Custom Controls, Indicators, and Type Definitions. Then scroll down that article to find the section entitled Type Definitions and Strict Type Definitions

:-)
Attached Thumbnails
Click image for larger version

Name:	enum.png
Views:	52
Size:	41.2 KB
ID:	7334  

Last edited by airnate : 06-02-2009 at 00:33.
Reply With Quote
  #6   Spotlight this post!  
Unread 06-02-2009, 10:21
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: boolean selector for relay control

A simple way to get the enumerated constants you want is to right-click on the input to the set relay vi and choose "create constant". You can then unwire it from the relay input and wire it to the boolean selector instead.
Reply With Quote
  #7   Spotlight this post!  
Unread 15-02-2009, 22:12
windell747 windell747 is offline
Registered User
FRC #2477
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2001
Location: Hawaii
Posts: 158
windell747 will become famous soon enoughwindell747 will become famous soon enough
Re: boolean selector for relay control

Thanks Alan for the reply! The problem is solved! Did it exactly as you suggest!
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
boolean equations to relay commands windell747 Programming 3 01-02-2009 04:48
Can Relay Outputs Directly Drive LEDS ? (for testing) de_ Control System 7 11-04-2008 15:13
Help with automatic relay control DRH2o Programming 5 23-01-2008 18:13
Relay for Pump q? MI28Driver Technical Discussion 2 31-01-2002 00:12


All times are GMT -5. The time now is 08:30.

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