LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I convert bits into a word

I actually figured out how I could do it. I just stored the output of the LSB and MSB as local variables and put them into a table. 

Thanks.

0 Kudos
Message 11 of 17
(1,240 Views)

Glad you got it working. This is what I was suggesting, though, for your reference:

2.png

1.png

 

Hope this helps

0 Kudos
Message 12 of 17
(1,227 Views)

So I am now getting better values sometimes, but LabVIEW is reading the wrong values sometimes since Things are coming in from a while loop and going through true/false conditional loops. What is happeing, is LabVIEW enters the while loop, but while the loop is processing, values change, so my DAQ readings are wrong. I tried to use some logic to filter out these bad readings with a "select function", but since values that go into these loops are only processed once at the beginning, a bad value sneaks by. 

 

In my attached .vi file you will see that from my PortA.1, I have the signal running into a true/false conditional loop and then to a "select function" gate. This is supposed to filter out any bad signals if my PortA.1 ends up going "high" after the while loop has already started to run again. But since the true/false loop only reads this value at the beginning of the process, and somtimes changes after the loop has begin, this allows these bad readings to sneak by. So I feel I am just having bad timing issues with everything. Is there a way to process this PortA.1 value while in the true/false conditional loop? Or do you have any other suggestions? I tried storing the value as a variable but that didn't seem to work either.

 

Thanks for the additional help.

0 Kudos
Message 13 of 17
(1,208 Views)

You really need to eliminate those local variables. Pretty certain you have a race condition. You already know how to use a shift register. Why don't you do the same?

 

Having constants wired to the while loops termination terminals is also bad style.

0 Kudos
Message 14 of 17
(1,199 Views)

So I got rid of my stored variables and used shirt registers. I am running into issues with my MSB and my LSB not storing themselves into the table. My output only flashes either the LSB or the MSB and never together. Why is this? My output also flashes a blank array inbetween each of the LSB and MSB outputs. That is why I used the stored variables, because it did not cause this issue.

 

Thanks.

0 Kudos
Message 15 of 17
(1,189 Views)

Hey archimedes,

 

Just to follow up with dennis' point, take a look at these docs:

http://decibel.ni.com/content/docs/DOC-2239

http://zone.ni.com/devzone/cda/tut/p/id/7585

http://digital.ni.com/public.nsf/allkb/4F3CC921B4179F9F86256A3B0045CE2D?OpenDocument

 

As to your current problem, it looks like you are not properly accessing the correct array, so you are deleting data. As you can see from this picture, you are always inserting data, in every loop, into a blank array:

delete.png

 

So what you should instead do is this:

 

false.png

true1.png

true2.png

 

You don't need the case selector, since you already have a case structure performing the same function.

 

Hope this helps,

 

Message 16 of 17
(1,166 Views)

Thanks for the help I really appreciate it. I will give it a try.

 

-Nick

0 Kudos
Message 17 of 17
(1,161 Views)