Kode tako digital

ult: rpm=0;
}

angka1 = rpm%10;

if(rpm>9) angka2 = ((rpm%100) - (rpm%10)) /10 ;
else angka2=10;

if(rpm>99) angka3 = ((rpm%1000) - (rpm%100)) /100 ;
else angka3=10;

if(rpm>999) angka4 = ((rpm%10000) - (rpm%1000)) /1000 ;
else angka4=10;

number=0;
}

ISR(TIMER0_COMPA_vect) // timer pindah kolom
{
segstep++;
switch(segstep) {
case 1 :{ conv_segmen(10);
PORTD |= _BV(PD0);
PORTD &= ~_BV(PD1) & ~_BV(PD4) & ~_BV(PD5) ;
conv_segmen(angka1);
break;
}

case 2 :{ conv_segmen(10);
PORTD |= _BV(PD1);
PORTD &= ~_BV(PD0) & ~_BV(PD4) & ~_BV(PD5) ;
conv_segmen(angka2);
break;
}
case 3 :{ conv_segmen(10);
PORTD |= _BV(PD4);
PORTD &= ~_BV(PD1) & ~_BV(PD0) & ~_BV(PD5) ;
conv_segmen(angka3);
break;
}
case 4 :{ conv_segmen(10);
PORTD |= _BV(PD5);
PORTD &= ~_BV(PD1) & ~_BV(PD4) & ~_BV(PD0) ;
conv_segmen(angka4);
segstep=0;
break;
}
}
}

SIGNAL (SIG_INT0)
{
number++;

}

void tombol(void)
{

cli();
conv_segmen(10);

kalibrasi++;

if (kalibrasi == 6) kalibrasi=1;

eeprom_write_byte((uint8_t*)10, kalibrasi);

_delay_ms(200);
              sei();
}

void baca_eeprom(void)
{

kalibrasi = eeprom_read_byte((uint8_t*)10);

if(kalibrasi == 0xFF) kalibrasi=3;

}

int main(void)
{

GIMSK |= (1<<INT0);
MCUCR |= (1<<ISC01)| (1<<ISC11); //fall edge

DDRD |= _BV(PD0) | _BV(PD1) | _BV(PD4) | _BV(PD5) ; // seg select
                    DDRD &= ~_BV(PD3) ; // tombol
DDRB |= _BV(PB0) | _BV(PB1) | _BV(PB2) | _BV(PB3) | _BV(PB4) | _BV(PB5) | _BV(PB6) ; // seg a,b,c,d,e,f,g

init_ctr();
init_ctr1();
baca_eeprom();
sei();
while(1)

{
                    if(bit_is_clear(PIND, PD3) )
              {tombol;
                      } 
}
}

0 Response to " Kode tako digital "

Welcome In Kode Blogger

Contoh Sliding Login Dengan JQuery

Disamping ini adalah contoh Sliding Login menggunakan JQuery. Login Form Disamping hanya Contoh dan tidak dapat digunakan layaknya Login Form FB, Karena Blog ini terbuka untuk umum tanpa perlu mendaftar menjadi Member

Tutorial Blog

Untuk membuatnya Silahkan : Klik Disini

Member Login

Lost your password?

Not a member yet? Sign Up!