You have no items in your shopping cart.

Subtotal:Rs.0.00
Matlab Tips and Tracks

Matlab Code to Receive Data from a Serial Port

matlab-code-to-receive-data-from-a-serial-port

 

Matlab Code to Receive Data from a Serial Port

% Instrreset Disconnect and delete all instrument objects.

instrreset;

%Construct serial port object.
CreateSerialPortObject = serial('COM1');

%Set Serial Port Settings
set(CreateSerialPortObject,'BaudRate',115200,'StopBits',1,'FlowControl','none','Parity','none',

'DataBits',8,'OutputBufferSize',50000);

%Create Buffer Size
CreateSerialPortObject.InputBufferSize=100;

%Time out, Wait till this time
CreateSerialPortObject.TimeOut=60;
CreateSerialPortObject.Terminator = '';

%Open Serial Port Object
fopen(CreateSerialPortObject);

%Read to  Serial Port Object
te = fread(CreateSerialPortObject,100);

%Close Serial Port Object
fclose(instrfind);

%Clear Instrument Objects
clear CreateSerialPortObject;
Tags : Matlab Code to Receive Data from a Serial Port
jeevarajan

The author jeevarajan