9S08AW16 SCI PROBLEM

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

9S08AW16 SCI PROBLEM

跳至解决方案
1,258 次查看
mingjunhua
Contributor I

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.

标签 (1)
标记 (2)
0 项奖励
回复
1 解答
991 次查看
rocco
Senior Contributor II

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.

在原帖中查看解决方案

0 项奖励
回复
2 回复数
992 次查看
rocco
Senior Contributor II

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.

0 项奖励
回复
991 次查看
mingjunhua
Contributor I

Hi Hotchkiss

Thanks for your help. I'm new in S08 MCUs.

The problem is solved by using your advice.

Thank you.

0 项奖励
回复