polona1010
Member level 1
How to find first free address in internal eeprom memory of 18f45k22 and write some data?
Need this in Mikro c
Need this in Mikro c
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
if (local_eeprom == 0xFF){
..
.
.
}
Hope there could be a function to read EEPROM. Search at MicroC.how to do this in mikro c.
if (true){
// do your things if true
} else {
// do your things if not true
}
if (polona == DontKnow)
{
True = Use_MikroC_Help;
}
else
{
False = Visit_EDABoard_com;
}
// LCD module connections
sbit LCD_RS at LATB4_bit;
sbit LCD_EN at LATB5_bit;
sbit LCD_D4 at LATB0_bit;
sbit LCD_D5 at LATB1_bit;
sbit LCD_D6 at LATB2_bit;
sbit LCD_D7 at LATB3_bit;
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections
char bb, value, first_free_address;
char free_left, free_total, ser;
long int i, first;
void main() {
Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear LCD
Lcd_Cmd(_LCD_CURSOR_OFF); // Turn cursor off
/*
Find first free address in internal eeprom of PIC18F45K22
uC have 256 bytes (addresses) and last address is 0xFF
*/
//Check first eeprom free address and print address
//In first row under hex is hex address in eeprom
//In second row under ser is serial number in eeprom between 0 and 256
for (i=0; i<=256; i++)
{
value = EEPROM_Read(i); //Read eeprom address (i) and put data into "value"
bb = value;
if (bb == 0xFF)
{
first = i;
ByteToHex(first, first_free_address);
Lcd_Out(1,1,"hex: ");
Lcd_Out_Cp(first_free_address);
ByteToStr(first, ser);
Lcd_Out(2,1,"ser:");
Lcd_Out_Cp(ser);
break;
}
}
do {
}
while (1);
}