From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial response format strings in IVI Instrument Driver Wizard

Timeout expires waiting for a reponse from operations that require me to enter an expected response or a format string for the response content (ie ID Query, Error Query, Revision Query).

 

The tests for which I don't enter an expected response string seem to work fine.. I'd like help figuring out the correct format strings for the others.


I tried using the VISA Test Panel for the serial device in Measurement & Automation Explorer (MAX). I found the apropriate termination character is \r (carriage return). I was able to communicate with the device smoothly while in MAX. For example, if I send *00id and click on "Query", the response is an expected ?00ID=90. If I click on "Write" and then on "Read", I get the same result.

 

Back in IVI Instrument Driver Wizard, clicking on "Run Tests..." before generating the driver produces the following:


Test Results
=====
Serial Port Configuration
     ...Passed
VISA Initialization
     Return Code : 0x0  (Operation completed successfully.)

Default Command
     Return Code : 0x0  (Operation completed successfully.)
     Bytes Sent : 12

ID Query
     Return Code : 0xBFFF0015  (Timeout expired before operation completed.)

Reset
     Return Code : 0x0  (Operation completed successfully.)
     Bytes Sent : 12

Error Query
     Return Code : 0xBFFF0015  (Timeout expired before operation completed.)

Revision Query
     Return Code : 0xBFFF0015  (Timeout expired before operation completed.)

=====

 

Right now the command-response pairs are set up like this

 

ID query
 *00id
Expected ID Query Response
 "?00ID-90"

 

Error query command
 *00rs
Format String
 %256[^\r]

 

Revision command
 *00v=
Format String
 \"%256[^\"]

 

Return code 0x0 is expected when there are no errors in the command.

 

Port settings in all evironments match, icluding read/write terminators.

 


Any help help figuring out the correct format strings is appreciated!

0 Kudos
Message 1 of 6
(2,905 Views)

Hello ObiCaban,

 

Exactly, which serial device are you attempting to communicate with and generate a CVI IVI driver for?  Do you have a link to its manual you could provide?

Regards,

Shawn S. | NIC
Instrument Driver/IVI PSE
National Instruments
0 Kudos
Message 2 of 6
(2,882 Views)

I can't provide a manual because the serial device is company hardware. Is there anything in particular you'd like me to check in the manual?

0 Kudos
Message 3 of 6
(2,876 Views)

Hello ObiCaban,

 

The manual should contain a list of the low level commands that the serial device will respond to as well as a format for each of the typical responses. I've attached a tutorial to guide you and explain this further once you've had a chance to review the manual.

Creating IVI Driver Files with the Instrument Driver Development Wizard

http://zone.ni.com/devzone/cda/tut/p/id/10098

Regards,

Shawn S. | NIC
Instrument Driver/IVI PSE
National Instruments
0 Kudos
Message 4 of 6
(2,862 Views)

Shawn,


I've been through the tutorial and have been able to create a driver for a GPIB device before. No problems with the wizard then. In this case I'm having problems with a serial driver.

 

After various attempts, I got the results summarized in my first post. I need help understanding the format strings and what/how they should be written to get correct responses. Using other interfaces I'm able to communicate with the device flawlessly.

 

All seems to work fine except the format strings of the expected responses within the wizard.

 

My most recent attempt to solve this is to "reverse engineer" the correct format string by looking at the output of the wizard after ignoring the erroneous Test Results.

 

 

Thanks for your time!

0 Kudos
Message 5 of 6
(2,849 Views)

Hello ObiCaban,

 

I just found that this is a known issue. Coorective Action Report (CAR) # 2CME63AW talks about this behavior.  Its work around is to ignore the VISA error and use the driver generated. However, make sure the information provided to the wizard is correct.

Regards,

Shawn S. | NIC
Instrument Driver/IVI PSE
National Instruments
0 Kudos
Message 6 of 6
(2,843 Views)