; Example 4-5 page 146 ; HCS12 Microcontroller and Embedded Systems ( Mazidi/Causey ) ; Dragon12-Plus Trainer PTH=INPUT Switch, PT5=OUTPUT Speaker ; Modified And Tested by: David Munguia #include "C:\Reg9s12.H" ; header must be in C: dir, or modify dir ; directive must be aligned far left R1 EQU $1000 R2 EQU $1001 ORG $2000 LDS #$2000 BCLR DDRH,%10000000 ;PTH7 = Input(Door Sensor) HERE BRSET PTH,%10000000,HERE BSET DDRT,%00100000 ;PT5 = Output BSET PTT,%00100000 JSR DELAY BCLR PTT,%00100000 JSR DELAY BRA HERE DELAY PSHA LDAA #100 STAA R1 D1 LDAA #100 STAA R2 D2 NOP NOP NOP DEC R2 BNE D2 DEC R1 BNE D1 PULA RTS END