Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Visa not parsing correctly

 

I am connecting a Nonin pulse oximeter to Labview using a serial data to usb connection.  The information from the Model 7500 is sent in an ASCII serial format at 9600 baud with 8 data bits, 1 start bit, and 2 stop bits. Each line is terminated by CR/LF. However when I try and read the serial data in Labview using visa read, I only get single random characters.  I am not sure what I am doing wrong.  I've set the stop bit to 2 and all other settings are correct in Labview.  I thought there was something wrong with the the byte count and I set up a control on the front panel and I clicked through 1-100 to see if I could change what was coming through with no avail. It should only be about 20 bytes anyways.  I know that labview can only read one termination character.  I've tried changing the termination character to either CR or LF and that hasn't made a difference. Even though there are no carriage returns in the data I am reading.  The serial output should be SPO2=XXX HR=XXX.  I have also tried turning off the termination character in Serial Reads and that also doesn't work.  Any advice would be appreciated.

0 Kudos
Message 1 of 11
(835 Views)

Goodmorning

Does it work in a serial terminal?

It could be you have swapped send and receive connections and maybe you need to send a command before it starts.

Anyway you should activate the terminal read on a line feed, then the count can be 100 but will be stopped on the line feed.

And please connect the output directly to the string instead of typecasting.

greetings from the Netherlands
0 Kudos
Message 2 of 11
(809 Views)

I have tried using it in NIMAX and I basically get the same results, a bunch of random characters. Is this what you mean?  When I run this I get the same random characters and an error saying framing issues.  Not sure how to get it to read properly.  It shouldn't need a command before starting. 

0 Kudos
Message 3 of 11
(719 Views)

why are you type casting?

 

No need for that. The default is OK.

 

I slightly modified your vi.

Let know if this works or not.

 

Maybe the bausrate is not correct.

greetings from the Netherlands
0 Kudos
Message 4 of 11
(709 Views)

I was typecasting to add a line feed termination character.

This code shows error code -1073807253 immediately after hitting play button.

0 Kudos
Message 5 of 11
(706 Views)

Indeed a framing error, probably boudrate or not two stopbits, or anything.

greetings from the Netherlands
0 Kudos
Message 6 of 11
(703 Views)

I’ve looked in the manual for the serial device and the settings are right. It does use carriage return and line feed as the termination character. Is that the reason it’s not reading properly?

0 Kudos
Message 7 of 11
(695 Views)

You can safely change the number of stopbits to 1.

Only in writing this is important and you only read. Maybe this helps.

greetings from the Netherlands
0 Kudos
Message 8 of 11
(679 Views)

Hello. I'm trying to read the output from a Nonin 7500, and I’m facing the same issue as Koa123. I haven’t worked much with LabVIEW and registered on this forum to share a potential solution to this problem. I’m attempting to do this in Python, using something as simple as:

 

import serial

ser = serial.Serial( port='COM3',

baudrate=9600,

bytesize=serial.EIGHTBITS,

stopbits=serial.STOPBITS_TWO,

timeout=1 )

 

print("Connected to", ser.port) # Read bytes until the newline and display them in a single line

try:

while True:

   line = ser.read_until(b'\n') # Reads until a newline character (CR - 0x0D)

         if line: # Convert the complete line to hexadecimal and ASCII in a single line

         ascii_output = ''.join([chr(byte) if 32 <= byte <= 126 else '.' for byte in line])

         print(f"{line} in ASCII: {ascii_output}")

except KeyboardInterrupt:

         print("Program interrupted")

 

finally:

   ser.close()

 

Output:

Conectado a COM3
b'\x00V\x04X3a\x03c\x0c\x03\x0b+a\x032c\x03y=' en ASCII .V.X3a.c...+a.2c.y=
b'V\x04X3a\x03c\x0c\x03\x0b+a\x032c\x03y=' en ASCII V.X3a.c...+a.2c.y=
b'V\x04X3a\x03c\x0c\x03\x0b+a\x032c\x03y=' en ASCII V.X3a.c...+a.2c.y=
b'V\x04X3a\x03c\x0c\x03\x0b+a\x032c\x03y=' en ASCII V.X3a.c...+a.2c.y=
b'V\x04X3a\x03c\x0c\x03\x0b+a\x032\x0c\x03y=' en ASCII V.X3a.c...+a.2..y=
b'V\x04X3a\x03c\x0c\x03\x0b+a\x032c\x03y=' en ASCII V.X3a.c...+a.2c.y=
Programa interrumpido

 

 

The output is always the same (change with real measures, of course) and actually looks consistent with the type of message expected. I believe that the symbol "V" might represent "S", "X" might be "O," "3" might be "2," and "a" might be "=". But I haven’t been able to figure out much beyond that.

Any solutions? Thanks from Madrid.

0 Kudos
Message 9 of 11
(124 Views)

Hey, my problem was fixed by buying the serial output cable from Nonin. Apparently, you cannot just buy any RS-232 cable and connect it to it.

0 Kudos
Message 10 of 11
(99 Views)