SCI basic qustion -  MC9S08QG4,

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

SCI basic qustion -  MC9S08QG4,

2,084 次查看
poppy2008
Contributor II

Dear all ,

I am new to embedded world and C,I am working with MC9S08QG4, I have one basic question in SCI

what is the diff bet  SCIS1 = 0xC0;  and

                            SCIS1|= 0xC0;

Thanks in advance.

 

 

 

 

Added p/n to subject.

Message Edited by NLFSJ on 2009-03-31 04:24 PM
标签 (1)
0 项奖励
回复
3 回复数

1,068 次查看
poppy2008
Contributor II
Thank you so much Mac,
0 项奖励
回复

1,068 次查看
bigmac
Specialist III

Hello,

 

SCIS1 = 0xC0; means to directly write the SCIS1 register with the value 0xC0.

 

SCIS1 |= 0xC0; is equivalent to the statement -

SCIS1 = SCIS1 | 0xC0;

 

This means to read the SCIS1 register, then logical OR the value with 0xC0, and then write the result back to the SCIS1 register. Therefore, the bits that are set within the mask value (0xC0) will also become set within SCIS1, but all other bits of SCIS1 will remain unchanged. This is known as a "read-modify-write" process.

 

This operation would be true if SCIS1 were a standard read-write register.  However, it so happens that this particular register is a special hardware register that is read-only. So write or read-modify-write operations are quite meaninless in this case - the status bits will remain unchanged until a hardware event occurs that sets a particular flag, or the special flag clearing procedures are implemented that do not involve writing to the register.

 

Regards,

Mac

 

Message Edited by bigmac on 2009-03-30 06:18 PM
0 项奖励
回复

1,068 次查看
poppy2008
Contributor II
Dear bigmac,peg help me
0 项奖励
回复