10-04-2023 03:58 AM
Hello,
I am a newbie in LabVIEW. I am trying to plotting the serial data.
My data packet is 252 bytes. ADC bit: 12 -0.75 bytes. It means I have 336 data/packet.
How can I work with bitwise in LabVIEW?
Appreciate your suggestions.
Bests,
Solved! Go to Solution.
10-04-2023 04:09 AM - edited 10-04-2023 04:11 AM
Hi hmd,
hmdpostech@postech.ac.kr wrote:
How can I work with bitwise in LabVIEW?
Yes, you can handle bits.
There are a lot of bit-related functions, like NumToBoolArray, all the boolean functions, Rotate/Shift numerics, …
Suggestion: most often you don't need to convert to boolean data (green wires), you can do all your data handling using numeric (blue integers) datatypes!
hmdpostech@postech.ac.kr wrote:
My data packet is 252 bytes. ADC bit: 12 -0.75 bytes. It means I have 336 data/packet.
How did you calculate those numbers???
252 bytes are 2016 bits. When your ADC gives 12bits/sample then you will have 168 samples in the packet…
10-05-2023 03:47 AM
Dear,
Thank you for your suggestions.
I have played around it.
I convert 252 bytes into 168 12-bit data like this and it works.
My problem is I always loss the 1 serial byte.
Besides, let's assume that I already have 168 data.
How can I do some thing like this in labview?
for (int i = 0; i < 168; i+=6)
{
plot (graph1; data_buffer[i];
plot (graph2; data_buffer[i+1];
plot (graph3; data_buffer[i+2];
plot (graph4; data_buffer[i+3];
plot (graph5; data_buffer[i+4];
plot (graph6; data_buffer[i+5];
}
Appreciate your help.
MinhDuc
10-05-2023 04:06 AM - edited 10-05-2023 04:07 AM
Hi Minh,
hmdpostech@postech.ac.kr wrote:
How can I do some thing like this in labview?
for (int i = 0; i < 168; i+=6)
{
plot (graph1; data_buffer[i];
plot (graph2; data_buffer[i+1];
plot (graph3; data_buffer[i+2];
plot (graph4; data_buffer[i+3];
plot (graph5; data_buffer[i+4];
plot (graph6; data_buffer[i+5];
}
Use the Decimate1DArray function to decimate your sample array into 6 plots…
hmdpostech@postech.ac.kr wrote:
I convert 252 bytes into 168 12-bit data like this and it works.
My problem is I always loss the 1 serial byte.
As long as you only show images of your VI we cannot edit/debug/run them in LabVIEW…
(I prefer VIs downconverted to LV2019 in case you use a more recent LabVIEW version. There's a "Save for previous" item in the File menu.)
10-07-2023 01:10 PM
What we know:
252 bytes (as @GerdW mentioned) is 2016 bits. You say this represents 336 data points, which means you are getting 6-bit A/D data. Really? I've heard of 12-bit A/D chips, but 6-bit?
As we used to say (in my Undergraduate Days), "Answer Analysis reveals that the Question is Wrong" (or, perhaps more charitably, "mis-explained", and without proper LabVIEW documentation (this means attach your VI, saved as LabVIEW 2019, PLEASE.
Bob Schor
10-16-2023 02:33 AM
Thank you for all your suggestions.
I am quite busy recently.
I found that I should disable the termination char in VISA Configure serial port.
Bests,
MinhDuc