Hi Radek,
Unfortunately I 'm still doing something wrong. Here is my initialization and test coding:
;*Equates:
PTP equ $0258
DDRP equ $025A
PTRRR equ $036F
TIM_TIOS equ $03D0
TIM_TCNT equ $03D4
TIM_TSCR1 equ $03D6
TIM_TCTL2 equ $03D9
TIM_TIE equ $03DC
TIM_TSCR2 equ $03DD
TIM_TFLG1 equ $03DE
TIM_PTPSR equ $03FE
TIM_TC3 equ $03E6
;*Port P and TIM initialization:
movb #$FF,PTRRR ; all TIM1 OC channels available on Port P
movb #$FF,DDRP ; all pins outputs
movb #$00,PTP ; initialize all pins low
movb #$FF,TIM_TIOS ; all channels outputs
movb #$88,TIM_TSCR1 ; timer enabled, no stop in wait, no stop in freeze, no fast flag
;clear, precision timer
movb #$FF,TIM_TIE ; enable interrupts all channels
movb #$07,TIM_TSCR2 ; timer overflow interrupt disabled, timer counter
; reset disabled, prescale divide by 128
movb #$FF,TIM_TFLG1 ; clear all flags
movb #$80,TIM_TFLG2 ; clear TOF flag
movb #$7F,TIM_PTPSR ; prescale 128, 2.56us resolution, max period 167.7696ms
;*Test code to set channel pin high after ~2.56Usec:
movb #$08,TIM_TFLG1 ; clear Ch3 flag
movb #$C0,TIM_TCTL2 ; Set Ch3 output line to 1 on compare)
ldd TIM_TCNT ; Contents of Timer Count Register-> Accu D
addd #$0001 ; Add 1 (2.56uS)
std TIM_TC3 ; Start OC operation
; Should result in pin high and interrupt in ~2.56uS
;*SUCSESS, PIN HIGH!
;*Test code to set channel pin low after ~168Msec (TIM Ch3 Interrupt Service Routine)
movb #$08,TIM_TFLG1 ; clear Ch3 flag
movb #$80,TIM_TCTL2 ; clear Ch3 output line to zero on compare
ldd TIM_TCNT ; contents of Timer Count Register-> Accu D
addd #$FFFF ; add 65535 ~168Msec
std TIM_TC3 ; start OC operation
; Should result in pin low in ~168Msec
;*NO SUCSESS!
I'm still worrying away at it, but do you see anything obvious?
Thanks,
Robert