Problem:
Cannot communicate with the pump controller using MATLAB or hyper terminal.
Can communicate with the same pump through the software provided by the manufacturer.
The command format is using hex strings, for example, the following command line sets it running
e9 01 06 57 4a 00 e8 00 01 01 f2
the following is my matlab code
s1 = serial(‘COM1’, ‘BaudRate’, 1200,‘databits’,8,‘parity’,‘even’,‘stopbits’,1);
set(s1,‘outputbuffersize’,30000,‘timeout’,10)
set(s1,‘inputbuffersize’,30000,‘timeout’,10)
fopen(s1)
%str=‘E9 01 06 57 4A 00 E8 00 01 01 F2’
%str=‘e90106574a00e8000101f2’
%str=‘233 01 06 87 74 232 00 01 01 242’
%fwrite(s1,str,‘int8’)
fprintf(s1,‘%s’, str);
out1 = fscanf(s1)
tt=s1.Valuesreceived
get (s1)
fclose(s1)
delete(s1)
I have tried all formats %s, %d, %x,�… does not work
I look forward to receiving some help on this
thanks