hi every one
can some one tell me the difference between setting the portB of ATMEGA32 as PORTB=0b11111110; and PORTB &=(1<<PB0) and PORTB &=0b11111110
best regards
PORTB =0b11111110;// assigning a value to PORTB unconditionally
PORTB &=0b11111110;// reading PORTB and MASKING OUT the LSB bit ONLY
PORTB = PORTB &0xFE;// same statement written differently
PORTB &=(1<<PB0);// isn't correct if it should be the same as the previous statement// it reads as PORTB = PORTB & 0x01 (1<<PB0) is (1<<0) or bit shift (0) positions(s)...
PORTB &= ~(1<<PB0);// if you want the same effect as the previous statement// so to set a bit
PORTB |=(1<<PB0);// to clear a bit
PORTB &= ~(1<<PB0);