01-27-2014 02:57 AM
Hi make…,
the communication protocol between sensor and microcontroller is irrelevant here.
You need to know the protocol between microcontroller and PC/LabVIEW!
Study the C code you attached above. Ask the author of that C code!
01-27-2014 07:10 PM
Hi! The program sends the data in float. It is something like this, but there are several headers being sent.
01-28-2014 01:49 AM
Noone here can tell you what your data means. If you want to get pitch and yaw and such from a stream of data, you have to know which bytes of data contain the pitch, for example, and how many bits or bytes at what offset, etc. Once you have that information, we can if necessary help you to convert that to a usable number.
In the "C" program, it looks like the key is the function serialCom. This function looks like it handles several different kinds of messages though (one of them fills in rcDataSerial, which seems to be the data that you want).
Figuring out a data format by analyzing C code like this is a headache. If you have been given the job of handling this data, someone should be able to provide you with the information you need to analyze it. If not, you may have to sit down and analyze the C code. But perhaps you can contact the company which makes the equipment you are using.
Avionics is my field. If you were talking ARINC-429 protocol, for example, perhaps we could help you, as there are defined engineering units for different labels and equipment. But serial communication is totally application dependent. You can't get altitude, pitch, roll, yaw, from a stream of data unless you know where in that data these numbers are, and how they are encoded (for example, BCD, pure binary, or even ASCII digits for goodness sakes).
We would like to help you, but we don't know this information.
Batya
01-28-2014 04:22 AM
I see! One question.. Is it possible to write a C program and just somehow put it in Labview? Since I have the code already.
01-28-2014 04:28 AM - edited 01-28-2014 04:30 AM
If you create a DLL you can access the functions using LabView's Call Library Function Node VI.
01-28-2014 05:25 AM
Yes. That is, if you create a DLL you can access the exported functions using LabVIEW's Call Library Function Node.
You can also "import" the DLL, which will create wrapper functions for your exported functions. Of course, you have to check them over and test them, but in many cases they can be used as-is. If not, most functions require only a little tweaking.
Batya
01-28-2014 09:19 PM
Hi! The program sends and recieves like this. It sends out 2 bytes of roll, pitch, throttle, yaw and servo.
and then it recieves a reply of roll, pitch, yaw in 4byte float and ultrasonic (altitude) in short.
01-29-2014 01:50 AM
OK, that is very helpful. To interpret the received data, you can, for each value, take an array subset of the right size ( two or four bytes) and then do a type conversion on it. You'll have to see if the numbers come out right and possibly adjust the byte order; your scanned page doesn't mention that.
I'm supposing that you know what $ M > and 14 are so you can figure out the offests. Are these bytes?
To extract a subarray and type convert, see here.
Batya
01-29-2014 02:02 AM - edited 01-29-2014 02:12 AM
Hi Batya,
"$M>" is clearly visible in the attachments of the first message, so here ASCII is meant. "14" seems to correspond to an U8 and could denote the number of bytes in that µC message (3 SGL + 1 U16)…
See my message #5 and the string in hex display. Here you will find the corresponding pattern "244D 3E0E"…
01-29-2014 03:23 AM
Could you please save your vi back to version 11 or earlier and I will help.