From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ Assistant Ouput not consistent with DAQmx Output

Hi all, I've created a VERY simple piece of code in labview with a virtual piece of hardware (I have the hardware but at a workstation that doesn't have labview!!).

 

I am trying to read the digital inputs on indicators in the front panel. When setting up the virtual hardware, digital inputs are automatically set to count in binary. I would like to display this count on led indicators. 

 

I have all 7 out of the 8 bits counting, and for some reason the least significant bit, bit 0 just stays on the whole time. I think there is something wrong with the DAQmx Read VI, or maybe i shouldn't be using task out from DAQ Assistant? 

 

Any help would be greatly appreciated!!

0 Kudos
Message 1 of 8
(5,813 Views)

You are reading the lines twice.  The DAQ Assistant performs a read and then the DAQmx Read is performing a read.  Since you are only displaying the last read, of course your LSB is always going to be 1.

 

And you really should be using a stop button to stop your VI instead of the Abort button.  You need to do this so that the VI can do some cleaning up on stopping.  The Abort doesn't allow this to happen and you can mess up your system in the right conditions.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 8
(5,797 Views)

Okay I have removed the readmx subvi, and am now trying to read the data from daq assistant. Is there a way to convert the task out to an array? Any help is much appreciated. 

0 Kudos
Message 3 of 8
(5,791 Views)

Converting task out to anything does not make any sense. Are you really talking about the output called 'data'? There are conversion functions but I would recomend dropping the DAQ Assistant completely. Your DAQmx Read is closer to what you are asking for. You would just need to add the DAQmx Create Channel and DAQmx Timing functions to outside the loop.

0 Kudos
Message 4 of 8
(5,789 Views)

Just to clearify, your VI should look something like this.  I changed it to read a port instead of 8 lines.  It is a little easier coding this way.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 8
(5,785 Views)

i decided to do something similar before seeing your solution... not sure if it's as 'efficient' but it does do what i want it to... 

0 Kudos
Message 6 of 8
(5,780 Views)

Now I feel inclined to show you a shortcut.  You can configure your numeric indicators to show in hexidecimal or binary.  Right click on the indicator and click Visible->Radix.  You will now see a little 'd' next to your number.  That is showing you the display format of your indicator.  If you click on that, you will see that you can change the display to be binary, octal, or hex.  It is a lot simpler than going through the format string.

 

EDIT:  Just noticed you already had a Hex indicator.  So you probably already know about that.  Oh well.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 8
(5,774 Views)

The odd thing is that I had originally done this, and for some reason my binary string output was backwards.... If you look at my code, I do use an reverse array vi... not sure what this is needed for since the output of the Daqmx Read sub vi I  would think would use the least significant bit as the right most bit, except i was getting it to be the leftmost... In any case, it is operating the way I would like and now im trying to get labview installed with daqmx so it can find the subvi to run my code on the machine i need it on. Unfortunately that has now been giving me problems....

 

Thanks for the help though, truly much appreciated. 🙂

0 Kudos
Message 8 of 8
(5,769 Views)