Hercules-EBX CPU User Manual V1.02
Page 94
13.7 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.
13.7.1 READING VALUE FROM EEPROM
Example : read one byte from EEPROM location 128:
outp(base+0,
0x01
)
;
// set page to page 1
outp(base+15,
0xA5
)
;
// unlock EEPROM
outp(base+29,0x80
)
;
// set address location to 128 (0x80)
outp(base+30, 0xC0);
// Initiate transfer, set to read
while (inp(base+30) & 0x20);
// Wait for EEPROM load to complete
Data = inpb(base+28);
// data returned from EEPROM access
outp(base+0,
0x00
)
;
// set page to page 0 (and re-enables lock on EEPROM / TrimDAC)
13.7.2 WRITING VALUE TO EEPROM
Example : write one byte (value = 0xaa) to EEPROM location 254, then verify the data:
outp(base+0,
0x01
)
;
// set page to page 1
outp(base+15,
0xA5
)
;
// unlock EEPROM
outp(base+29,0xFE
)
;
// set address location to 254 (0xFE)
outp(base+28, 0xAA);
// Set data to write to EEPROM
outp(base+30, 0x80);
// Initiate transfer, set to write
while (inp(base+30) & 0x20);
// Wait for EEPROM write to complete
outp(base+15,
0xA5
)
;
// unlock EEPROM
outp(base
+29,0xFE
)
;
// set address location to 254 (0xFE)
outp(base+30, 0xC0);
// Initiate transfer, set to read
while (inp(base+30) & 0x20);
// Wait for EEPROM load to complete
Data = inpb(base+28);
// data returned from EEPROM access; data should be 0xAA
outp(base+0,
0x00
)
;
// set page to page 0 (and re-enables lock on EEPROM / TrimDAC)