Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 to USB won't connect to instrument

I need to communicate with a BK instrument Model 1823A which has a RS232 port. I’m using a RS232-to-USB converter based on the latest Prolific chip set. When using the software that comes with the 1823A it works fine for reading and writing data. But when I use VBA code to do this via NI Visa, I cannot read or write data. I have tried two different NI Visa drivers for the 1823A but no luck.

 

When using NI Max to debug, it sees the RS232-to-USB converter but not the instrument. NI Max acts like things are fine, except that reads commands fail. Write commands appear to work in NI Max but the 1823A does not respond so I believe that the 1823A never really receives write commands.

 

I use the same model RS232-to-USB converter for another instrument and it works fine with NI Visa when using VBA code. The only difference I can see is that 1823A doesn’t support IDN to identify itself. My questions are:

 

  • If the 1823A cannot identify itself when queried, how will NI Visa know what instrument it is dealing with so that NI Visa can make communication work?
  • Is there any way in NI Visa to force an association between the 1823A NI Visa driver and the port assignment so that NI Visa will know what instrument it is dealing with?
0 Kudos
Message 1 of 5
(4,414 Views)

VISA does not see the instrument.  All it sees is the serial port you told it to use.  From here, it sounds like you just are not sending the right commands.  Maybe you need to append a termination character of some kind, typically a Line Feed or a Carriage Return or even both.


GCentral
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 2 of 5
(4,399 Views)

Thanks. I tried different carriage returns in both NI Max and VBA code but no luck. The 1823A instrument manual says that 0D hex is the right carriage return which sometimes goes by \r. I tired the following in VBA with various carriage returns and syntax. I'm trying to send command F3, but the instrument does not react.

 

instrument.WriteString "F3" + Chr$(&HD)
instrument.WriteString "F3" & Chr$(&HD)
instrument.WriteString "F3" + Chr(&HD)
instrument.WriteString "F3" & Chr(&HD)
instrument.WriteString "F3" + Chr$(&HD)
instrument.WriteString "F3" & Chr$(&HD)
instrument.WriteString "F3" + "\r"
instrument.WriteString "F3" & "\r"

 

I noticed the following in the manual and I wonder if this might be relavent. But I don't specifically see this option in NI Max for setting the DTR and RTS pins.

 

  Pin2: RXD ( Receive Data )
  Pin3: TXD ( Transmit Data )
  Pin4: DTR ( Data Terminal Ready) DC power from PC (high 12V)
  Pin7: RTS ( Request to Send ) DC power from PC (low -12V)

  *Pins 4 (DTR) should be ENABLED and 7 (RTS) should be DISABLED.

0 Kudos
Message 3 of 5
(4,377 Views)
The wires are ok, otherwise the original software would not have worked.
greetings from the Netherlands
Message 4 of 5
(4,367 Views)

@Dan747 wrote:

  *Pins 4 (DTR) should be ENABLED and 7 (RTS) should be DISABLED.


That is likely your problem then.  If they should always be in that state, then I think you will have to assert the DTR line and unassert the RTS line as part of your setup.  There is a property node in LabVIEW to do this.  Not sure what the function is in VB.  There is a Flow Control Settings tab when in the VISA Test Panel for asserting or unasserting those lines.


GCentral
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 5 of 5
(4,357 Views)