Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Handling serial data transfers

1 vue (au cours des 30 derniers jours)
Glenn
Glenn le 13 Juin 2013
Clôturé : MATLAB Answer Bot le 20 Août 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?

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by