Borrar filtros
Borrar filtros

MODBUS communication for the controlling of peristaltic pump,

10 visualizaciones (últimos 30 días)
Hi,
I am working on the MODBUS communication to control my peristaltic pump. I am using the following code:
peri_pump = serial('COM7');
set(peri_pump,'BaudRate',9600,'DataBits',8,'StopBits',1,'Parity','Even','Timeout',10);
fopen(peri_pump);
% start the pump
request = uint8(hex2dec(['01'; '06'; '03'; 'F0'; '00'; '01'; '48'; '7D']));
fwrite(peri_pump, request);
% stop the pump
request = uint8(hex2dec(['01'; '06'; '03'; 'F0'; '00'; '00'; '89'; 'BD']));
fwrite(peri_pump, request);
% set the flow rate 50 ml/min
request = hex2dec(['01'; '10'; '03'; 'EC'; '00'; '02'; '04'; '42'; '48'; '00'; '00'; '7D'; '2C']);
fwrite(peri_pump, request);
fclose(peri_pump)
'start' and 'stop' commands are working, however 'set the flow rate' is not working (nothing happens). In the manufacturer's instruction (link; page 5), 'start/stop' uses 'unsigned short int format' and 'set the flow rate' uses 'float format'. Anyone knows how to make 'set the flow rate' work? Any input would be appreciated.
Thanks!
Kang

Respuesta aceptada

Gustavo Dacanal
Gustavo Dacanal el 3 de Jun. de 2019
Dear Kang,
I will reccomend you try to send the hex command using "SimpleModbus software" and verify if your pump is regulating and working well.
If you get a satisfatory pump command with SimpleModbus but your matlab code still not working, then, you could try to insert the matlab commands fread and/or fclose after an input fwrite. *you will need to open the COM port every time you close it.
Tell me if you get any progress.
Regards
Gustavo
  1 comentario
Kang Soo Lee
Kang Soo Lee el 6 de Feb. de 2021
Sorry for being late! I decided to use only "on" and "off" functions, as I did not need to frequently change the flow rate. But, your reply inspired my curiosity. I will check and see if your suggestion works. When I have an update, I will write again in this post for future users.
Thank you!
Best regards,
Kang

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by