LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital output control panel with NI 9401

Hi everyone

I tried creating a simple control panel for an AC motor i'm working with. It needs only 3 functions- fwd, back, stop.

After reading a little i saw a suggestion to use cases, so it's exactly what i tried.

I attached the snippet of what i ended up with (not the whole program- there are other parts), yet it does not work. I would appreciate if anyone can try to suggest an idea what did i do wrong

 

Thanks

 

 

0 Kudos
Message 1 of 6
(1,949 Views)

Hi Pika,

 

yet it does not work.

First problem: you don't tell what exactly didn't "work"…

Any errors?

 

I would appreciate if anyone can try to suggest an idea what did i do wrong

Why do you use local variables instead of wiring those button terminals?

Why do you need to open and close that DAQmx task each time?

Why did you change the index value of those boolean array constants from zero to 1/2/3???

Where does the loop stop condition wire comes from? Is there a DATAFLOW problem?

Why don't you use AutoCleanup?

Why do you need to use switching buttons? Use latching buttons to get rid of all local variables…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(1,947 Views)

Hi, Thanks for the reply

I'm not getting any errors- it doesn't break the loop or cause anything to stop. It just...doesn't work.

Unfortunately unlike the analog voltage knob in this snippet, i can't really plug a voltmeter and see if it outputs something.

 

I used local variables because i needed them in two places, i need the case to flip the button back to "false" once it did what it needs to

 

I'm opening and closing the Daqmx task simply because i don't know any other way it night work (i am new to labview)

 

I changed the index values of the arrays because it gives the corresponding arrays i need for my logic table.

 

What i tried to do-

Let's take the fwd button for example, when i press the button i want it to out put "1 0 0 0" to channels 0, 1, 2, 3 accordingly (1 on channel 0, and 0 on the rest of the channels), and then flip back to false.

 

0 Kudos
Message 3 of 6
(1,935 Views)

Hi Pika,

 

It just...doesn't work.

That would indicate the DATAFLOW problem I mentioned before.

Did you debug using execution highlighting to actually watch DATAFLOW?

 

I'm opening and closing the Daqmx task simply because i don't know any other way it night work (i am new to labview)

Then you need to examine the example VIs coming with LabVIEW to learn about other ways!

(In general you only need to open a reference once before a loop and close once after the loop.)

 

I changed the index values of the arrays because it gives the corresponding arrays i need for my logic table.

No, it does NOT give you the "corresponding" arrays when you just change to displayed array index!

Again: learn the LabVIEW basics as provided by that Training section in the header of this LabVIEW board…

 

I used local variables because i needed them in two places, i need the case to flip the button back to "false" once it did what it needs to

When using latching buttons you don't need to "flip back", so you don't need those locals in two places…

(Did I mention the Training offers?)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 6
(1,921 Views)

I did try to debug using execution highlighting, it results in a bit of a mess because this program has other parts as well.

I thought i'd ask here before splitting it into an individual program to see if it's some glaring issue that prevents it from working. i see this isn't really the case.

 

Regarding opening the channel before the loop and closing after- this is what i'm doing with the other parts of the program, over here wiring from outside the cases to inside the cases showed a broken wire.

Let's leave efficiency aside for a second- is there any reason why this shouldn't work?

 

I changed the last part to latching and removed the local variables, oddly enough when i tried to do this before it gave me an error, now it doesn't. I probably didn't change the mechanical action properly before.

 

Once again, thank you for the help. 

 

0 Kudos
Message 5 of 6
(1,917 Views)

Hi Pika,

 

over here wiring from outside the cases to inside the cases showed a broken wire. … is there any reason why this shouldn't work?

Most probably THINK DATAFLOW!

But unless you show the full picture we can only guess…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 6
(1,910 Views)