Stop Watch dengan ATmega8535

Kabar apik sedulur kabeh ? Wektu iki awake dewe arep gawe aplikasi mikrokontroler ( boso jowone mikrokontroler opo to ? ) yoiku gawe ‘Jam Mandeg’ utowo Stop Watch. Alat – alat sik dibutuhke muk sederhana kok. Mikrokontroler jenis ATmega8535 utowo liyane yo keno, koyo ATmega16. Trus 7 segment cacahe 4. Trus tombol cacahe 2. Oya karo transistor BC557 jumlah 4, terakhir resistor 330 Ohm sik okehe 11.
Nek uwis trus disambung nganti dadi koyo iki :

Rangkaian Stop Watch AVR

Apik to gambare ?
Saiki trus gawe rencana utowo sik disebut program. Nganggo CVAVR nek didawake CodeVisionAVR.

99 proyek arduino

#include
#include
//——-deklarasi variabel
unsigned int Jarak,k,l,T;
unsigned int rib,rat,pul,sat;
char angka[10]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90};

#define start PINC.0
#define stop PINC.1
// Timer1 overflow interrupt service routine
interrupt [TIM1_OVF] void timer1_ovf_isr(void)
{
  TCCR1B=0;
  T++;
  if(T==10000){
        T=0;}
  rib=T/1000;      
  rat=T%1000/100;
  pul=T%1000%100/10;
  sat=T%1000%100%10;      
  TCNT1=40535;
  TCCR1B=0b0000011;
}

void display()
{
  PORTB=angka[rib];   
  PORTD=0B11111110;
  delay_ms(3);
 
  PORTB=angka[rat];   
  PORTD=0B11111101;
  delay_ms(3);

  PORTB=angka[pul];
  PORTD=0B11111011;
  delay_ms(3);

  PORTB=angka[sat];
  PORTD=0B11110111;
  delay_ms(3);  
}

//=======================
void main(){
  DDRC.0=0;
  DDRC.1=0;
  PORTC.0=1;
  PORTC.1=1;
  DDRB=255;
  DDRD=255;
 
TCCR1A=(0<
//TCCR1B=(0<
// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=(0<
// Global enable interrupts
#asm(“sei”)
//——-
// F1=250 Khz –> T1=1/250 Khz = 4 us
// 100 ms=100.000 us.
//utk T=4us maka butuh pulsa=100.000/4=25000
//sehingga isi ulang T1=25000
//65535-25000=40535
  while(1){   
    //for(l=0;l<100;l++)   
    display();
    if(start==0){
        TCCR1B=0B0000011;
        TCNT1=40535;
        }
    else if(stop==0){
        TCCR1B=0;
        }
  }
}  

Banner MM AVRWis to…., nek uwis trus di kompel, trus donloten nung mikrokontroler sik digawe mau.
Pencet tombol Start, nah Stop watch mlaku. nek arep mendeg penceten tombol Stop. Lha nek arep digawe ‘0000’ pencet wae tombol reset.

Stop Watch AVR

Kuwi hasile bro. Aku le praktek nganggo hardwere Master Mikro AVR V2, yoiku paket sinau mikrokontroler tanpo kursus. Lengkap hardware karo software. Lan sik jelas enek pideo tutoriale. Penasaran ? Cek wae nung link mau. Wis yo…

Aplikasi Mikrokontroler

This entry was posted in Mikrokontroler AVR and tagged , , , , , , , , . Bookmark the permalink.

Leave a Reply