MCC: Just add MEMORY peripheral and left default settings. internal 1MHz osc, disable MCLR in pin manager. no interrupt.
XC8: we will write addresses starting from 0x01 . Read these addresses and show on LCD. That's so simple.
volatile unsigned char RAMArray[10];
unsigned char i, s1[10];
for(i=0; i<10; i++){
DATAEE_WriteByte(0x01 + i, i*i);
}
OpenXLCD(FOUR_BIT & LINES_5X7);
WriteCmdXLCD(DON&CURSOR_OFF&BLINK_OFF);
while (1)
{
// Add your application code
for(i=0; i<10; i++){
RAMArray[i] = DATAEE_ReadByte(0x01 + i);
sprintf(s1,"%02d",RAMArray[i]);
while(BusyXLCD());
SetDDRamAddr(0x01); // clear LCD
putrsXLCD("Memory Example");
SetDDRamAddr(0x40); // goto second line
while(BusyXLCD());
putrsXLCD("Data=");putrsXLCD(s1);
__delay_ms(1000);
}
}
}
Hiç yorum yok:
Yorum Gönder