Communicating with a device
3 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Walter Roberson
on 27 Nov 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 Comments
Walter Roberson
on 2 Dec 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.
More Answers (0)
See Also
Categories
Find more on Get Started with C2000 Microcontroller Blockset in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!