Hardware Reference
In-Depth Information
int SetUserVector(int VectNum, Address UserAddress);
Pointer address: $EEA4
This function will be discussed in Chapter 6.
Boolean far WriteEEByte (Address EEAddress, Byte EEData);
Pointer address: $EEA6
The WriteEEByte() function provides a mechanism to program individual bytes of the on-
chip EEPROM. It does not perform any range checking on the passed EEAddress. A user's
program can determine the start address and size of the on-chip EEPROM array by exam-
ining the data contained in the custom data area fields CustData.EEBase and CustData.
EESize.
A byte-erase operation is performed before the programming operation and a verification
operation is performed after the programming operation. If the EEPROM data does not match
EEData, false (0 value) is returned by the function.
Int far EraseEE(void);
Pointer address: $EEAA
This function performs a bulk erase operation to the on-chip EEPROM without having
to manipulate the EEPROM programming control registers. After the bulk erase opera-
tion is performed, the memory range described by CustData.EEBase and CustData.EESize
is checked for erasure. If any of the bytes does not contain 0xFF, a nonzero error code is
returned.
int far ReadMem(Address StartAddress, Byte *MemDataP, unsigned int NumBytes);
Pointer address: $EEAE
This function is used internally by D-Bug12 for all memory read access.
int WriteMem(Address StartAddress, Byte *MemDataP, unsigned int NumBytes);
Pointer address: $EEB2
The WriteMem() function is used internally by D-Bug12 for all memory write accesses. If
a byte is written to the memory range described by CustData.EEBase and CustData.EESize,
WriteMem() calls the WriteEEByte() function to program the data into the on-chip EEPROM
memory. A nonzero error code is returned if a problem occurs while writing to target
memory.
4.8.3 Using the D-Bug12 Functions
A useful program usually consists of several functions. An example is given in this
section.
Example 4.10
Write a program that invokes appropriate functions to find the prime number between 1000
and 2000. Output eight prime numbers in one line. To do this, we need to
1. Invoke the PrimeTest subroutine to test if an integer is a prime. The PrimeTest
subroutine will in turn call subroutines FindSqr and div32.
2. Invoke the printf() function to output the prime number.
3. Write a loop to test all the integers between 1000 and 2000.
 
Search WWH ::




Custom Search