LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble with SR530 communication

A carriage return is a \r - not \n. Your image does not show anything useful. In order to send the actual termination character, a string control has to be set for '\' Code Display (right click option), you concantanate the CR constant on the string palette, or you set the ASRL End Out property. The Basic Serial Write and Read example uses the '\' Codes display option and the Advanced Serial Write and Read Example uses the property node. Not at all sure why you used the GPIB example instead of either of the serial examples. If you had used one of the correct examples, you probably would have had it working by now.

0 Kudos
Message 11 of 19
(1,974 Views)

I had tried that VI previously with no luck. However, this time with the correct termination character it has worked to some degree. I was able to change a few settings on the instrument remotely as well as read a few items. I still cannot complete some tasks such as reading an output, and I am still getting this error (attachment). It seems to be associated with VISA read.

 

Also, being relatively new to this type of jargon, what do the "bytes to read" signify and may this have an effect? Thanks again

 

Ian

0 Kudos
Message 12 of 19
(1,968 Views)

The error indicates that the instrument did not send anything back to the pc. Obviously, you have to be sending the correct command to the instrument for it to respond. I have no idea what the G12 command does.

 

The bytes to read is exactly what it sounds like. You tell the VISA Read to get that number and if that number is not available, you will get a timeout error. It looks like you got 0 bytes read. When an instrument uses a termination character, you want to enable it with the VISA Configure Serial Port. Then, you specify some high byte count to read and the read will automatically terminate when the terminatiion character is detected - not when the specified byte count is read.

0 Kudos
Message 13 of 19
(1,953 Views)

The command I sent is a valid command (as it's listed in the manual). The write command does seem to work, however the read is still not functioning correctly. I have gotten it to read certain values, however it continues to give me the timeout error. I enabled the termination character and set the bytes to read to some arbitrary large number. Even when it reads a value and displays it for me, the timeout error still occurs.

0 Kudos
Message 14 of 19
(1,931 Views)

But what did you set the termination character to (the default is a LF)? Your previous VI does not show a change to this. And is this G12 a command or is it a query? What does the manual say it is supposed to return? Modern instruments append a '?' to queries.

0 Kudos
Message 15 of 19
(1,918 Views)

I changed the termination character to the carriage return (Hex 13). The commands I've used here are P45\r, which changes the phase setting to 45 degrees. The read command is simply P\r which asks to return the phase setting. After running the program the "\n" was added by itself. I've also used a COM port sniffer to monitor the back and forth between the instrument and PC, can you help with interpreting this?

0 Kudos
Message 16 of 19
(1,899 Views)

Hi IanMcD,

 

Here is a Knowledge Based article that deals with troubleshooting VISA time out errors. I am not sure if you have scene it but you may find it useful.

 

http://digital.ni.com/public.nsf/allkb/E6DFA2B8D7E99F9886256C14005E82F7?OpenDocument

 

Regards,

 

Josh Brown

 

Applications Engineer
National Instruments
0 Kudos
Message 17 of 19
(1,874 Views)

All

   I believe that problem has been resolved. Its seems that even though the termination charater is turned on, the bytes to read may still matter. Currently set at "8" it is working. It is still reading the values relatively slowly though, since what I am trying to read is a constantly changing number. The baud rate is at its highest; is there a way to speed up labview's execution of a loop? Thanks again!

 

Ian

0 Kudos
Message 18 of 19
(1,854 Views)

Hi Ian,

 

There are several things you can do to speed up a loop. Something like disabling debugging can help.

 

Let me know how else I can help with this or if there is a specific goal you are looking for in terms of speed.

 

Regards,

 

Nathan B

Applications Engineer

National Instruments

0 Kudos
Message 19 of 19
(1,836 Views)