LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA write/read using RS232

Hello,

I am trying to communicate with an IR thermometer (IRT) using LabView VISA write/read VIs via RS232. The block diagram I have created is similar to the standard Serial <-> VI provided in LabView examples.

 

The problem is that the IRT is not responding well to this VI. I said 'not responding well' because it sometimes acknowledges the commands written to it and sometimes doesnt. If I run the VI with the same command several times it eventually responds to the command but the number of times I have to send the command is totally random. When I operate it using hyperterminal it works absolutely fine - responding to every command the very first time. I have checked the input setting parameters such as data bits, parity, stop bits, flow control etc. - they are exactly the same for both, the hyperterminal program and the LabView VI.

 

I would really appreciate it if someone can point me in the right direction here.

 

Many thanks,

Sunil.

0 Kudos
Message 1 of 18
(12,099 Views)

Are you sending an End-of-Line character ('\n')?  Or setting the boolean to TRUE to add an End-of-line character?

Are you receiving all of the echoed data back?  If you send a command, do you get a full response back as you would with HyperATerminal?  or does it get truncated? 

 

If it is truncated, then you need to read the remainder of the buffer until it is empty..  I think the Advanced - Serial communication example does that.

 

R

Message 2 of 18
(12,086 Views)

When I operate it using hyperterminal it works absolutely fine - responding to every command the very first time

Can you post your communication part of your vi.Do you need to include a little delay before reading?

0 Kudos
Message 3 of 18
(12,074 Views)
Yes I am sending \n with the commands and setting the boolean to true as well. I do not recieve the echoed data back. The data is truncated when I read it. I would try emptying the buffer but I really need to sort out writing to the instrument. Any ideas how to fix the writing?
0 Kudos
Message 4 of 18
(12,067 Views)

>>OS:533; OS:552A;

E:100; MAX:23; MIN:21; DIF:2; AVG:22; HAL:75;

 

LAL:0; AMB:75; PRN:4; PRNF:1; IR:23; CF:1; FF:0; LF:0;

End

 

The above data appears when I send 'transmit' command to the instrument (command is 'T') 


>>XPRNF:0;
The above data appears when I send 'stop data transmission' command (command is 'P')

 

In case of hyperterminal there is no delay between writing the command and receiving the data from the instrument.

 

Any ideas what is going on here?

 

Any help would be much appreciated!!

0 Kudos
Message 5 of 18
(12,064 Views)

You should really post your VI.

 

Try sending a \r\n. This is what Hyperterminal does. This may fix your write problem.

 

Try setting the 'enable termination character' to false. With it true, as soon as a termination character is detected, the read stops. If you have multi-line responses, you need to use VISA Bytes at Serial Port to determine how many bytes to read and keep reading until this returns 0.

Message 6 of 18
(12,061 Views)

 

 

This is what the VI looks like. I tried \r\n and setting the boolean to false but it still doesnt work!

0 Kudos
Message 7 of 18
(12,055 Views)
sorry guys I pasted a picture of the block diagram with the previous post but it has gone through, I'll try again
0 Kudos
Message 8 of 18
(12,054 Views)
Post the actual VI and not an image and do not select preview.
Message 9 of 18
(12,047 Views)
I have attached the picture of the VI here.
0 Kudos
Message 10 of 18
(12,044 Views)