.prm文件添加两行:
……
Addr_CPLD = READ_WRITE 0x008000 TO 0x0080C0;
……
EX_CPLD INTO Addr_CPLD;
……
compiler for HC12设置中添加了:-CpPPAGE=RUNTIME
主程序:
#pragma DATA_SEG __PPAGE_SEG EX_CPLD
unsigned int test[8];
#pragma DATA_SEG DEFAULT
unsigned int *p;
unsigned int q;
void MMC_Init(void)
{
MODE = 0xA8; /* Normal expanded mode,IVIS=1 */
EBICTL = 0x01; /* the E clock behaves as a bus control signal */
MISC = 0x0f; /* Stretch=1 cycle */
PEAR = 0x04; /* NECLK=0,RDWE=1 */
}
void main(void) {
MMC_Init();
EnableInterrupts;
for(;;)
{
int i;
_FEED_COP(); /* feeds the dog */
test[0] = 0xA5;
p = &test;
q = *p;
for(i = 0; i < 1000; i++){} /*延时*/
} /* loop forever */
/* please make sure that you never leave main */
}
感谢版主的指点。按照您的办法我试了一下,发现PPAGE始终是0x20不变化,仍然没有读周期的波形。然后我猜想会不会是memory model有问题,就改成了Large,发现PPAGE可变了,在0和0x20两个值之间切换,读周期波形也出来了,而且compiler for HC12里面也不用设置-CpPPAGE=RUNTIME了。这是为什么呢?