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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial bitstream to databyte

Hi!

 

I have a NI PXI-6224 card connected to a device i would like to measure. The Signals consist of a serial clock signal and a serial data signal, each on its own port of the card. The data bits are triggerd on the positive slope of the clock signal. What i want to do now is get the data signals into bytewords of 32 bits and the complete signal into a matrix or 2D array. So far i put up a task for each channel to read every port of the PXI-6224 card individually. The clock signal has a frequency of 65 kHz. I work with LabVIEW for 3 weeks now, so please keep it simple 🙂

At first it would be nice to know how to get the serial bitstream into a parallel byteword, mybe in an array or something. Triggering it on the slopes of the clock signal would be next step.

 

Thank you!

0 Kudos
Message 1 of 8
(4,337 Views)

nobody has any idea?

0 Kudos
Message 2 of 8
(4,301 Views)

Hi Poar,

 

I created a little VI showing a possible solution how to create a byte out of a bit stream. I hope this is going to help you.

 

Regards, Topp

 

Serialize_bits.png

0 Kudos
Message 3 of 8
(4,286 Views)

Go back to MAX and configure a task to read all the ports using a continuous acquisition. Get it working there then save your task.

 

Goto a blank vi diagram and drop a DAQmx task and selct your saved task.

 

Right-click that same constant and select "generate config and code" (it says something like that) and LV will write the code.

 

That code should return 2d arrays of booleans (if your hardware is capable!) and then you can slice of you bits and format as you desire.

 

Have fun,

 

Ben 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 8
(4,279 Views)

Ok thank you so far for your help. I will try that tomorrow and tell you how it worked. I came up with a own solution of the problem to get the bites into an array using autoindexing of the while loop, i will see if i can get a screenshot of the vi and post it here. I have to see how i will do that, since LV runs on the other machine and USB sticks are not allowed to connect to this machine since it runs all the software for the testdevices. The bigger problem i have at the moment is to trigger the data signal on the clock. All of my solutions dont work the way i want it. Well im done with work for today and will continue tomorrow.

 

thx!

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

Ok, so i have tried to configure it in MAX. I can read the ports of the 6224 card, that works fine. I can also read the card in the VI. With using the autoindexing im also able to get the bits into an array. but i cant trigger the data signal to the clock. In MAX i have the option to set up a continous reading in the timing section. there i also have the possibility to set a trigger, but i cant set the trigger to my clock signal.

what im trying to do now is to detect the positive slopes of my clock signal and for eacht slope i want to read a bit from the data signal. both signals are on the ports of the PXI-6224 card. nothing i have tried did work...

0 Kudos
Message 6 of 8
(4,248 Views)

poar,

 

When you are configuring a task in MAX, the term 'trigger' refers to what triggers the task to start.  What you need to configure is the 'Sample Clock' which is found under the 'Advanced Timing' tab.

0 Kudos
Message 7 of 8
(4,225 Views)

Thanks, you helped me a lot. This is what i have so far: I put up a task in MAX in which i have one digital inputport for the data. the port is set to 1 sample (HW triggered). In extended timing settings i set the type to detecting changes and configured the port which carries the clock to positiv slope (i have the german version here, so possible that some terms may have another name). In the VI i connected the task to a reading block and the data of that block to a autoindexed array. the array goes into an array to number block. The VI seems to work so far.

 

Thanks again! Im sure there will be other problems in the future and i hope i will find some help here again.

 

 

0 Kudos
Message 8 of 8
(4,196 Views)