problem whit pause command

조회 수: 10 (최근 30일)
farjad
farjad 2016년 6월 20일
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.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Acquisition Toolbox Supported Hardware에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by