You are on page 1of 2

#include <mega32.

h>
#include <lcd.h>
#include <delay.h>
#include <stdlib.h>
#include <stdio.h>
#pragma opt+
#pragma warn-
#pragma optsize+
#define text " standbye... press '0' key "
#define light porta.3
#asm
.equ __lcd_port=0x1b
#endasm

void disp_name(void);

eeprom struct phone{


char name[16];
int number;

}ph[20]= {{"amir#",44349},{"maysam#",20},{"majid#",5},{"ali#",23456}};

eeprom struct phone *ph_sp;


char name;
int number,i=0,times;

void main(void)
{

lcd_init(16);

lcd_clear();
light=1;
lcd_putsf("ok");
delay_ms(500);
lcd_clear();
ph_sp= & ph;
while(1){
disp_name();
delay_ms(1500);
ph_sp++;
lcd_clear();
};
}

void disp_name(void){
i=0;
name=ph_sp->name[i];
number=ph_sp->number;
while( name != '#' ) {
lcd_putchar(name);
i++;
name=ph_sp->name[i];
};
if (number == 0) ph_sp =&ph;
}

You might also like