:: مهندس ::
تاريخ التسجيل: Aug 2006
المشاركات: 24
|
|
نشاط [ haled ]
قوة السمعة:0
|
|
26-03-2014, 03:40 PM
المشاركة 3
|
|
اخي الباش مهندس الفاضل
السلام عليكم
اشكرك جزيل الشكر . الله يبارك فيك
لقد اضفت هذا الكود ولاكن عند القراه النتيجه دائما تكون اصفار .هذا هو الكود اين هو الخطء في هذا الكود
// LCD module connections
sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D4 at RB2_bit;
sbit LCD_D5 at RB3_bit;
sbit LCD_D6 at RB4_bit;
sbit LCD_D7 at RB5_bit;
sbit LCD_RS_Direction at TRISB0_bit;
sbit LCD_EN_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB2_bit;
sbit LCD_D5_Direction at TRISB3_bit;
sbit LCD_D6_Direction at TRISB4_bit;
sbit LCD_D7_Direction at TRISB5_bit;
// End LCD module connections
char message1[] = "1.READ";
char message2[] = "2.WRITE";
char message3[] = "3.Delete";
char message4[] = "WRITE COMPLETED";
char message5[] = "Read Data";
char message6[] = "Data Deleted";
char digi[] = "0000000000";
unsigned short i, NUM ;
unsigned int ADD = 0, temp; // Start EEPROM Location
unsigned long hum =9845261;
char ary[7];
char j;
void main() {
CMCON |= 7; // Disable Comparators
TRISB = 0x0F;
PORTB = 0x00;
Lcd_Init();
start:
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Lcd_Out(1,1,message1); // Write message1 in 1st row
Lcd_Out(1,8,message2);
Lcd_Out(2,1,message3);
do {
// Read Operation
if (Button(&PORTD, 0, 1, 1)) { // Detect logical one to zero
Delay_ms(300);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,message5);
for (i=0; i<=8; i++) {
temp = 0x20+i;
NUM = EEPROM_Read(temp);
digi[i] = NUM+48;
}
Lcd_Out(2,1,digi);
delay_ms(3000);
goto start;
}
// Write Operation
if (Button(&PORTD, 1, 1, 1)) { // Write
Delay_ms(300);
for (j=0;j<8;j++){
IntToStr(hum,ary);
EEPROM_Write(0x02,ary[j]);
}
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,message4);
delay_ms(2000);
goto start;
}
// Delete Operation
if (Button(&PORTD, 2, 1, 1)) { // Detect logical one to zero
Delay_ms(300);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,message6);
for (i=0; i<=8; i++) {
temp = 0x20+i;
EEPROM_Write(temp, 0);
}
delay_ms(2000) ;
goto start;
}
} while(1);
}
|