Hi there,
My code is as follws:
for The LED will flash when MSB of TMR0 is update to '1'.
if (TMR0 & 1<<7)
LATAbits.LATA0 = 1;
else
LATAbits.LATA0= 0;
And i have seen this can be written as below and will have same effect.
LATAbits.LATA0 = (TMR0 & 1<<7) != 0; // FLASH = TMR0<7>
Because, when when MSB of TMR0 is '1', the '1'&'1' is '1' and '1!' is '0', so statement is TRUE
Can I write above as below, in place of above and will have it same effect as above has,
//LATAbits.LATA0 = (TMR0 & 1<<7) = 1; // FLASH = TMR0<7>
because when MSB of TMR0 is '1', the '1'&'1' is '1' and statement is TRUE.
Please clear my doubt
tnx for your reply in advance..
hi,
with the above details and compiler xc8.:
LATAbits.LATA0 = (TMR0 & 1<<7) != 0; // FLASH = TMR0<7>
It is same fudamentally as well as logically in its operation too??
and Can I write in place of above and will have it same effect as above has,
LATAbits.LATA0 = (TMR0 & 1<<7) = 1; // FLASH = TMR0<7>
pl clear my doubt??
Jayant
PermalinkHi are you usig the LPC? Which MCU are you using and what program IDE is this?
- Log in or register to post comments
Joined May 19, 2015 213Tuesday at 03:45 PM