problem whit pause command

10 vues (au cours des 30 derniers jours)
farjad
farjad le 20 Juin 2016
hi I need control relay using microcontroller. mirocontroller accept to byte. first pin_number and second pin_value. this is the matlab code
% % the micro controller just take the Pin_Number and Pin_value, and assign Pin_value to Pin_Number
Active=1;
Deactive=0;
S=serial(COM3);
fopen(S);
%%%%%%%
if (hObject,'value') ; %%if user prees start(command) botton;
PinNumber=get(handles.popup_PinNumber,'value'); %%get PinNumber from an popupmenu in GUI {8 9 or 10}
Active_TIME=get(handles.popup_Active_TIME,'value'); %%get Active_TIME the time from an popupmenu in GUI { 10 20 30 40 50 }
%%command to microcontroller to active pin
fwrite(S,pin);
fwrite(S,Active); %%0=Pin_
%%waite for Active_TIME
pause(Active_TIME);
%%command to microcontroller to deactive pin
fwrite(S,pin);
fwrite(S,Deactive)
end
the main code is a GUI and i supress that hear to essentially parts. my problem is that i can't control 2 pin in a same time. in otherwords, the program stop until the Active_TIME become end. I know that the PAUSE() command cause this problem but i have not any replacement solution. any idea can be very helpful. tnx.

Réponses (0)

Catégories

En savoir plus sur Data Acquisition Toolbox Supported Hardware dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by