Thread Subject: OutputEmptyFcn

Subject: OutputEmptyFcn

From: Igor

Date: 28 Nov, 2009 21:42:04

Message: 1 of 1

I've recently tried to communicate with my COM device, and ran into difficulties with asynchronous write, my OutputEmptyFcn callback isn't working...
Then I tried to create following test.m :
-----------------------------------------------------------------
s = serial('COM5')

fopen(s)

s.BytesAvailableFcnMode = 'terminator';
s.BytesAvailableFcn = @instrcallback;
s.OutputEmptyFcn = @instrcallback;
fprintf(s,'RS232?','async')
pause(10)
fclose(s)
delete(s)
clear s
-----------------------------------------------------------------
based on http://www.mathworks.com/access/helpdesk/help/toolbox/instrument/f20-73779.html

by that tutorial, this must return

OutputEmpty event occurred at 17:37:21 for the object:
Serial-COM1.
...

but my code does not.
-Yet, 'BytesAvailableFcn' works ok...
-synchronous write works OK; data sent with asynchronous reaches device- only callback is not working
-this does not depend on com port
-this seems to be really asynchronous, due to if I double "fprintf(s,'RS232?','async')" string matlab returns:
??? Error using ==> serial.fprintf at 144
An asynchronous write is already in progress.

Any ideas?

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
com Igor 28 Nov, 2009 16:44:04
outputemptyfcn Igor 28 Nov, 2009 16:44:04
rssFeed for this Thread

Contact us at files@mathworks.com