problem whit pause command
9 views (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Data Acquisition Toolbox Supported Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!