SCI basic qustion -  MC9S08QG4,

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SCI basic qustion -  MC9S08QG4,

1,391 Views
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
Labels (1)
0 Kudos
3 Replies

375 Views
poppy2008
Contributor II
Thank you so much Mac,
0 Kudos

375 Views
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 Kudos

375 Views
poppy2008
Contributor II
Dear bigmac,peg help me
0 Kudos