Remote Operation: Why do I get a VISA timeout (BFFF0015) using RS-232 with a SourceMeter?
Product(s) :SourceMeter Instruments: 2400, 2410, 2420, 2425, 2430, 2440
Question : Why do I get a VISA timeout (BFFF0015) using RS-232 with a SourceMeter?
Answer: When programming a SourceMeter through the VISA layer into RS-232, the use of SCPI commands is required. However, there are additional subtle requirements when the communication bus is not a GPIB bus: you must add a termination character like a Line feed (LF) or a carriage return (CR). By default the SourceMeter ships with the RS-232 TERMINATOR set to <CR> i.e. carriage return, but it can be set to other values (LF, CR+LF, etc).
To accomplish this, there are two approaches that can be taken: explicitly append a terminator onto the end of each command you will send (viWrite), or set a global attribute of the VISA session to automatically append a terminator.
For an RS-232 based session, the VI_ATTR_ASRL_END_OUT attribute controls the method used to terminate write operations. This attribute is set to VI_ASRL_END_NONE by default. To have a terminating character automatically appended, you can change this behavior. Below is a typical command line for VB:status = viSetAttribute(sesn, VI_ATTR_ASRL_END_OUT, VI_ASRL_END_TERMCHAR)
This will cause a terminator, defined by the VI_ATTR_TERMCHAR attribute, to automatically be appended onto the end of each string written with the viWrite command. The default value of VI_ATTR_TERMCHAR is a Line Feed (hex value 0A). This default value can be changed to carriage return or what ever the instrument is configured, via front panel setups, to use.
Similar programmatic control of these session attributes can be asserted from any programming language; for example, use a property node in LabVIEW to set individual attributes of an open VISA session.
While on the topic of setting attributes, setting the VI_ATTR_TERMCHAR_EN from it's default value of false to a true will allow read operations to terminate as soon as the VI_ATTR_TERMCHAR is received during a viRead. Otherwise, the viRead function will not return until the specified timeout period (VI_ATTR_TMO_VALUE) expires. In that case, you'll get an error message like below and your program will execute slowly.
-10738077339 which is Hex 0xBFFF0015 Timeout expired before operation completed."
For applications using IVI or VXI/PnP drivers, you do not need to add any terminator unless you are using the low level KE24xx Write Instrument Data function to send SCPI commands. With the KE24xx Write Instrument Data function you must add a terminator when the underlying communication bus is not GPIB (which asserts an EOI to terminate reads/writes).
Cette FAQ concerne :
Série du produit : SMU série 2400
Numéro de la FAQ 72011Afficher toutes les FAQ »