Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Organize Hexadecimal data / USB interface

Solved!
Go to solution

Hi,

I implemented on a microcontroller (PIC16F877) a program which send BCD codes (8 bits each transmission) via USB. Due to synchronization issues, the data are sent continuously. I can receive the data on labview. However, I must not read the data all the time and therefore the data read aren't on the right order. I added a start frame to my data and I would like to know how I can move my bytes to organize them on the right order (Frame/Data1/Data2/..)? (Maybe using a loop with a comparison)

Then how can I select only some bits? Do I have to reset the other bits?

 

I hope I was clear enough. I'm quite a beginner with labview (started a few weeks ago)

 

Thank you

0 Kudos
Message 1 of 5
(3,560 Views)

Might need some sort of start/stop bit pattern to key off of.  Assuming no data loss, once you find the "start" of the byte pattern you can bring in some fixed number of bytes per read operation and build an array from that to parse out.

0 Kudos
Message 2 of 5
(3,558 Views)

Yes I am using a frame (special byte). I am changing the string into a bytes array. Then I'll look for the frame into the array and take only the data needed that are after. I think this should work. Lets try 🙂

0 Kudos
Message 3 of 5
(3,556 Views)
Solution
Accepted by topic author nicog

Hi,

The information read in the buffer is of string types. To work on the BCD code I must probably change it into a byte array and then decode byte per byte. But it doesn't work. The translation is wrong. Do u have any idea why?

I attached my VI. This one is just a test code that I will implement after on my VI reading the USB input

0 Kudos
Message 4 of 5
(3,541 Views)

So apparently the first part works. The format displayed was wrong. I must now read 4-bits per 4-bits and apply the right multiplication.

0 Kudos
Message 5 of 5
(3,535 Views)