;Sounding the Buzzer on PT5 using Chann 5 Timer (Output Compare option) ;PT5 of PORTT is connected to buzzer/speaker on Dragon12+ board ;Notice this is NOT using any Time Delay ;Modified from Example 9-11 HCS12 book by Mazidi & Causey for Dragon12+ board with D-Bug12/AsmIDE/MiniIDE ;Note. The AsmIDE and MiniIDe use register names for the Timer which are different from the book and HCS12 data sheet. See the Reg9s12.H file #include "C:\Reg9s12.H" ;code section ORG $2000 LDS #$2000 ;Stack BSET DDRT,%00100000 ;Make PT5 an out for Buzzer ;---Sound the Buzzer by toggling PT5 pin using Timer chan 5 ;Timer Chan5 set-up LDAA #$80 ;if you use $90, then NO need for "BSET TFLG1,%00100000" at the end of this program righ above BRA OVER STAA TSCR ;This is TSCR1. LDAA #$07 ;Prescaler=128. Change (0-7) to hear different sound STAA Tmsk2 ;This is TSCR2 BSET TIOS,%00100000 ;Output Compare option for Channel 5 LDAA #%00000100 ;Toggle PT5 pin option STAA TCTL1 OVER LDD TCNT ADDD #5000 ;Change this number to hear different sound STD TC5 HERE BRCLR TFLG1,%00100000,HERE BSET TFLG1,%00100000 ;Clear the Chan 5 Timer flag for next round (writing HIGH will clear it). No need for this if you use TSCR=$90 BRA OVER