On 7 September 2013 06:45, Antony Pavlov <antonynpav...@gmail.com> wrote: > But Canon A1100 firmware can use this routine: > 1. wait TX_RDY bit in status register; > 2. write TX_RDY and some other (unknown behaviour) bit to status register; > 3. write byte to TX register. > > IMHO the step 2 is bizarre.
Maybe the TX_RDY bit is write-1-to-clear? Some devices use that kind of thing for a "conditions that happened that could trigger an interrupt" (and if you're using them for polling you can just poll the register). > IMHO the more standart UART outc() routune is: > * wait for UART "transmitter is ready to send next char" flag; > * write char to TX register. Yes, you're right. In either case you can see if there's a uart via: * wait for TX_RDY to be set * clear TX_RDY * write byte to TX * immediately look at TX_RDY -- if it's set straight away there's almost certainly a FIFO involved; otherwise it would have to wait for the char to go out over serial before setting it again This is kind of a sidetrack though, we can model it without a UART for the moment. -- PMM