ts-7000
[Top] [All Lists]

Re: [ts-7000] Re: TS-7260

To:
Subject: Re: [ts-7000] Re: TS-7260
From: "Don W. Carr" <>
Date: Mon, 21 Aug 2006 21:11:40 -0500
Or, you can use my code for opening the serial port, and set the timeout for the read to a reasonable value. Don.

On 8/21/06, asc135 <> wrote:

--- In ts-7000%40yahoogroups.com, "weide72" <> wrote:
>
> I am trying to communicate with a device that measures voltage,
> amps, etc. via COM2 on the TS-7260. The device needs a 4-byte array
> sent to it and responds with a 3-byte array containing the requested
> information. I am pretty sure that I have intialized all the
> settings for COM2 correctly. I guess I'm not sure what the correct
> way to send the 4-byte array is or if I need to do anything more to
> set up COM2 besides in code. Can anyone help? My code is as
> follows:
>

[snipped]


>
> fd = open("/dev/ttyAM1", O_RDWR | O_NOCTTY | O_NDELAY | O_NONBLOCK);

[snipped]


> n = write(fd,send,4);
>
> n = read(fd,buf,3);

At first glance I would think it is not getting a read because you
haven't finished transmitting the write data by the time you are
making the read call. You have the I/O set to non-blocking so this is
entirely possible.

Either remove O_NDELAY and O_NONBLOCK or insert a sleep(1); between
the write and the read call.

Amardeep




--
Dr. Don W. Carr
J. G. Montenegro 2258
Guadalajara, Mexico
+52-333-630-0704
+52-333-836-4500 ext 2930 __._,_.___


SPONSORED LINKS
Single board computer Hardware Computer running slow
Linux os Single board


YAHOO! GROUPS LINKS

  •  Visit your group "ts-7000" on the web.
     
  •  To unsubscribe from this group, send an email to:
     =Unsubscribe
     
  •  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



__,_._,___
<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU