The megaAVRs contain one or more usarts capable of synchronous and asyncronous serial communication. avrforth operates the usarts in asynchronous mode by default. Devices with two usarts have two sets of words differing only in the last character. Devices with more than two usarts should be supportable without much effort, but I don't have any devices to test with.
In the table below, % represents the usart number to be used. For devices with only one usart, use a 0.
word | stack | description |
---|---|---|
usart% | ( -- ) | enable usart |
/usart% | ( -- ) | disable usart |
baud% | ( u -- ) | set baud divisor |
rx% | ( -- c ) | fetch character from usart |
tx% | ( c -- ) | send character to usart |