;Sounding the Buzzer on PT0 using Chann 0 Timer (Output Compare option) of the Project Board ;PT0 of PORTT is connected to buzzer/speaker on Project Board using HCS12 MCU Module ;Notice this is NOT using any Time Delay ;Modified from Example 9-11 HCS12 book by Mazidi & Causey for Project BoardDragon and CodeWarrior ;On Student Project Board, PT0 of PORTT is connected to buzzer/speaker permanently. It is accessed by BZ jumper. ;MAKE SURE jumper for BZ (buzzer) is set. BZ JUMPER is part of group of jumpers called UFEA right next to the Buzzer itself ;In Codewarrior, Make sure you are in TBDML Mode before downloading ;Press F7 (to Make), then F5(Debug) to downLOAD,and F5 once more to start the program execution ABSENTRY Entry ; for absolute assembly: mark this as application entry point ; Include derivative-specific definitions INCLUDE 'mc9s12dp256.inc' ; ;code section ORG $4000 ;Flash ROM address for code Entry: LDS #$4000 ;Stack BSET DDRT,%00000001 ;Make PT0 an out for Buzzer ;---Sound the Buzzer by toggling PT0 pin using Timer chan 0 ;Timer Chan0 set-up LDAA #$80 ;if you use $90, then NO need for "BSET TFLG1,%00100000" STAA TSCR1 ;at the end of this program righ above BRA OVER LDAA #$04 ;Prescaler=16. Change (0-7) to hear different sound STAA TSCR2 BSET TIOS,%00000001 ;Output Compare option for Channel 0 LDAA #%00000001 ;Toggle PT0 pin option STAA TCTL2 OVER LDD TCNT ADDD #5000 ;Change this number to hear different sound STD TC0 HERE BRCLR TFLG1,mTFLG1_C0F,HERE BSET TFLG1,%00000001 ;Clear the Chan 0 Timer flag for next round (writing HIGH will clear it). No need for this if you use TSCR1=$90 BRA OVER ;************************************************************** ;* Interrupt Vectors * ;************************************************************** ORG $FFFE DC.W Entry ;Reset Vector. CPU wakes here and it is sent to start of the code at $4000