Tuesday 1 March 2016

microcontroller - Bitwise operation for UART, AVR



I'm trying to work on UART for AVR. After setting the baud rate registers UBRRnX, I'm trying to configure the UCSRnA register. UCSR0A register.


I'm trying to set the 2nd bit, U2XO. Which is the right way to do it? UCSR0A = (1 << U2X0)


or


UCSR0A = UCSR0A | (1 << U2X0) (Notice the OR operator in the 2nd statement)




No comments:

Post a Comment

arduino - Can I use TI&#39;s cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...