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.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

error using rs232 with visa

Hello,
I'm having trouble using the serial vi. with visa. The problem is a timeout error when receiving the data back.
I tried to increase the time and slowed the baud rate but that was no help. I did use another program I found on the web and I recieved the data back with no problem so there is nothing wrong between the pc and the chamber.
Here is some background information:
baud rate: 9600
parity: even
stop bit: 2
chamber: espec HAST model tpc41
I hope someone can help or a suggestion I can try.

Thank you
Joe
0 Kudos
Message 1 of 9
(3,600 Views)
Hi Joe,

Exactly what program are you using that is giving you the problem? Is it an example that ships with LabVIEW? If so, which one? You might try placing a wait function between the write and the read functions. Sometimes if the program moves too quickly, it can try to read from the instrument before the instrument is ready to send data back, which can result in a timeout. This may be what is going on here.

Hope this helps!

john m
Applications Engineer
0 Kudos
Message 2 of 9
(3,581 Views)


@joeross wrote:
Hello,
I'm having trouble using the serial vi. with visa. The problem is a timeout error when receiving the data back.
I tried to increase the time and slowed the baud rate but that was no help. I did use another program I found on the web and I recieved the data back with no problem so there is nothing wrong between the pc and the chamber.
Here is some background information:
baud rate: 9600
parity: even
stop bit: 2
chamber: espec HAST model tpc41
I hope someone can help or a suggestion I can try.

Thank you
Joe


It is the example that comes with labview.. I tried it in debug mode and just stepping through it in debug mode but still gives me a timeout error..

joe
0 Kudos
Message 3 of 9
(3,577 Views)
Are you correctly sending a termination character with your commands? VISA does not do this automatically. Typically you have to append a CR, LF, CRLF at the end. This is a common problem for new users. If the instrument doesn't see a correct command, then it won't send anything back and you'll get a timeout error. Right click on the string control where you are entering the command and select '\' Codes Display. Then at the end of your command, type either \n or \r. Your instrument manual should tell you what the correct termination character is.
0 Kudos
Message 4 of 9
(3,572 Views)
yes, I made sure the carriage return was at the end of the command as requested from the instruction manual
0 Kudos
Message 5 of 9
(3,553 Views)
Take the example you're using or the VI you wrote, enter the entire command string, and then right click on the control and select Operate>Make Current Values Default. Save this VI and post it here.
0 Kudos
Message 6 of 9
(3,546 Views)
Hi again Joe,

I am assuming you are using the example titled Basic Serial Write and Read.vi that ships with LabVIEW. There are several serial examples that come with LabVIEW, and I want to make sure we're all on the same page. Is the other program you used that worked also a LabVIEW program? If so, what are the differences between the programs? Can you observe any setup differences between the two? We want to help out, but I need a little more information since I've never used your specific hardware.

john m
0 Kudos
Message 7 of 9
(3,544 Views)
hello,
The path for the vi I was using:
examples\instr\smplserl.llb\labview<-->serial.vi
I changed the stop bits to 2 and changed the parity to even
I tried letting labview put the carriage return on the command line and I tried attaching it the carriage return myself.
The other program I used was not written in labview.
0 Kudos
Message 8 of 9
(3,527 Views)
At this point, I'm out of quick fixes. Since it was third party software that you used to communicate and not LabVIEW or Hyperterminal, there could be something special required. This could be a lot of things such as hex commands required or a CRC. If you have an electronic copy of the programming manual, you could try attaching that and someone could take a look at it. I did some browsing and found that Espec has a LabVIEW driver but you model wasn't listed as being supported. It might be worthwhile however, to give it a look to see how they have done it. You might also check with Espec to see what are the differences between your model and the supported ones.
Message 9 of 9
(3,512 Views)