Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdlib.h"
- #include "avr/io.h"
- #include "util/delay.h"
- void serial();
- static int rpos=0;
- int main()
- {
- DDRA &= ~(0b00000101); // for the USI input clk nd di
- DDRA |= 0b00000010;
- while(1)
- {
- serial();
- }
- return 0;
- }
- void serial()
- {
- USICR = 0b00011000;
- USIPP = 0x01;
- USIDR = 0b10101010;
- //wait for 16 edges and counter overflow flag to be set
- while(!(USISR & (1<<USIOIF)));
- rpos=USIBR;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement