Elektra CPU User Manual V1.00
Page 69
16.2 Using EEPROM
There is an EEPROM used to store all TrimDAC adjustment values. These values are loaded on
reset or power-up, so it is critical that these values be correct in order to maintain accurate A/D
measurements. These settings are configured to defaults during manufacturing test – be sure
that you know what you are doing before changing these settings.
The EEPROM provides 256 bytes of non-volatile storage. The first 128 (addresses 00-0x7F)
bytes are reserved for Auto Calibration settings and should not be overwritten. The last 128 bytes
are available for user-accessible non-volatile storage.
Note that access to EEPROM data can be handled through the DSCUD software utilities.
Remember that bytes 0-127 are reserved for system use (TrimDAC autocal values); altering
those values will adversely affect system calibration.
16.2.1 READING VALUE FROM EEPROM
Example : read one byte from EEPROM location 128:
outp(base+3,
0x10
)
;
// set page to page 1
outp(base+15,
0xA5
)
;
// unlock EEPROM
outp(base+13,0x80
)
;
// set address location to 128 (0x80)
outp(base+14, 0xC0);
// Initiate transfer, set to read
while (inp(base+14) & 0x20);
// Wait for EEPROM load to complete
Data = inpb(base+12);
// data returned from EEPROM access
outp(base+3,
0x0x00
)
;
// set page to page 0 (and re-enables lock on EEPROM /
TrimDAC)
NOTE: This code does not take into consideration SCANEN and G0, G1 bits at base+3.
16.2.2 WRITING VALUE TO EEPROM
Example : write one byte (value = 0xaa) to EEPROM location 254, then verify the data:
outp(base+3,
0x10
)
;
// set page to page 1
outp(base+15,
0xA5
)
;
// unlock EEPROM
outp(base+13,0xFE
)
;
// set address location to 254 (0xFE)
outp(base+12, 0xAA);
// Set data to write to EEPROM
outp(base+14, 0x80);
// Initiate transfer, set to write
while (inp(base+14) & 0x20);
// Wait for EEPROM write to complete
outp(base+15,
0xA5
)
;
// unlock EEPROM
outp(base
+13,0xFE
)
;
// set address location to 254 (0xFE)
outp(base+14, 0xC0);
// Initiate transfer, set to read
while (inp(base+14) & 0x20);
// Wait for EEPROM load to complete
Data = inpb(base+12);
// data returned from EEPROM access; data should be 0xAA
outp(base+3,
0x00
)
;
// set page to page 0 (and re-enables lock on EEPROM / TrimDAC)
NOTE: This code does not take into consideration SCANEN and G0, G1 bits at base+3.