Los comandos y su explicación:
Syntax
Variable = EREAD Address
Overview
Read information from the on-board EEPROM available on some PICmicro types.
Operators
Variable - a user defined variable of type bit, byte, byte array, word, word array, dword, or float.
Address - a constant, variable, or expression, that contains the address of interest within EEPROM memory.
Example
DEVICE 16F84 " A PICmicro with on-board eeprom
DIM VAR1 as BYTE
DIM WRD1 as WORD
DIM DWRD1 as DWORD
EDATA 10 , 354 , 123456789 " Place some data into the eeprom
VAR1 = EREAD 0 " Read the 8-bit value from address 0
WRD1= EREAD 1 " Read the 16-bit value from address 1
DWRD1 = EREAD 3 " Read the 32-bit value from address 3
Notes
If a float, or dword type variable is used as the assignment variable, then 4-bytes will be read from the eeprom. Similarly, if a word type variable is used as the assignment variable, then a 16-bit value (2-bytes)will be read from eeprom, and if a byte type variable is used, then 8-bits will be read. To read an 8-bit value while using a word sized variable, use the LOWBYTE modifier
WRD1.LOWBYTE = EREAD 0 " Read an 8-bit value
WRD1.HIGHBYTE = 0 " Clear the high byte of WRD
If a 16-bit size value is read from the EEPROM, the address must be incremented by two for the next read. Also, if a float or dword type variable is read, then the address must be incremented by 4.
Most of the Flash PICmicro types have a portion of memory set aside for storage of information. The amount of memory is specific to the individual PICmicro type, some, such as the 16F84, has 64 bytes, the 16F877 device has 256 bytes, and some of the 16-bit core devices have upwards of 512 bytes. EEPROM memory is non-volatile, and is an excellent place for storage of long-term information, or tables of values. Reading data with the ERead command is almost instantaneous, but writing data to the eeprom can take up to 10ms per byte
EWRITE Address , [ Variable {, Variable…etc } ]
Overview
Write information to the on-board EEPROM available on some PICmicro types.
Operators
Address is a constant, variable, or expression, that contains the address of interest within eeprom memory.
Variable is a user defined variable of type bit, byte, byte array, word, word array, dword, float or a constant value.
Example
DEVICE 16F628 " A PICmicro with on-board eeprom
DIM VAR1 as BYTE
DIM WRD1 as WORD
DIM Address as BYTE
VAR1 = 200
WRD1= 2456
Address = 0 " Point to address 0 within the eeprom
EWRITE Address , [ WRD , VAR1 ] " Write a 16-bit then an 8-bit value
Notes
If a dword type variable is used, then a 32-bit value (4-bytes) will be written to the eeprom. Similarly, if a word type variable is used, then a 16-bit value (2-bytes) will be written to eeprom, and if a byte type variable is used, then 8-bits will be written. To write an 8-bit value while using a word sized variable, use the LOWBYTE modifier: -
EWRITE Address , [ WRD.LOWBYTE , VAR1 ]
If a 16-bit size value is written to the EEPROM, the address must be incremented by two before the next write: -
FOR Address = 0 TO 64 STEP 2
EWRITE Address , [ WRD ]
NEXT
Most of the Flash PICmicro types have a portion of memory set aside for storage of information. The amount of memory is specific to the individual PICmicro type, some, such as the 16F84, has 64 bytes, while the newer 16F877, and 18FXXX devices have 256 bytes. EEPROM memory is non-volatile, and is an excellent place for storage of long-term information, or tables of values. Writing data with the EWrite command can take up to 10ms per byte, but reading data from the EEPROM is almost instantaneous
Saludos,
Ricky