Hi Kef,
Thankx for your help and comments, now I tryed to compile to it with the new compiler S12X 4.7.12 ( new lkf File, vector_s12x, crtsx.s and MAKEFILE) and load the elf File with the Indart on.
CLR_BIT(MCCTL,MCEN); //Modulus Down-counter EnableSET_BIT(MCCTL,MODMC);//Modulus Mode enableSET_BIT(MCCTL,RDMCL);//Read Modulus Down-Counter LoadSET_BIT(MCCTL,MCEN); //Modulus Down-counter EnableSET_BIT(MCCTL,FLMC);// Starte der CounterMCCNT = 12000;//(T_UI16)(FCPU/TASK_SUPERFASTTIMER);SET_BIT(MCCTL,MCZI);//Modulus Counter Underflow Interrupt Enable
in the ISR, I clear the Interrupt Flag
CLR_FLAG(MCFLG, MCZF);
the Problem is that the ISR allways called only one time,
I dont know, if there is a problem with the debuger indart one because, when I try to load the S19 file, I become the warning: Error while writing to 7F4000..7F4200. Information: No memory at this address.
I think it s a problem with my const section:
+seg .const -b 0x7F4000 -o 0x4000 -n .const
the vector address is defined in the lkf file as bellow:
+seg .vector -b 0x7FFF10 -o 0xFF10 # vectors start address in der Firmware
thanks for help
There are some differemces between old MC912D60A and newer S12 and S12X, but nonmodulus mode works on all parts. Differences from memory are these:
1. On S12/S12X downcount starts immediately after you write 4 (MODMC = 0, MCEN = 1) to MDC control register. On D60A downcount didn't start until you write to MCCNT.
2. On D60A it was enough to write to upper/lower byte of MCCNT. To start countdown on S12/S12X, you should write 16bits word to MCCNT at once
...
Sample code
//Initialize MDC
#define ModulusMode 0 // *0- non-modulus mode, single shot countdown
// *1- modulus mode, periodic countdown
MCCTL = MCCTL_MCZI_MASK // interrupts enable
| MCCTL_MODMC_MASK *ModulusMode
| MCCTL_MCEN_MASK *1 // enable MDC
| 0 // prescaler
;
void interrupt VectorNumber_Vtimmdcu MDCU_ISR(void)
{
// clear flag
MCFLG = MCFLG_MCZF_MASK;
#if !ModulusMode
// in non-modulus mode, write new countdown value
MCCNT = 20000;
#endif
PORTB ^= 0x80; // toggle the LED
}
And regarding you trouble
Error while writing to 7F4000..7F4200. Information: No memory at this address.
I'm not familiar with Cosmic and Softec, but sounds like Softec is trying to program something else than S12XD family member. Didn't you mix S12XD with S12D?