This library allows the programmer to use the RS-232 communications of the ATmega328P (for instance, the one of the Arduino Duemilanove or UNO boards) directly.
Features:
- It works correctly only with ATmega328P @ 16MHz.
- The user can set the bauds (up to 2Mbauds), but the library forces asynchronous, no parity, 1 stop bit, 8 data bits.
- It uses ISR-guided processing for receptions and no ISRs for transmissions, particularly USART_RX_vect, that has higher priority than ADC_vect and lower than external interrupts or timers. The ISR will delay the latter when executing -the non-interruptible code in this library has been kept to a minimum, though-.
- Transmissions from the ATmega to the outside consist of commands of unlimited length ended in a given particular character.
- Receptions consist of commands of a given maximum length, also ended in a given ending character.
- Both transmissions and receptions are full-duplex. Receptions can be configured to receive and drop characters while using only transmissions (for instance, for tracing programs).
Installation and usage:
- Download the library sources.
- Include the .h in your program. In the sources there is an example demo of program. Compile your program, the .c file of the library, and link all of them together.
- In your program, first call
RS232_Init
; then enable interrupts and useRS232_Read
andRS232_Send
at will; finalize your use of the rs232 system withRS232_Finish
(it can be re-activated with a newRS232_Init
). - In Windows and Linux you can use putty, for example, in order to connect to the arduino and test this library.