PCD
Non-RAM Data Definitions
CCS C compiler also provides a custom qualifier addressmod which can
be used to define a memory region that can be RAM, program eeprom,
data eeprom or external memory. Addressmod replaces the older
typemod (with a different syntax).
The usage is :
addressmod
(name,read_function,write_function,start_address,end_address,
share);
Where the read_function and write_function should be blank for RAM, or
for other memory should be the following prototype:
// read procedure for reading n bytes from the memory starting at
location addr
void read_function(int32 addr,int8 *ram, int nbytes) {
}
//write procedure for writing n bytes to the memory starting at
location addr
void write_function(int32 addr,int8 *ram, int nbytes){
}
For RAM the share argument may be true if unused RAM in this area can be used by the
compiler for standard variables.
Example:
void DataEE_Read(int32 addr, int8 * ram, int bytes) {
int i;
for(i=0;i<bytes;i++,ram++,addr++)
*ram=read_eeprom(addr);
}
void DataEE_Write(int32 addr, int8 * ram, int bytes) {
int i;
for(i=0;i<bytes;i++,ram++,addr++)
write_eeprom(addr,*ram);
}
addressmod (DataEE,DataEE_read,DataEE_write,5,0xff);
// would define a region called DataEE between
// 0x5 and 0xff in the chip data EEprom.
void main (void)
{
int DataEE test;
int x,y;
x=12;
test=x;
y=test;
// writes x to the Data EEPROM
// Reads the Data EEPROM
}
Note: If the area is defined in RAM then read and write functions are not
required, the variables assigned in the memory region defined by the
addressmod can be treated as a regular variable in all valid expressions.
Any structure or data type can be used with an addressmod. Pointers
26
相关PDF资料
PCI-EXP-T42G5-N1 IP CORE PCI EXPRESS ORCA 4
PCM18XH2 PROCESSOR MODULE MPLAB-ICE 2000
PCM18XN0 PROCESSOR MODULE FOR ICE2000
PDA-B-24-615-E-2B1-1-C CIRCUIT BREAKER MAG 1P 15A
PFMF.260.2 PFMF PTC FUSE SMT 2.6A 1812
PFNF.200.2 PFNF PTC FUSE SMT 2A 1206
PFRY.375 PTC-FUSE RADIAL 72 VDC
PFSM.150.33.2 FUSE PTC 8A 15V FST-TRIP SMD
相关代理商/技术参数
PCD_09 制造商:MACOM 制造商全称:Tyco Electronics 功能描述:Low Profile PCB Relay PCD
PCD-00173-0C 制造商:Molex 功能描述:ETHERNET CABLE ASSEMBLY
PCD-00173-0E 制造商:Molex 功能描述:Ethernet Cable Assembly
PCD-00173-0H 制造商:Molex 功能描述:ETHERNET CABLE ASSEMBLY
PCD-00173-0K 制造商:Molex 功能描述:ETHERNET CABLE ASSEMBLY
PCD-00174-0C 制造商:Molex 功能描述:ETHERNET CABLE ASSEMBLY 制造商:Molex 功能描述:ETHERNET CABLE ASSEMBLY; Cable Length - Imperial:3ft; Cable Length - Metric:914.4mm; Connector Type A:RJ45 Plug; Connector Type B:RJ45 Plug; Jacket Color:Red; Approval Bodies:CSA / UL; Body Material:PVC; Cable Assembly Type:Ethernet ;RoHS Compliant: NA
PCD-00174-0E 制造商:Molex 功能描述:ETHERNET CABLE ASSEMBLY 制造商:Molex 功能描述:ETHERNET CABLE ASSEMBLY; Cable Length - Imperial:3ft; Cable Length - Metric:914.4mm; Connector Type A:RJ45 Plug; Connector Type B:RJ45 Plug; Jacket Color:Grey; Approval Bodies:CSA / UL; Body Material:PVC; Cable Assembly Type:Ethernet;RoHS Compliant: NA
PCD-00174-0H 制造商:Molex 功能描述:ETHERNET CABLE ASSEMBLY