Is it possible to set the EOSCharCode property of a GPIB object created using Instrument Control Toolbox to CR/LF (i.e. carriage return and linefeed)?

4 views (last 30 days)
I have an instrument that I am trying to communicate with over GPIB. The instrument's documentation says that every reply from the instrument ends with a CR/LF (i.e. carriage return and linefeed).
The 'Terminator' property of a serial object can be set to CR/LF. However, this property is not available for the GPIB objects. How to I declare the EOSCharCode property for a GPIB object to CR/LF?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 29 Jul 2009
With the GPIB object, it is not possible to have a multi-character terminating character - EOSCharCode property value. The driver for GPIB only allows for one terminating character.
One suggested workaround is to set the EOSCharCode property to just the carriage return. After receiving the carriage return, you can read the next character:
fread(obj, 1);
and determine if it is a linefeed.
If it is, then you know that the command value is terminated. This will happen the majority of the time.
If it is not, then you will have to continue reading and will have to concatenate the data that was just read with the data that was about to be read. This could easily be made into a function.

More Answers (0)

Categories

Find more on Instrument Control Toolbox Supported Hardware in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!