09-13-2011 11:04 PM
We didnt find any driver for our instrument so we are trying to capture data using the method i have explained before. Below is an example of the data packets that we are receiving in our serial port monitering software.
First data packet 13 88 04 4C 00 00 01 F3 00 00 7B 37 02 EE
Second data packet 13 88 04 4C 00 00 01 EE 00 00 79 D9 02 EE
Third data packet 13 88 04 4C 00 00 01 EB 00 00 78 BA 02 EE
Here as we have seen above 13 88 (5000=Frequency in decimal )04 4C (represents1100= voltage in decimal) is constant and the ending is represented by 02EE. Apart from tis the rest (for the first packet 01 F3= 499 asuuming current and 7B 37 = 31543 assuming power keeps on changing in every packet and they all have different scaling ). The 00 00 just represents the padding between them. Now we have to read the values in altogather say in different boxes and produce them in LabVIEW front pannel. Here i have attached a picture of the instrument reading side by side with the serial monitoring software reading. How do i do that? i have read something called visa read and write but they only accepts strings not in bytes. Any kind of help is appriciated.
Solved! Go to Solution.
09-13-2011 11:40 PM
Use string subset to break the string into its individual components. Then use typecast to convert the characters to the proper datatype.
09-14-2011 02:32 AM - edited 09-14-2011 02:33 AM
@gvcjgzj wrote:
... i have read something called visa read and write but they only accepts strings not in bytes.
I don't understand what you are trying to say here. Strings ARE bytes!
Apparently, you are reading 14byte strings. Easiest to parse would be to typecast, because your data is already big endian. (chopping up the string as suggested above seems tedious).
Here's a quick example that includes the padding in by assuming I32 for current and power. To read them as I16, add two more cluster elements and make them all 16 bits and make sure the cluster order is correct. Use obvious names for the constants. Most likely, you need to do some other adjustments. Also for the other values you need to know if they are signed or unsigned integers.
Of course you can access any individual data using unbundle by name.. As an example, I graph current vs. power on an xy graph. Input is an array of strings, one element for each line.