Question
>> or & operators
Posted on May 09, 2017 at 22:28
hi
this code which i use >> (shift operator) to detect flag work correctly
void putchar( char *string)
{ while(*string) { while(usart_sr >> 6 == RESET); while(usart_sr >> 7 == RESET); USART_SendData(USART2,*string); *string++; }}but when i change it from & and some value of hex, the does not work correctly
void putchar( char *string)
{ while(*string) { while(usart_sr & 0x80 == RESET); while(usart_sr & 0x40 == RESET); USART_SendData(USART2,*string); *string++; }}is there someone to explain why?
thanks
#flagselect ##operators