Hello everyone,
I am new for S08 8bit MCU. Now I am working with the MC9S08AW16.
I want to use SCI module to communcate with other MCUs.
I tried to send and receive the data, but failed.
NOW, I have some problems:
I follow the datasheet step: Read the RDRF bit in SCI1S1 register then write the SCI1D register, but the RDRF bit isn't clear.
SO, I want to ask for some advice or 'C' code to do a Software SCI
Thanks.
已解决! 转到解答。
Hi Mingjun,
Are you using 9 data-bits or parity? Have you tried reading the SCI Control Register 3?
I had that that same problem on the 9S08BG60 when I enabled parity. Parity used a ninth data-bit, and the SCI then required that I read the SCI Control Register 3, where the ninth bit is stored, before it would clear the receive flag. I didn't care about that bit, since the SCI handled parity, but I had to read it anyway. Here is some code:
lda SC1C3 ;read the 9th data but to help clear the interrupt
lda SC1DR ;and then get the real data byte
I found it doesn't matter which order you read the two registers, but the interrupt does not clear until you read the second one.
Hi Mingjun,
Are you using 9 data-bits or parity? Have you tried reading the SCI Control Register 3?
I had that that same problem on the 9S08BG60 when I enabled parity. Parity used a ninth data-bit, and the SCI then required that I read the SCI Control Register 3, where the ninth bit is stored, before it would clear the receive flag. I didn't care about that bit, since the SCI handled parity, but I had to read it anyway. Here is some code:
lda SC1C3 ;read the 9th data but to help clear the interrupt
lda SC1DR ;and then get the real data byte
I found it doesn't matter which order you read the two registers, but the interrupt does not clear until you read the second one.