On 07/03/2013 06:36 PM, Dennis Poon wrote:

Can you give me some pointer on directly using UART? I need to implement half-duplex using UART for rs-485 protocol.

In a Linux system, accessing the hardware by user code is strictly discouraged, at least whenever interrupts are involved (as with UARTs). A decent system should provide rs-485 support in the "TTY" driver, when the hardware allows for such.

If your system does not do so, you should find or do a device driver yourself.

In fact what do you mean by "rs-485 protocol" ?

With RS-485 hardware you can - and supposedly need to - do "half-duplex with output enable", if your hardware provides this.

The hardware might or might not provide automatic output enable (if not, you need to set and reset RTS in software).

The hardware might or might not provide echo cancellation (if not the software needs to actively ignore anything that the hardware echoes back when sending it).

If your hardware provides both auto output enable and echo cancellation, your software can happily ignore the "rs-485 protocol".

Usually both can be done in userland software even with standard TTY drivers that (usually do) setting and resetting support RTS, or (better) by dedicated support in the device driver.

-Michael
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to