Hello, and welcome to the forum.
The RS08KA2 may be a poor choice to implement a firmware SCI function, especially if you require full duplex operation (transmit while receiving data). With only a sigle 8-bit modulo timer available, I doubt that there will be sufficient timing resources.
The RS08KA8 would appear a better choice, with a 2-channel,16-bit TPM module present, in addition to the modulo timer.
Hi Module Timer,
I have been lucky in that I have avoided the RS08 parts, so I'm not sure if my suggestion below will apply. Mac is right in suggesting a more capable part. It is often worth the extra pennies for a more suitable part over the extra development time it takes to fill a five-pound bag with ten pounds.
I have implemented a software uart using one timer. You set the timer to tick at some multiple "N" of the desired baud rate, sample the incoming stream at every tick, and output the next bit on every Nth tick.
Set a state-counter to start counting sample-times (mod N) once you detect the start bit, and then sample the data on states within the bit.
As an example:
On my implementation, the timer was also my real-time clock for my scheduler. I used N=8, and sampled on 3, 4 and 5. So it counted continuously, and I masked the low three bits. When the low three bits were zero, I updated the transmitter. I kept a separate counter for the receiver, which I zeroed on the start-bit. I then had it count continuously, with the low three bits being the state-count, and the next higher four bits being the byte counter. I had to implement 11 bits (Start-bit, 8 data-bits, parity-bit, stop-bit).
Basically, I copied the algorithm that many hardware uarts use. I wish I could post the code, but it is proprietary to my client. Besides, it's all in assembler, and I assume you would prefer C.
Retrieving data ...