Data Logging for Electronic Balance Shimadzu UX4200H
조회 수: 2 (최근 30일)
이전 댓글 표시
Here is my simple code applied to Data Logging (RS232 port) of an Electronic Balance (model UX4200H, Shimadzu). I would be pleased for any comments. best wishes, Gustavo
instrreset;
clear all;
close all;
clc;
% remove any remaining serial objects to prevent serial issues
disp('BEGIN PROGRAM');
% Initialize Serial Port Object [s]
s = serial('COM4');
% Specify connection parameters
set(s,'BaudRate',300,'DataBits',8,'StopBits',1,'Parity','None','Timeout',0.1);
% Open serial connection
fopen(s);
% Specify Terminator
s.terminator = 'CR/LF';
% Set read mode
set(s,'readasyncmode','continuous');
% Check Open serial connection
s.Status
% Send command PRINT to eletronic balance UX4200H
fprintf(s,'PRINT')
% Read the output
r = fgets(s)
% Convert CHAR/string to array number
r = str2num(r(1:9));
xlswrite('results', r)
% Disconnect and close serial port
fclose(s);
delete(s);
clear s
disp('STOP')
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Low-Level File I/O에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!