Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <avr/io.h>
- #include <avr/interrupt.h>
- #include <util/delay.h>
- volatile unsigned char data=0; //buffer secondaire
- ISR(USART_RX_vect)/**interuption pour le Rx**/
- {
- data=UDR;
- PORTA=~PORTA ;
- }
- int main(void)
- {
- DDRA = 0xFF ;
- DDRB = 0xFF ;
- SREG=0x80; //active interrup générales
- UCSRB=(1<<RXCIE)|(1<<RXEN);
- UBRRL=(unsigned char) 60; //vitesse max!
- UCSRC=(1<<URSEL)|(1<<UPM1)|(3<<UCSZ0); //parametres du bus 8/P/1
- PORTA=0x00 ;
- PORTB=0x00 ;
- while(1)
- {
- if (data==0x01)
- {
- PORTB=~PORTB;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement