| Contents | Index |
instrcallback(obj, event)
obj | An instrument object. |
event | The event that caused the callback to execute. |
instrcallback(obj, event) displays a message that contains the event type, the time the event occurred, and the name of the instrument object that caused the event to occur.
For error events, the error message is also displayed. For pin status events, the pin that changed value and its value are also displayed. For trigger events, the trigger line is also displayed. For datagram received events, the number of bytes received and the datagram address and port are also displayed.
You should use instrcallback as a template from which you create callback functions that suit your specific application needs.
The following example creates the serial port objects s on a Windows machine, and configures s to execute instrcallback when an output-empty event occurs. The event occurs after the *IDN? command is written to the instrument.
s = serial('COM1');
set(s,'OutputEmptyFcn',@instrcallback)
fopen(s)
fprintf(s,'*IDN?','async')The resulting display from instrcallback is shown below.
OutputEmpty event occurred at 08:37:49 for the object: Serial-COM1
Read the identification information from the input buffer and end the serial port session.
idn = fscanf(s); fclose(s) delete(s) clear s

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |