[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 2-wire rs-485 problem

On Tue, 2002-04-09 at 00:47, Halvar Helgöy wrote:
> Hello
> We are two students working with a project where we use the Etrax LX to communicate with a 2-wire rs485  bus.We have tried to do the RX/TX switching by using software but without success. If there is anyone having tips or code examples on how to do this we would be very grateful.
>  brdgs
>    /Halvar

This is what I used before:

For writing out of the port, you have to ggle RTS before and after

int flag = TIOCM_RTS;

ioctl(fd, TIOCMBIC, &flag);

count = write(fd,buf,len);

ioctl(fd, TIOCMBIS, &flag);

For reading, you just call read().