Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

serial communication between MCU and computer

Hi guys,

I'm realizing a little project. My problem is about the acquisition of data, generated from my device ( an electrocardiograph) by RS232. Actually The device produces a string of data like this: 2 bytes of header, 3 data bytes, and a byte for the time between 2 sampling. I realized the acquisition VI in attachment ( just the acquisition part, not the entire setup) which unfortunately gives data in group of 2 ( e.g. efa5 5ea3....). Is it possible to have data separately (e.g. ef 43 ff.....), so that it is possible to token the string with “match pattern vi”? The idea is in fact to divide the string into character and put them into an array.

Thank you Smiley Very Happy

0 Kudos
Message 1 of 5
(2,916 Views)

you can break up the string, or ask for less data. simply wire less e.g.6 instead of 6000

You even can ask for the use of an endchar if you have one, or use the first char of the header as an endchar for the previous data.

In the stringpalette you see a lot of functions to handle strings/characters

greetings from the Netherlands
0 Kudos
Message 2 of 5
(2,910 Views)

Thanks for the reply but the point is not the string handling, but the form of the incoming string from rs232 that is in group of 4 characters (e.g. FF3A CA5D....) instead of (e.g. FF 3A CA 5D....). I need many characters so I have to set the number of byte to 6000 or more.

Thanks again for your help.

 

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

Hi

If you change the string representation you see that this is just an optical group. It is displaying in hex format and that is causing the grouping.

In reality the characters are not grouped.

greetings from the Netherlands
0 Kudos
Message 4 of 5
(2,886 Views)

Smiley Very Happy Thank you, your replay solved my problem. I succeded in dividing my string in single bytes. I have just an other little problem ( I hope Smiley Wink): I have a while loop to acquire from rs232, an other one to divide the string obtaining 3 array and finally I should convert my hexadecimal string in a decimal one. Unfortunately the "hexadecimal string to number vi" gives me only zeros. String arrays are full of characters, but the instrument converts all in zeros. 

I would be really grateful if you could help me. In attachment there is my VI to make more clear my question.

Thanks a lot Smiley Very Happy

0 Kudos
Message 5 of 5
(2,866 Views)