LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

rs485 serial communication

Solved!
Go to solution

Hi,

I am trying to design a LabVIEW to get the temperature through the PMD-MXT temperature sanner. It is possible to get the response through the serial port utility. But I cannot get any response with the LabVIEW serial read and write example. I design my own one and it still doesn't work.

Could you help me?

0 Kudos
Message 1 of 12
(364 Views)

May you save your vi for LabVIEW 2017 or earlier version? I can't read it.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019
0 Kudos
Message 2 of 12
(340 Views)
Highlighted

This is the 16.0 version file. Also here is a screenshot for the serial port test.

0 Kudos
Message 3 of 12
(335 Views)

Your vi does not show what's the string you are sending. Do you properly terminate the command with a line feed or a carriage return?

I suggest to concatenate a LF constant (String palette) to the command you are typing manually into write buffer. Use a big delay between read and write as a first test.

However, using a delay and Bytes at port is not the best option. I guess the response is also terminated with LF or CR, although the manual does not say anything about it. If the terminator is LF, remove Bytes at port and wire to byte count a constant bigger than the length of the message you expect as a response. Also, wire a reasonable timeout to VISA Configure Serial Port, say one second. The Read function will return as soon as the terminator character is received. If the terminator is CR, you should also wire 13 (decimal) to the termination char input of VISA Configure Serial Port.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019
0 Kudos
Message 4 of 12
(325 Views)

I just find it said in the manual that the command is terminated with CR or LF. I will try both ways to read it.

0 Kudos
Message 5 of 12
(318 Views)

I changed the wiring but it said 

Error -1073807194 occurred at Property Node (arg 8) in VISA Configure Serial Port (Instr).vi->read rs485.vi

Possible reason(s):

VISA: (Hex 0xBFFF00A6) The connection for the given session has been lost.

Are there some other problems do I have?

Here is the new vi and command I sent.

0 Kudos
Message 6 of 12
(311 Views)

I guess you put the string control write buffer in '\' Codes display? Otherwise \n will be sent as two characters.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019
0 Kudos
Message 7 of 12
(293 Views)

I put \n as the command termination and I replace it with \. It still doesn't work.

0 Kudos
Message 8 of 12
(267 Views)

Try with this vi.Try also wiring 13 as Termination Character. If it works, how much time is needed to get a response?

Remark that two string controls or indicators feature the '\' Codes Display option.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019
0 Kudos
Message 9 of 12
(252 Views)

I try both 10 and 13 as termination character, and it is not working.

0 Kudos
Message 10 of 12
(229 Views)