AnsweredAssumed Answered

HCS12 Modulus Register MCCNT won't load

Question asked by Gilbert Gagne on Feb 27, 2012
Latest reply on Feb 28, 2012 by kef

I'm using a 9S12C32 running 48 MHz with PLL. My application is using the Modulus Module to generate an increasing frequency square wave to accelerate a stepper motor from rest to some operating speed. At each motor step, the MCCNT register is reloaded with a decreasing value and after count down to zero, the MCZF flag bit in MCFLG register is set so the motor output bit can be toggled. The MCZF flag bit fails to be set and I've traced the problem to register MCCNT which won't load.

 

In the application, TFFCA bit in TSCR1 is set, and MCCTL Control register is properly loaded to start the down-counter.

 

The attachment is a short program to test loading and reading the MCCNT register. A uBUG12 printout shows a memory dump (md c000 c010) to verify the program was correctly downloaded to Flash. A register dump (rd) to show registers after the breakpoint (br c012 3f) shows that all registers were correctly loaded except Y which should read FF but is 0000 instead.

 

Possibly there is a failure in register MCCNT, or perhaps there is another explanation.

 

Any help would be greatly appreciated.

Outcomes