Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<avr/io.h>
- int main(void){
- DDRB = 0xFF;
- PORTB = 0xFF;
- TCCR0 |= ((1<<WGM01) | (1<<WGM00));
- TCCR0 |= ((1<<COM01) | (1<<COM00));
- TCCR0 |= (1<<CS00);
- int licz = 0;
- while (1){
- for(licz = 0; licz < 255; licz++){
- OCR0 = licz;
- for (int i = 0; i< 100; i++)__asm__ ( "nop;");
- }
- for(licz = 255; licz > 0; licz--){
- //_delay_ms(5);
- for (int i = 0; i< 100; i++)__asm__ ( "nop;");
- }
- }
- }
- /*
- 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