
2–83
Motorola Sensor Device Data
For More Information On This Product,
  Go to: www.freescale.com
DONE          JMP      DONE              ; End
SILENCE       BRSET    7,PORTB,SILENCE   ; Sample switch S2 for stopping LED
              SEI
              BCLR     3,PORTB           ; Turn off LED
              JMP      DONE              ; End
******************************************
*                                        *
*       Timer service interrupt          *
*       Alternates the PLMA data         *
*       and bit 3 of Port B              *
*                                        *
******************************************
TIMERCMP     BSR     COMPRGT             ; Branch to subroutine compare register
             BRSET   1,PORTB,SKIPBUZZER  ; Branch if J1 is OFF
             LDA     PLMA
             EOR     #$80                ; Alternate the buzzer
             STA     PLMA
             RTI
SKIPBUZZER   BRSET   3,PORTB,OFF_LED     ; Alternate LED supply
             BSET    3,PORTB
             RTI
OFF_LED      BCLR    3,PORTB
             RTI
******************************************
*                                        *
*           Subroutine reset             *
*      the timer compare register        *
*                                        *
******************************************
COMPRGT      LDA     TCNTHI           ; Read Timer count register
             STA     TEMPTCNTHI       ; and store it in the RAM
             LDA     TCNTLO
             STA     TEMPTCNTLO
             ADD     #$50             ; Add C350 H = 50,000 periods
             STA     TEMPTCNTLO       ; with the current timer count
             LDA     TEMPTCNTHI       ; 1 period = 2 us
             ADC     #$C3
             STA     TEMPTCNTHI       ; Save the next count to the register
             STA     OCMPHI1
             LDA     TSTATUS          ; Clear the output compare flag
             LDA     TEMPTCNTLO       ; by access the timer status register
             STA     OCMPLO1          ; and then access the output compare register
             RTS
******************************************
*                                        *
*       Delay Subroutine for 0.20 sec    *
*                                        *
*   Input: None                          *
*   Output: None                         *
*                                        *
******************************************
DLY20        STA     STACK+2
             STX     STACK+3
             LDA     #!40           ; 1 unit = 0.7725 mS
OUTLP        CLRX
INNRLP       DECX
             BNE     INNRLP
             DECA
             BNE     OUTLP
             LDX     STACK+3
             LDA     STACK+2
             RTS
******************************************
*                                        *
*   This subroutine provides services    *
*    for those unintended interrupts     *
*                                        *
******************************************
SWI          RTI                      ; Software interrupt return
IRQ          RTI                      ; Hardware interrupt
TIMERCAP     RTI                      ; Timer input capture
TIMERROV     RTI                      ; Timer overflow interrupt
SCI          RTI                      ; Serial communication Interface Interrupt
             ORG     $3FF2            ; For 68HC05B16, the vector location
             FDB     SCI              ; starts at 3FF2
             FDB     TIMERROV         ; For 68HC05B5, the address starts at 1FF2
             FDB     TIMERCMP
             FDB     TIMERCAP
             FDB     IRQ
             FDB     SWI
             FDB     RESET
F
Freescale Semiconductor, Inc.
n
.