LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial write and read only reads if command is written 3 times

I had set the output port to RS232 manually on the instrument so I wasn't using the OUTX0 command, but even if I submit "OUTX0\n*IDN?\n", I still have to submit that twice before it reads properly.

0 Kudos
Message 11 of 23
(1,872 Views)

Something I didn't mention before - the RS232 port on the lock-in is a 25-pin connection, and I'm getting it into my computer via a 25-pin to 9-pin adapter and then a 9-pin to USB adapter. Could there be a problem with the pin configuration? I assumed there wasn't since I can successfully write commands on the first try, and I ultimately get the correct output from a querying command (albeit only after 2 tries). But is there maybe another way the information could eventually make it to the right place through an incorrect configuration?

0 Kudos
Message 12 of 23
(1,864 Views)

What USB-Serial adapter are you using?  Prolific chipsets tend to cause issues while FTDI tend to be pretty rock solid.  I would expect an issue there.  Since you are occasionally getting a message through, the cabling should be fine.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 13 of 23
(1,857 Views)

Hm, I am indeed using a prolific chipset adapter. I've ordered an FTDI adapter and will update the thread when I get it. Fingers crossed!

 

In the meantime, I've found that the the read output is always in response to the first query I send. For example, if I send "*IDN?\n*STB?\n" (where *STB? queries the instrument status byte, but it could also be some other simple query), I get the correct output for the *IDN? query. Strangely, only a single additional *STB? is necessary, while two additional *IDN? queries are necessary to get the response to the first one.

0 Kudos
Message 14 of 23
(1,849 Views)

The other weird thought I was having is it could be a handshaking issue.  But I would expect no response at all if that were the case.  But you should probably double check all of your serial port settings match.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 15 of 23
(1,845 Views)

Update: I got the FTDI serial to USB adapter and it is behaving the same way as the prolific chipset adapter. Still stumped!

0 Kudos
Message 16 of 23
(1,795 Views)

If you can send commands and receive the response when you write the commands 3 times, it seems that the connection works, randomly but works, and the device generates the behavior, I would contact the manufacturer, there could be something missing.

0 Kudos
Message 17 of 23
(1,767 Views)

Are you able to set the baud rate on the instrument?  Maybe you can slow it down (and adjust the code accordingly) and try it?  If the problem goes away, or gets a lot better, maybe something is wrong with quality of the connection.  Higher speed connections are more susceptible to "line noise" than low speed ones.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 18 of 23
(1,757 Views)

Ok, problem solved, but not in a satisfying way. I was trying to get the basic interface working on my laptop before transferring it over to the computer that will actually run the instrument, but when I tried running it off that computer, I don't run into the problem at all. The computer is running Windows 7 while the laptop is Windows 8, but I don't think that is the issue. More likely I would guess is that the laptop is running a 32-bit version of LabView on a 64-bit OS while the computer is running a 64-bit version of LabView on a 64-bit OS. Sorry I can't offer any better info, but at least my problem is solved.

0 Kudos
Message 19 of 23
(1,741 Views)

@dugan wrote:

Ok, problem solved, but not in a satisfying way. I was trying to get the basic interface working on my laptop before transferring it over to the computer that will actually run the instrument, but when I tried running it off that computer, I don't run into the problem at all. The computer is running Windows 7 while the laptop is Windows 8, but I don't think that is the issue. More likely I would guess is that the laptop is running a 32-bit version of LabView on a 64-bit OS while the computer is running a 64-bit version of LabView on a 64-bit OS. Sorry I can't offer any better info, but at least my problem is solved.


I doubt that it the LabVIEW flavor has anything to do with it at all.  I think it's more likely due to the differences in the operating systems.  The recommended configuration is LV 32-bit on a 64-bit OS.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 20 of 23
(1,731 Views)