Communicating with a device
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello everybody!
I am completely new to this problem. I have a digital weighing scale(a load cell hooked to a digital monitor) and I would like for MatLab to recognize it and communicate. Load cell is connected to the digital monitor and the monitor to my laptop. The connection is RS232, but I have a converter to USB, since my laptop does not support RS232.
So if someone could just stir me in the right direction, because I have no idea where to begin.
I'm guessing Instrument Control Toolbox? I have all the necessary info on the scale and it's outputs.
Anyone?
0 comentarios
Respuesta aceptada
Walter Roberson
el 27 de Nov. de 2011
Please see my Answer to this question to see the general procedures for working with serial ports. That particular question is focused on communication with a robot, but the outline I gave there applies to your case.
You will not need the Instrument Control Toolbox.
You will need to have your digital scale connected up before your start your MATLAB session, and you will need to take in to account that the device name of a USB device is not constant. See instrfind() to retrieve the list of serial devices.
2 comentarios
Walter Roberson
el 2 de Dic. de 2011
fgetl() does not accept a format: it always returns a string.
You might want to change your output format to
fprintf(fid, '%s\n', data);
I do not know how your scale operates; it would be common for you to need to send a command to the scale to provoke it to send the current reading back.
Más respuestas (0)
Ver también
Categorías
Más información sobre Get Started with C2000 Microcontroller Blockset 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!