Hi,
I tried to do it without test. You can compare.
If the alternative function (another from GPIO) is enabled it takes precedence over all enable peripherals at pin with less priority. Priority starts from GPIO (the least) in the pin description table.
When you disconnect TIM from pin and you want to control them as output by SW
in the interrupt(not by automatic OC function) then you have to set it as GPIO output mode.
// set ports
PTT = ; // good to set initial value at the pins before
// it is switched from input(default) to output
DDRT = 0xFE; // pin 7,6,5,4, ,2,1 are driven by SW, pin 0 driven by PWM
// pin 3 is also output in GPIO mode
//select pins connections
MODRR = 0B00000001 // TIM,TIM,TIM,TIM, GPIO,TIM,TIM,PWM
// select TIM function
TCTL1 = 0x00; // The TIM is disconnected from pins, value will be set manualy
TIOS = 0xFE // TIM channels 7,6,5,4,3,2,1 in OC function
// Set PWM parameters, period, duty, polarity
....
// Set TIM parameters .. predcaler, period, OC value
....
// enable interrupt for TIM
TIE = 0B11100110; // enable TIM interrupt for channel 7,6,5,4, 2,1
//enable interrupt globally
asm CLI
// Run timer, set debug possibilities, set fast flag clear for TIM
TSCR1 = 0xF0; // TEN-run timer; (TSWAI,TSFRZ)-good to set
// to be able to debug; fast TIM flags clear,x,x,x,x
// Run PWM_0
PWME = 0x01; // run PWM0 at PT0
Best regards,
Ladislav