Difference between revisions of "EEPROM"
Line 142: | Line 142: | ||
EEPROM_ReadString(200,A_StringBuffer_U8); //Copies a string from eeprom(address 200) along with NULL caharacter into A_StringBuffer_U8 | EEPROM_ReadString(200,A_StringBuffer_U8); //Copies a string from eeprom(address 200) along with NULL caharacter into A_StringBuffer_U8 | ||
|} | |} | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ==user guide== | ||
+ | <syntaxhighlight> | ||
+ | /* Program to blink the LEDs using delay routines*/ | ||
+ | |||
+ | #include<reg52.h> | ||
+ | #include "delay.h" //User defined library which contains the delay routines | ||
+ | |||
+ | |||
+ | |||
+ | int main() | ||
+ | { | ||
+ | |||
+ | |||
+ | while(1) | ||
+ | { | ||
+ | PO = 0xff; /* Turn ON the LEDs */ | ||
+ | DELAY_us(10); /* Generate the delay of 1sec+10ms+10us */ | ||
+ | DELAY_ms(10); | ||
+ | DELAY_sec(1); | ||
+ | |||
+ | P0 = 0x00; /* Turn OFF the LEDs */ | ||
+ | DELAY_us(10); /* Generate the delay of 1sec+10ms+10us */ | ||
+ | DELAY_ms(10); | ||
+ | DELAY_sec(1); | ||
+ | |||
+ | } | ||
+ | |||
+ | return 0; | ||
+ | } | ||
+ | </syntaxhighlight> |
Revision as of 19:09, 25 December 2014
Contents
EEPROM
EEPROM_WriteByte
Defination | void EEPROM_WriteByte(uint16_t v_eepromAddress_u16, uint8_t v_eepromData_u8) |
Input Arguments | uint16_t: eeprom_address at which eeprom_data is to be written. uint8_t: byte of data to be to be written in eeprom. |
Return Value | none |
Description | This function is used to write the data at specified EEPROM_address.. |
Usage | EEPROM_WriteByte(1234,25); //Writes 25 at the eeprom address 1234. |
EEPROM_WriteNBytes
Defination | void EEPROM_WriteNBytes(uint16_t v_eepromAddress_u16, uint8_t *p_ramAddress_u8, uint16_t v_numOfBytes_u16) |
Input Arguments | uint16_t,: eeprom_address from where the N-bytes are to be written. uint8_t*: Pointer to the N-bytes of data to be written. |
Return Value | none |
Description | This function is used to write N-bytes of data at specified EEPROM_address. |
Usage | uint8_t A_RamBuffer_U8[5]={10,20,30,40,50}; // Buffer containing the data to be written in Eeprom EEPROM_WriteNBytes(100,A_RamBuffer_U8,5); //Copies 5bytes of data from A_RamBuffer_U8 into eeprom location 100. |
EEPROM_WriteString
Defination | void EEPROM_WriteString(uint16_t v_eepromAddress_u16, char *p_stringPointer_u8) |
Input Arguments | uint16_t: eeprom_address where the String is to be written. char*: Pointer to String which has to be written. |
Return Value | none |
Description | This function is used to Write a String at specified EEPROM_address.NOTE: Null char is also written into the eeprom. |
Usage | uint8_t A_StringBuffer_U8[20]="Hello, World"; // String to be written in eeprom EEPROM_WriteString(50,A_StringBuffer_U8); //Copies "Hello, World" along with NULL character into eeprom location 50. |
EEPROM_Erase
Defination | void EEPROM_Erase() |
Input Arguments | none |
Return Value | none |
Description | This function is used to erase the entire Eeprom memory. Complete Eeprom(C_MaxEepromSize_U16) is filled with 0xFF to accomplish the Eeprom Erase. |
Usage | EEPROM_Erase(); //Erases the complete(C_MaxEepromSize_U16 bytes) eeprom. |
EEPROM_ReadByte
Defination | uint8_t EEPROM_ReadByte(uint16_t v_eepromAddress_u16) |
Input Arguments | uint16_t: eeprom_address from where eeprom_data is to be read. |
Return Value | uint8_t: data read from Eeprom. |
Description | This function is used to read a byte of data from specified EEPROM_address. |
Usage | eeprom_data = EEPROM_ReadByte(100); reads the data from eeprom location 100 which is copied to eeprom_data |
EEPROM_ReadNBytes
Defination | void EEPROM_ReadNBytes(uint16_t v_eepromAddress_16, uint8_t *p_ramAddress_u8, uint16_t v_numOfBytes_u16) |
Input Arguments | uint16_t,: eeprom_address from where the N-bytes is to be read. uint8_t*: Pointer into which the N-bytes of data is to be read. |
Return Value | none |
Description | This function is used to Read N-bytes of data from specified EEPROM_address. The data read from the eeprom will be copied into the specified RamAddress . Note:Care should be taken to allocate enough buffer to read the data. |
Usage | uint8_t A_RamBuffer_U8[20]; // Buffer to read the Eeprom data EEPROM_ReadNBytes(1000,A_RamBuffer_U8,20); //Copies 20bytes of eeprom data(address 1000) into A_RamBuffer_U8 |
EEPROM_ReadString
Defination | void EEPROM_ReadString(uint16_t v_eepromAddress_u16, char *p_destStringAddress_u8) |
Input Arguments | uint16_t: eeprom_address from where the String is to be read. char*: Pointer into which the String is to be read. |
Return Value | none |
Description | This function is used to Read a String from specified EEPROM_address.The string read from eeprom will be copied to specified buffer along with NULL character. |
Usage | uint8_t A_StringBuffer_U8[20]; // Buffer to read the Eeprom data EEPROM_ReadString(200,A_StringBuffer_U8); //Copies a string from eeprom(address 200) along with NULL caharacter into A_StringBuffer_U8 |
user guide
/* Program to blink the LEDs using delay routines*/ #include<reg52.h> #include "delay.h" //User defined library which contains the delay routines int main() { while(1) { PO = 0xff; /* Turn ON the LEDs */ DELAY_us(10); /* Generate the delay of 1sec+10ms+10us */ DELAY_ms(10); DELAY_sec(1); P0 = 0x00; /* Turn OFF the LEDs */ DELAY_us(10); /* Generate the delay of 1sec+10ms+10us */ DELAY_ms(10); DELAY_sec(1); } return 0; }