matlab instrcallback,Display event information when event occurs

instrcallback

Display event information when event occurs

Syntax

instrcallback(obj, event)

Arguments

objAn instrument object.

eventThe event that caused the callback to

execute.

Description

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.

Note

Using this callback for numbers greater than 127 with a terminator is not

supported.

Examples

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

Tips

You should use instrcallback as a template from which you

create callback functions that suit your specific application needs.

Note

Using this callback for numbers greater than 127 with a terminator is not

supported.

Introduced before R2006a

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值