Most references talk about the registers,
'cause that's all there is.
but not how poll/monitor or control flow...code
Polling is done by reading the status register.
To see if data has been received, one reads the status register (Offset 0) and checks bit 0:
- If set, a character has been received, which can now be read from the data register (Offset 0).
To see i data can be send, again the status register is to be read, just this time bit 1 tells the story:
- If set, the resister is empty, and a character can written into (to be send).
Or, as pseudo C like code:
while(1)
{
char status = read_status_port;
if(status & 1)
read_byte_from_ACIA();
if(status & 2)
write_byte_to_ACIA();
}
Yes, it's that simple. Of course I can't tell how to handle your buffers, detect transmission end or alike. this is just the serial handling. Everythign else depends on your application structure and goal ... as usual.
And yes, one could get into background operation with interrupts and alike to operate in parallel with some program and so on, but i guess that is out of scope here.