Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How to do "case" structure in labview

Hello,
I am preparing a program for my diploma and I need to control a switch MAX 391 from my AT-MIO-16E card. I need 4 switches for my hardware to work and I have to control them with the Digital Out channels. I have to do sort of "case" structure so that depending on the frequency different switch will work. So it means that the card must automatically generate logic "high" on one of the digital out channels. And the question is how to do it. I think that the best idea is the "case" structure but it doesn't exist in Labview 6.1
Can anyone help me, please.

0 Kudos
Message 1 of 11
(3,659 Views)

Hi,

You do not really need case structure to achieve what you want.

Have a look at "write to 1 digital port.vi" provided with labview examples.

In this VI,  the switch cluster is converted to boolean array and this boolean array is converted to number.

In your case you have 4 channels.

say you have selected DO3, DO2, DO1 and DO 0

now try doing a boolean table table for the same

DO0 on  all others off, this in boolean : 0 0 01  and in numeric1

Do1 on others off, in boolean 0 0 1 0, numeric 2

Do2 on others off, in boolean 0100 , numeric 4

Do3 on others off, in boolean 1000 , numeric 8

and so on.

by passing the relevant number, you can switch on that particular Digital channel/channels

hope this solves your problem.

Regards

Dev

 

0 Kudos
Message 2 of 11
(3,653 Views)
Thanks, but I don't think that it solves my problem because here it is made manually and in my program it must be made automatically. I mean I set the frequency to 1000 Hz and it fits the range for the first digital out - so there goes high, if the frequency value is from another range then another digital channel has high state. So it must work automatically at least I think so.
thanks
0 Kudos
Message 3 of 11
(3,652 Views)
Ok, is your program reading  1000Khz by some way?  or are you manually entering this 1000k Hz??
 
If you tell me how you l get this 1000Khz value, i can suggest a logic to make the switches go on automatically.
 
For example, if you enter 1000 k as numeric, then take a boolean case structure, To its input condition, connect this numeric control and you will see that this boolean case structure converts itself to numeric case structure.
Define this case for each of your expected frequency value and whenever the frequency you enter is equal to the value of case, pass out of that case a numeric value that will turn on the desired switch
 
I work on LabVIEW 7.1 and i do not have LabVIEW 6.1 on any of my systems.
Otherwise i would have demonstrated how to do it.
sorry!
 
hope this helps
 
Regards
Dev
 
 
 
 
 
 
0 Kudos
Message 4 of 11
(3,650 Views)
Thanks,
I put the frequency manually.
So as I understand I connect the control to boolean case structure. instead of default True, false i put some key frequency values and than in proper case I put the proper digital channel.
I will try to make it and do a print screen and attach it here.
thanks for your help.

0 Kudos
Message 5 of 11
(3,646 Views)
Thank You, very much it is working I put some values of frequencies in case structure and right now I am trying to learn what to do to send logic high into digital channels. I think that program Write to 1 Dig port.vi doesn't really help me or maybe I am wrong. Thanks for you help in advance

0 Kudos
Message 6 of 11
(3,645 Views)

hi,

good to hear you are making progress.

It should be a matter of time before you will be able to use DIO as per your need.

those examples come with pretty good documentation.

get back if u need any info

regards

Dev

 

0 Kudos
Message 7 of 11
(3,631 Views)
Hello after a month I had to came back to my program in labview. And I still have problems with case. In my case structure I want to have four digital channels and depending on the frequency one of them has to change to "high" positon and the rest must be in "low". I put the frequency manulally. And i.e. if i will set the frequency to 500 I want channel 1 to be high and other channels to be low. For frequency between 600 and 1600 I want channel 2 to be high and all other low. And I don't really know how to do such ranges in case structure. If I will put value like 1000 in the case structure the structure will only work for this value an for another values it will use the default case.
Maybe You will be able to help me
Thanks in advance
Artur
0 Kudos
Message 8 of 11
(3,575 Views)
For each case instead of entering just one number you can enter the follow

600 .. 1600

and it will encompass all numbers betwen these two numbers.


This info can be found in the help section for case structures

Message Edited by rpursley8 on 12-28-2005 11:54 AM

Randall Pursley
0 Kudos
Message 9 of 11
(3,568 Views)
Thanks, I can't find it in my version of labview. But it helped.
0 Kudos
Message 10 of 11
(3,530 Views)