Microcontroller › 8051 › Automatic Bidirectional Visitor Counter › The following are the
The following are the programs I use on a counter circuit (see the picture I attached to the previous post), this program is working normally and can save the result of a calculation to memory IC eeprom, after turn off the power supply circuit and restarted, the count value can are saved and can be updated with a few new ones. But there are several obstacles(problems) that count results can be stored into the eeprom IC at24c16 maximum value 256. after the value could not keep back …. and must be reset IC eeprom memory contents.
please give advice to me, which part should I change to be able to display and store the result of a calculation to the value of 999 999
I wait for suggestions from fellow forum
here the code,
/*
Bissmillahirrohmanirrokhiim…
rev.2 tes 26 oktober ‘2012
Program : Counting up with LCD + eeprom 24c16 + AT89S51
Tanggal : 25 September 2012 – 10 Oktober 2012
Author : Ibnu Budi R. ( kangibnu ) Laros-Edu
Country Org : Indonesia-Jatim
Compiler : Raisonance C Compiler 6.1.6
note : many variable with Bahasa Indonesia
: you can translate in english
*/
#include<reg51.h>
#include<intrins.h>
#define msec 50
#define lcd_data_str_pin P2
bit ack;
sbit rs = P3^6; //Register select (RS) pin
sbit rw = P3^5; //Read write(RW) pin
sbit en = P3^7; //Enable(EN) pin
sbit sda=P3^1; //sda
sbit scl=P3^0; //sck
sbit led=P0^3;
sbit led1=P0^1;
sbit sensor_1=P3^2; //sensor1
sbit sensor_2=P3^3; //sensor2
sbit motor=P1^7; //motor mekanik
int max = 0;
int carry = 0;
int arr[4];
//inisialissi varibel eeprom
unsigned char reead,write,write2,b,k;
unsigned int temp;
//
int hitung_amt[7],j;
unsigned int hitung_1,hitung_2;
void tunda(int waktu) // Time delay function
{
int s,k;
for(s=0;s<=waktu;s++)
for(k=0;k<=20;k++);
}
void delay(unsigned int count) // Function to provide time delay in msec.
{
int i,j;
for(i=0;i<count;i++)
for(j=0;j<500;j++);
}
void lcd_cmd(unsigned char cmd_addr) //Function to send command to LCD
{
lcd_data_str_pin = cmd_addr;
en = 1;
rs = 0;
rw = 0;
delay(1);
en = 0;
return;
}
void lcd_data_str(char str[50]) //Function to send string
{
int p;
for (p=0;str[p]!=’