Re: Serial Communication
- From: "David " <dave@xxxxxxxxxxxxxx>
- Date: Tue, 30 Sep 2008 15:59:04 +0000 (UTC)
"steve smith" <stevesmith0518@xxxxxxxxxxx> wrote in message <gbthc9$8kj$1@xxxxxxxxxxxxxxxxxx>...
I am attempting to communicate with a device via a 9pin through serial connection. The device is a syringe pumping apparatus. When configured according to the manufacturer's instructions through hyperterminal, the apparatus can understand ASCI string data such as 'RUN', 'REV', and 'STP'as well as general config data like inputting syringe diameter size and discharge rate.
When I try to operate the apparatus through MatLab, however, it fails to respond. I create a serial port using the s=serial('COM1') command and open the port in MAtLab. I configure the baudrate, # of stop bits, etc using MatLab. I then use the fwrite() command. I attempt to write the string fwrite(s,'RUN'); or fwrite(s,'REV') to the device with nothing occurring. (i.e., I am attempting to send the string 'RUN' or 'REV' to the device).
The device is also capable of transmitting its current status, i.e., if it is stopped or running. How do I accomplish this? Do I create a for loop in order for MatLab to continuously read information from the device and report its status?
when you commanded the devide through hyperterminal did it reply before you hit enter? if not then you probably have to add \n or \r or some combination of those to the end of your fwrite string. also, what precision are you specifying for fwrite? to send characters you should specify 'uchar' as the precision, otherwise i don't know what it might default to.
.
- References:
- Serial Communication
- From: steve smith
- Serial Communication
- Prev by Date: Re: convolution
- Next by Date: Re: Serial Communication
- Previous by thread: Serial Communication
- Next by thread: Re: Serial Communication
- Index(es):
Relevant Pages
|