AVR/Atmega128 강좌
Atmega128 기초 - 시리얼 통신( USART )
1. Baud rate (in bits per second, bps)와 시스템 클록을 정의한다. #define 9600 #define F_CPU 16000000UL 2. 시스템 클록과 원하는 baud rate를 이용하여 USART Baud Rate Register(UBRR)을 계산한다.BAUD Baud rate (in bits per second, bps)fOSC System Oscillator clock frequencyUBRR Contents of the UBRRH and UBRRL Registers, (0 - 4095) UBRR_VALUE = (((F_CPU / (9600 * 16UL))) - 1); 3. UBRR0은 12비트 레지스터이기 때문에 나누어서 넣어야 한다. UBRR0H = (uint8_..
2016. 6. 25. 05:06