From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading serial from 3rd party device

Solved!
Go to solution

Hello,

 

I try to communicate with a 3rd party device, a smoke tester for trucks, using serial read in LabView. I've attached the command parameters in dokument. I use the diesel parameters on page 9. I don't manage to get out sensible information. There are no bytes at port when running the program. But one time I had 6 bytes at port running the code. This only happened once. See picture in attachment. I'va also attached the code.

 

Can anyone help me?

Serial_1.png

0 Kudos
Message 1 of 24
(3,574 Views)

Hi paalbrok,

 

the manual says you need to use a baudrate of 9600, but you use 19200 in your VI…

Best regards,
GerdW


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

Hello GerdW,

 

Thanks for your reply

 

I get no data with 9600 baudrate as well. The problem has to be something else.

 

br,

paalbrok

 

0 Kudos
Message 3 of 24
(3,551 Views)

What command are you trying to send and receive the response?

 

Thanks,

Arev

 

CTO | RAFA Solutions

 

Certified-LabVIEW-Embedded-Systems-Developer_rgb.jpgCertified-LabVIEW-Architect_rgb.jpg

0 Kudos
Message 4 of 24
(3,539 Views)

Hello,

 

As you see from attached picture, I've used the 0x64 0x9C HEX command which read out the parameters from the device. It doesn't work.

 

br,

paalbrok

0 Kudos
Message 5 of 24
(3,532 Views)

Hi paalbrok,

 

no, you don't send those hex data. You send a string containing the ASCII chars "649C", followed by "\r" as it seems!

 

Set the display mode of those string constants to "hex"…

Best regards,
GerdW


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

Hello GerdW,

 

649C is HEX. I send this and recieve no data. \r is 0D in HEX. I try to send different strings "649C\r" and "649C 0D" using HEX display mode. Also \r\n in the end. Nothing works.. Do you have any ideas?

 

Can you modify my code with correct string constant if I misunderstand?

 

br,

paalbrok

0 Kudos
Message 7 of 24
(3,498 Views)

If it is really in Hex, you are expected to see the following, when reading highlighted string. It will not show you 649C, as in your screenshot.

 

Capture.JPG

Message 8 of 24
(3,493 Views)

Hi paalbrok,

 

arevhamb is right - that's why I suggested to check your string constants!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 24
(3,483 Views)

When communicating with an unknown device, MAX is your friend.  With MAX, you can quickly set up your Serial Port for (almost) any Baud Rate, Parity, Bit length, etc.  Don't neglect the Parity setting -- we recently attempted to establish communication with a serial device, knew we had the right Baud rate, and were using the usual N-8-1 bit configuration.  Nothing.  Just for fun, we tried O-7-1 -- got garbled text.  E-7-1 was what we needed ...  Hooray for MAX!

 

Bob Schor

0 Kudos
Message 10 of 24
(3,438 Views)