Guest User

Untitled

a guest
Jul 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #include "usart.h"
  2. void USART_ini (unsigned int speed)
  3. {
  4. UBRRH=(unsigned char) (speed>>8);
  5. UBRRL=(unsigned char) speed;
  6. UCSRB=(1<<RXEN)|(1<<TXEN);
  7. UCSRB|=(1<<RXCIE);
  8. UCSRA|=(1<<U2X);
  9. UCSRC=(1<<URSEL)|(1<<USBS)|(1<<UCSZ1)|(1<<UCSZ0);
  10. }
  11.  
  12. void USART_Transmit (unsigned char dat)
  13. {
  14. while(!(UCSRA&(1<<UDRE))) ;
  15. UDR=dat;
  16. }
Add Comment
Please, Sign In to add comment