LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert data received in USB port

Hi smalhao,

 


@smalhao wrote:

Can any one explain one solution for that conversion?

 


As soon as you provide a manual describing the content of those messages from your Arduino. You (and we) need to know the formatting of your data before we can suggest how to parse those data…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 21 of 24
(484 Views)

Get rid of that flush buffer as well.

If the message is broken up into two parts separated by a line feed (which is a bad protocol for synchronization), then you are only reading the first line and probably discarding the second line.

 

Gerd gave you a message earlier that described what he thought the underlying math would be for the 24-bit number.  Do a Scan from String with a %d format, then do the math he described.

0 Kudos
Message 22 of 24
(477 Views)

I was able to talk to the developer of the code in Arduino MKR and he send to me the code in void loop function

 

the code is 

void loop() {
  if (notifySerial)  {
ch1Data = AD7193.ReadADCContinuous(); //we are in Continuous mode
                ch1Data=(ch1Data >> 8); //remove status register
                Serial.println(ch1Data);
    }
}

Additional information he gives to me:

 

The result is a continuous stream of strings encoding the value read by the 24-bit ADC. Each string with delimited values ​​is displayed with special characters <Carrier Return> <Line Feed>. So looking at a serial port, what you expect to receive are the strings that look like this:

 

8388608
8388607
8388609
8388620

"

I hope this information help to my question, because i don't no how i can make it. 

0 Kudos
Message 23 of 24
(440 Views)

Make what? You were already able to read those numbers, so convert the strings to integers with %d, then apply rescaling according to the simple math we reviewed earlier.

As for the timestamp, there is no such field in the output stream, so pick the computer date and stick it yourself to the calculated voltage data.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 24 of 24
(435 Views)