Hi,
My project is a simple one ,I use the MC9S12KT256 to control a bus controller--mfr4310.Because it is the first time to use the HCS12,I want to check whether the signals sent out on the exbus ports are correct.I use the cw5.1 to initiate my device.Here are the key points I think to use the EXbus.
1.configure the cpu to normal expanded mode,so PORTA and PORTB are used as addr/data bus.
2.enable the bus control signals,such as Eclk,RD/WR,LBSTROB,and XADDRS.
3.add the pagedata.c file to the project so I can access paged external address space,for example kt256 PAGE30-PAGE3F are used as internal FLASH,so I can use PAGE00 to point to my external space.
4.use *far pointer:volatile unsigned char *far p_RAM_PG_00; // pointer to external memory
p_RAM_PG_00 = (unsigned char *far)0x008000; // initialize pointer to page 0 address 0x8000 =>
// => external bus address is 0*0x4000+ (0x8000-0x8000)= 0x000000
a2 = *p_RAM_PG_00;
5.add this command to the compiler:-CpPPAGE=RUNTIME -D__FAR_DATA -CPUHCS12 -D__NO_FLOAT__ -Mb
6.set the debugging memory map in the debugger as the real chip ,and the picture above in my question has depicted the specific configuration.
Any thing more need to be configured?please help.And I will add my project as an accessory,it runs well in simulation mode,but when I change into onchip mode,it just become incorrect.I run the code :
p_RAM_PG_00 = (unsigned char *far)0x008000; // initialize pointer to page 0 address 0x8000 =>
// => external bus address is 0*0x4000+ (0x8000-0x8000)= 0x000000
a2 = *p_RAM_PG_00;
I can not get 0x000000,but 0x008000 instead.This is wrong ,not consistent with the example.