Program :
/*****************************************************
This program was produced by the
CodeWizardAVR V2.03.9 Standard
Automatic Program Generator
Copyright 1998-2008 Pavel Haiduc, HP InfoTech s.r.l.
http://www.hpinfotech.com
Project :
Version :
Date : 7/11/2012
Author : Tianur
Company : Politeknik Caltex Riau
Comments:
Chip type
: ATmega8535
Program type
: Application
AVR Core Clock frequency: 8.000000 MHz
Memory model
: Small
External RAM size
:0
Data Stack size
: 128
*****************************************************/
#include <mega8535.h>
#include <delay.h>
// Alphanumeric LCD Module functions
#asm
.equ __lcd_port=0x15 ;PORTC
#endasm
#include <lcd.h>
lcd_init(16);
while (1)
{
// Place your code here
if(step == 0)
{
key=keypad();
if(key < 10)
{
a1=b;
b1=a1*10;
a=key;
key=20;
b=b1+a;
sprintf(buff,"%d",a);
lcd_puts(buff);
x++;
if(x>=4)
{
step = 1; //untuk melanjutkan ke step 1
PORTA.0=0; //indikator tombol sudah ditekan 4x
}
delay_ms(200);
}
if(key == 14) //Tombol ON ==> reset
{
//reset semua data
step=0;
a=0;
b=0;
a1=0;
b1=0;
x=0;
lcd_clear();
lcd_gotoxy(0,0);
PORTA.0=1;
step = 0; //untuk kembali ke step awal
}
}
if(step == 1)
{
key=keypad();
if(key == 14) //Tombol ON ==> reset
{
//reset semua data
step=0;
a=0;
b=0;
a1=0;
b1=0;
x=0;
lcd_clear();
lcd_gotoxy(0,0);
PORTA.0=1;
step = 0; //untuk kembali ke step awal
}
};