Ruth Hendrix

Code Warrior HC12S Port T timer integration

Discussion created by Ruth Hendrix Employee on Jan 26, 2006
This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.
Posted: Sun Apr 24, 2005 6:16 pm    
I'm using the debug software with codewarrior for the HC12;
I have everything set up on the registers but im not getting any readings @ my pins on port T this is some of the code below.

LDAA #$F0 ;Enable IOC4 STAA $0242 ;Port T DDR Register LDAA #$F0 ;Enable IOC4 STAA $0240 ;I/O Register LDAA #$80 ;Enable Timer STAA $0046 ;TSCR1 Register LDAA #$F0 ;TC4-7 set as output STAA $0040 ;TIOS Register LDAA #$55 ;BIT PATTERN FOR TC4 ACTION AS '1' ON SUCCESS STAA $0048 ;TCTL1 Register LDAA #$03 ;inhibit reset STAA $004D ;TSCR2 Register 

Im not getting anything when i try to compare. If i use Processor expert will this set up my ports as outputs as well when i use the TimerOut Bean? Any suggestions becuase I'm starting to think my code is never making it tot he board. I also attempted to write to the Compare Force register to force a 1 on all TOCs but i get nothin on the port pins when i measure.

Posted: Mon Apr 25, 2005 8:42 am
Seems like this should work.
You don't need to set the DDR or output pin values as the timer will override these.
Can you toggle the pins directly by changing the value of the I/O register with the timer off?
Also, let us know which MCU you are using.
Posted: Mon Apr 25, 2005 3:25 pm    
the MCU is MC9s12NE64. ill try to disable the timer and force compare the outputs to toggle, but other wise i haven't a clue man. Any help would b greatly appreciated. Thanx
Posted: Wed Apr 27, 2005 1:25 pm    
Well I checked the NE64 spec and I can't see why what you have done wouldn't work. If you can toggle the pin state using the I/O register then that rules out hardware connection.
Another thing to check is if the output compare matches are being set in the TFLG1 register.
Posted: Wed Apr 27, 2005 2:09 pm    
I have tried your code on the C128 and it works. C128 has the same timer, just with 8 channels instead of 4. You must be having some kind of problem in your hardware or other pieces of SW. Do you initialise OC7M or TTOV registers? Do you see the flags in TFLG1 set? Do you see the timer count register to change in the debugger when the timer should be running?

Posted: Wed Apr 27, 2005 3:41 pm    
(Do you initialise OC7M or TTOV registers? Do you see the flags in TFLG1 set?)
No i havent should i initialize them to wut??? The mask bit a 1 in channel 4 and the TTOV as well??

What exactly will that intialize the compare?