| ??? 09/03/03 07:55 Read: times |
#53956 - OT: Compiler observation Responding to: ???'s previous message |
mahmood Elnasser wrote:
------------------------------- TH2 = RCAP2H = rate >> 8; TL2 = RCAP2L = rate; Regarding line #2 of Mahmood's example and generalizing it a bit, I have seen one compiler implement the statement: HW_REG1 = HW_REG2 = value; as: HW_REG2 = value;
HW_REG1 = HW_REG2;
and another compiler implement the same statement as: HW_REG2 = value;
HW_REG1 = value;
A problem arises in the first case if HW_REG2 is a write-only register. Just something to be aware of... Not that any of you would write code like that, of course ;-) When dealing with hardware registers, explicitness is your friend. |



