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.
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.
12-12-2013 04:02 PM
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!!
12-13-2013 06:22 AM
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.
12-13-2013 09:48 AM
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.
12-13-2013 10:18 AM
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.
12-13-2013 10:32 AM - edited 12-13-2013 10:33 AM
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.
12-13-2013 01:43 PM
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...
12-13-2013 02:01 PM - edited 12-13-2013 02:04 PM
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.
12-13-2013 03:39 PM
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. 🙂