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.
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.
02-14-2022 09:50 AM
Hello everyone,
I recently changed the computer (from windows 7 to windows 10) that is communicating with a bunch of instrument, especially one in RS232.
Since I switched computer, I had trouble establishing a communication with that instrument, either through NIMax or via LabVIEW.
More specifically, I have trouble from reading instruction from the port: it work perfectly or not at all from one day to another, for a reason that I cannot understand.
The instructions that I write on the port are always taken into account by the instrument, meaning that the communication is established, but I sometimes can't Read at all instructions from the instrument (leads to timeout).
The port configuration (baud rate, stop bit, parity, buffer size ...) are correct, and I write the instruction in the good way (term char, line feed etc.).
So, I can't figure out why it sometimes work, and why it sometimes does not work:
-Is it linked to this new computer's port configurations ?
-Are there errors stuck in the instrument register ?
More information are probably needed, I am not an expert in the field.
Thanks in advance for your ideas !
Sam
Solved! Go to Solution.
02-14-2022 10:16 AM
I would need to see code and have more information on the instrument to verify, but my guess is that you are sending things too quickly. This is a common thing when you use a new computer (computer is faster and so you suddenly run into race conditions). So you may need to add some delays.
02-14-2022 10:43 AM
Thank you for four reply. So when the initialization is done with LabVIEW, the Write function is used the send a bunch of commands to reset registers on the instruments (these commands works). Then the read function is used to verify register's state. The "Bytes at port" property node always return zero when the read function is not working.
Why would it be a "race conditions" ? The code procedure is always the same, it sometimes works and it sometimes ends on timeout loops.
02-14-2022 11:36 AM
I'm not understanding why you are sending 1 byte at a time. The Serial Write can just do the whole string at once. Furthermore, I highly recommend you transition to use VISA for your communications. VISA can handle a lot of your code for you. For instance, you can enable the termination character and then tell the VISA Read to read more bytes than you should ever get in a message and it will just return the message (the read ends when the termination character is read).
03-29-2022 06:34 AM
You wrote that you changed the computer.. so the cable& connectors were mechanically stressed
Since it work in one direction
Sometimes just a failed contact broken cable .. loose contacts are always a nice source of errors BTDT 😄
03-29-2022 06:44 AM
Hi,
Sorry for not updating this topic earlier.
As you mentioned it, I realised some weeks ago it was a hardware problem: the Rx wire inside the DB9 port wasn't brazed anymore due to mechanical stress. Contact was still maintained, explaining why the communication worked from time to time. It is now resolved as I re-brazed the Rx wire 😄
Thank you,
Sam.