NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
nicog
Posts: 10
0 Kudos
Accepted Solution

Organize Hexadecimal data / USB interface

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

Active Participant
SnowMule
Posts: 685
0 Kudos

Re: Organize Hexadecimal data / USB interface

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.

Member
nicog
Posts: 10
0 Kudos

Re: Organize Hexadecimal data / USB interface

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 :smileyhappy:

Member
nicog
Posts: 10
0 Kudos

Re: Organize Hexadecimal data / USB interface

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

Member
nicog
Posts: 10
0 Kudos

Re: Organize Hexadecimal data / USB interface

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.

By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page