I have to design a Data Logger programusing mikroC PRO to run on the EasyPIC5 board (with PIC 16F877A microcontroller). I also have to use a 2-line LCD for display.
Here is what i have been given:
The program will take measurements from Analogue Port AN0 at regular intervals, and save the raw data to
EEPROM. The user should be able to select any of 6 memory banks to store the results of a logging session,
and should be able to set the time interval between readings at 1 second, 2 seconds, 5 seconds or 10
seconds. The number of readings taken in each logging session should be set to 5, but should be alterable from a #define in the first few lines of the program. Another #define should be used to specify the total number of memory banks (set to 6).
Under every memory bank there should 5 different reading from one logging session of analogue data and time.
In the above code i only write the reading at same address everytime.
but i am lost in setting memory banks to 8 and saving the logging session to the banks and retrieving data from the memory banks...in that part i have not code at all..
Examples:
EEPROM_Write(0x32, 19);
take = EEPROM_Read(0x3F);
Note:
Ensure minimum 20ms delay between successive use of routines EEPROM_Write and EEPROM_Read. Although PIC will write the correct value, EEPROM_Read might return an undefined result.
yes i am using the internal EEPROM and i am using these methods. thanks for clarifying the 20ms delay.....
Regarding the memroy banks.. i am not sure what the question even wanted me to do by saving the logging session (Which is 5 readings AN0 written to EEPROM) for example to memory bank 1.. then another session to memory bank 2... and so on..then there is an option to check the data saved on any of the 6 MEMORY BANKS.
I hope you realize that PIC16F877 have only 256bytes of EEPROM.
These "banks" how you call that, you can organize and use according to specific address in EEPROM. Each EEPROM byte slot have unique address, and if you want to write 5 ADC readings you need to use two bytes for each ADC value, five readings will occupy 10 bytes. Then you can know starting addresses of each "bank" for reading and writing.
I will use your teminology of "Bank" for some space in EEPROM as one segment of data which have 5 ADC values organized in 10 bytes.
PIC16F877A EEPROM Space (256bytes total) :
Example :
Bank1 starting address : 0x00 and have ADC value 712 on all 5 places.
Bank2 starting address : 0x0A and have ADC value 1012 on all 5 places.
Bank3 starting address : 0x14 and have ADC value 415 on all 5 places.
.
.
.
If you want to read or write some bank, lets say Bank2, you know that starting address for that bank is 0x0A and next 10 bytes you read or write only for Bank2.