Actually I am new to all these softwares..
I dont have idea about proteus 7.10....
I am using C compiler...
sorry if i am confusing you but i am really confused about that program
- - - Updated - - -
#include<stdio.h>
#include <reg51.h>
#include<string.h>
#define col P3 //keypad connected to P3
sbit sda=P1^1;
sbit sclk=P1^0;
sbit col0 = P3^0 ; //column 1
sbit col1 = P3^1 ; //column 2
sbit col2 = P3^2 ; //column 3
sbit col3 = P3^3 ; //column 4
sbit row0 = P3^4;
sbit row1 = P3^5;
sbit row2 = P3^6;
sbit row3 = P3^7;
sbit rs = P2^2;
sbit rw = P2^1;
sbit en = P2^0;
sbit busy = P0^7;
void lcdready();
void send_to_mem(char s_address, char s_data);
void start_s_eeprom();
void send_byte_s_eeprom(char);
unsigned char i2c_read();
void stop_s_eeprom();
void send_to_mem(char, char);
void wait();
void acknowledge();
int lcdcmd(unsigned int a);
int lcddata(unsigned char a);
int delay(unsigned int i);
int display(unsigned char msg[]);
unsigned char code msg1[] = {"Press key"};
unsigned char code msg2[] = {"Key pressed"};
void send_to_mem(char s_address, char s_data)
{
start_s_eeprom(); // sending start condition to eeprom
send_byte_s_eeprom(0XA0); // A0 = 10100000 = sending device address word for write
acknowledge();
send_byte_s_eeprom(s_address); // sending data address
acknowledge();
send_byte_s_eeprom(s_data); // sending data
acknowledge();
stop_s_eeprom(); // sending stop condition to eeprom
acknowledge();
return;
}
unsigned char get_from_mem(char s_address)
{
unsigned char EEPROM1_DATA ;
start_s_eeprom(); // sending start condition to eeprom
send_byte_s_eeprom(0xA0); // sending A0 = 10100000 = device address word for write
acknowledge();
send_byte_s_eeprom(s_address); // sending data address
acknowledge();
start_s_eeprom();
send_byte_s_eeprom(0xA1); // sending A1 =10100001 = device adress word for read
acknowledge();
EEPROM1_DATA = i2c_read(); // sending data
acknowledge();
stop_s_eeprom(); // sending stop condition to eeprom
acknowledge();
return(EEPROM1_DATA);
}
void send_byte_s_eeprom(char s_byte)
{
char temp = s_byte;
char i ;
for(i = 7 ; i >= 0 ; i--)
{
temp = s_byte;
temp = temp >> i;
temp = temp & 0X01;
if(temp == 0)
sda = 0;
else
sda = 1;
sclk = 1;
wait();
sclk = 0;
}
return;
}
unsigned char i2c_read()
{
char ee_result;
unsigned int counter;
ee_result=0;
sda=1;
sclk=0;
for(counter=0;counter<8;counter++)
{
sclk=1;
while(!sclk){}
wait();
ee_result<<=1;
if(sda){ee_result|=0x01;}
sclk=0;
wait();
}
return(ee_result);
}
void start_s_eeprom()
{
sda = 1;
sclk = 1;
wait();
sda = 0;
sclk = 0;
return;
}
void stop_s_eeprom()
{
sda = 0;
sclk = 1;
wait();
sda = 1;
sclk = 0;
return;
}
void acknowledge()
{
sclk = 1;
wait();
sclk = 0;
return;
}
int lcdcmd(unsigned int a)
{
lcdready();
P0 = a;
rs = 0;
rw = 0;
en = 1;
delay(1);
en = 0;
return;
}
int lcddata(unsigned char a)
{
lcdready();
P0 = a;
rs = 1;
rw = 0;
en = 1;
delay(1);
en = 0;
return;
}
void lcdready()
{
busy=1;
rs=0;
rw=1;
while(busy==1)
{
en=0;
delay(1);
en=1;
}
return;
}
int display(unsigned char msg[])
{
unsigned char i=0;
while(msg!='\0')
{
lcddata(msg);
i++;
}
i=0;
return;
}
int delay(unsigned int i)
{
unsigned int x,y ;
for(x=0;x<i;x++)
{
for(y=0;y<100;y++);
}
}
void main()
{ unsigned char temp1,row;
lcdcmd(0x38);
lcdcmd(0x0e);
lcdcmd(0x01);
lcdcmd(0x06);
display (msg1);
}
here is my code.....
I am not getting how to work further.. plz help me out