본문 바로가기
Programming/Matlab, Octave, Scilab

[Matlab] Serial Port Control

by 도파공 2010. 5. 1.
728x90
반응형

Matlab에서 Serial Port를 제어하는 예 이다.

 

%=======================================================================

CM1=serial('COM1','BaudRate',38400,'DataBits',8,'Parity','none','StopBits',1,\

        'FlowControl','none','Terminator','CR');

% Commect to instrument object, COM
fopen(CM1);

% Communicating with instrument object, COM.
data=fread(CM1,100);



% Disconnect from instrument object, COM.
fclose(CM1);



% Clean up all objects.
delete(CM1);

clear(CM1);

%=======================================================================

 

728x90
반응형

댓글