ts-7000
[Top] [All Lists]

[ts-7000] Re: TS-7260

To:
Subject: [ts-7000] Re: TS-7260
From: "asc135" <>
Date: Tue, 22 Aug 2006 02:06:05 -0000
--- In  "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






 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


<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