Sending <ESC> T over Serial port to Scale
14 次查看(过去 30 天)
显示 更早的评论
Hello dear community,
I have a scale from the company Sartorius. My task is to send commands to the scale, to get the weigth back or to tare the scale.
In the scale-menu I can choose between different modes: "SBI" (Standard-Sartorius Protocol), "SCIS" (another Sartorius Protocol) and "Secondscreen(SBI)" (the scale is sending the weigth continiously).
Over Putty I succesfully connected to the scale in running mode "Seconscreen(SBI)". So I could read the weigth but couldn't give commands. I also can recieve the weigth in Matlab via fscanf(s).
But I want to communicate with the scale, so there are in the manual the commands for the SBI protocol and there are commands for the SCIS protocol.
I tried both of them but without success. In the SBI-protocol f.e. if I want to tare the scale the command is "<ESC> T" (see link below on Page 154&155).
Manual - SBI commands (page 154 and 155)
I tried to send the ASCII "ESC" and the T with the following code:
s = serial('COM4');
s.Baudrate=9600;
s.DataBits=8;
s.StopBits=1;
s.Parity='none';
s.Terminator='CR/LF';
fopen(s);
pause(0.1);
%fprintf(s,'%X','1B');
%fprintf(s,'%s','T');
%fprintf(s,char(27)+'T');
fprintf(s,'%X','1B 54');
fclose(s);
Can somebody help me communicate with my scale in SBI or in SCIS?
Or can somebody atleast give me the correct code for sending "<ESC> T" to the scale?
Thanks,
Rob
0 个评论
采纳的回答
Walter Roberson
2019-3-15
fprintf(s, '%cT', 27)
you might also need to send a terminator
2 个评论
Walter Roberson
2019-3-16
Set the serial Terminator property to 'CR/LF' and
fprintf(s, '%c %\n', 27);
The \n will automatically be converted to CR LF
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!