Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

Handling serial data transfers

1 view (last 30 days)
Glenn
Glenn on 13 Jun 2013
Closed: MATLAB Answer Bot on 20 Aug 2021
I have Matlab reading serial data for a device by using callbacks. This is important as it allows the user interface to remain responsive while updating the display with information from the serial data stream. However, there are times when I need to transfer large amounts of data from the device. The only way to handle this is to run in a tight loop for good performance. The problem is that there seems to be no way to turn off the callback feature so that I can just read in a loop. If I leave the callback enabled Matlab seems to cache all of the callbacks that aren't serviced while in the loop and eventually crashes. I start the session like this:
comport = ['COM' get(handles.edit1,'String')];
handles.s = serial(comport,'BaudRate',115200,'DataBits',8,'Timeout',5);
handles.s.BytesAvailableFcnCount = 1;
handles.s.BytesAvailableFcnMode = 'byte';
handles.s.BytesAvailableFcn = {@serialCallback,handles,hObject};
When the device goes into transfer mode I need to disable the callback. How do I do this?

Answers (0)

This question is closed.

Community Treasure Hunt

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

Start Hunting!