Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<avr/io.h>
- int main(void){
- TCCR0 |= (1<<CS02) | (1<<CS00);// ustawienie preskalera na 1024
- //TCCR0 |= ~(1<<CS01);
- DDRA = 0xFF;
- while (1){
- PORTA = 0x00;
- opuzn(200);
- PORTA = 0xFF;
- opuzn(200);
- }
- }
- int opuzn(int czas){
- while(1){
- if(TIFR & (1<<TOV0)){
- TIFR |= (1<<TOV0);
- TCNT0 = 255 - czas;
- return 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement