12-11-2020 03:51 AM
Hi All,
I have used many of the Thorlabs/Profile PRO800/8000 units in the past in conjunction with LabVIEW and they have always worked nicely. However this has only ever been with a NI GPIB to USB cable.
Now I'm trying to use the PRO8 for the exact same function but via the RS232 connection instead, and I'm having no joy. I'm using a standard RS232 DB9 cable with a null modem adaptor as this is necessary for the model of PRO8 I'm using.
However, I cannot get the standard PRO8.llb to work. This is strange as sending commands via RealTerm (serial comms software) works perfectly.
In LabVIEW I've used the 'VISA Configure Serial Port' to set the baud rate etc to the same as that of RealTerm, then VISA write to send the exact same commands. But only '*IDN?\n' appears to work, whilst the rest of the PRO8.llb does not. Or even using any of the PRO8 specific commands via the 'VISA Write' do not work when using the same format as shown in the attached screenshot.
The error is often:
VISA: (Hex 0xBFFF003A) Unable to start operation because setup is invalid (due to attributes being set to an inconsistent state).
Is there something I'm missing in order to use the serial port with a VISA library?
Any guidance would be much appreciated.
Thanks,
K.
Solved! Go to Solution.
12-11-2020 05:16 AM - edited 12-11-2020 05:30 AM
Is this a standard serial port or a USB-RS232 converter? What type?
If it is an USB-RS232 adapter, try with a different model and make.
You mention that "*IDN?/n" works, then show an image with that, which supposedly doesn't work?
One thing the manual does not seem to detail very well: While it shows the \n for the *IDN? command, it is missing that for all the other commands. While this is not a problem for GPIB communication since the GPIB bus has a specific handshake line that is by default asserted with the last character byte send over the bus, there is no such handshake line on RS-232. Instead there needs to be a different means to indicate to the receiver that the command message is finished and depending on the device this is either <CR>, <LF> or <CF><LF> and some instruments support any of them <CR> corresponds to \r in the backslash syntax and <LF> is \n.
So if you want to do RS-232 communication you will most likely have to append at least an \n to any command you send to the device (make sure the string is set to show backslash characters when typing this, \n in a normal string will simply send two bytes to the device that it will almost certainly bark over).
(And if the device is not very old and crumpy, adding that character to the end of a command send over GPIB should not have any negative influence.)
12-11-2020 09:40 AM
Thanks rolfk - this is the solution!!
You have to concatenate the string command with a CR and LF when using RS232 - something that is not necessary when using GPIB.
Problem solved.