Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * main.c
- *
- * Created on: 12 lut 2016
- * Author: Pawel
- */
- #include <avr/io.h>
- #include <util/delay.h>
- void USART_Transmit(char data);
- void USART_Init(uint16_t baud);
- #define FOSC 8000000
- #define BAUD 9600
- #define MYUBBR FOSC/16/BAUD-1
- int main(void)
- {
- USART_Init(MYUBBR);
- while(1)
- {
- USART_Transmit('B');
- _delay_ms(1000);
- }
- }
- void USART_Transmit(char data)
- {
- while(!(UCSRA & (1<<UDRE)));
- UDR = data;
- }
- void USART_Init(uint16_t baud){
- UBRRH = (uint8_t)(baud>>8);
- UBRRL = (uint8_t)baud;
- UCSRB = (1<<RXEN) | (1<<TXEN);
- UCSRC = (1<<URSEL) | (3<<UCSZ0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement