📄 tone_isr.ss
字号:
// ----------------------------------------------------------------------------
// Copyright (c) 2008 Semiconductor Components Industries, LLC
// (d/b/a ON Semiconductor). All Rights Reserved.
//
// This code is the property of ON Semiconductor and may not be redistributed
// in any form without prior written permission from ON Semiconductor. The
// terms of use and warranty for this code are covered by contractual
// agreements between ON Semiconductor and the licensee.
// ----------------------------------------------------------------------------
// Tone_ISR.ss
// - Contains Tone_TIMER_ISR routine
// - A 2 kHz tone is toggled on and off every time the timer expires.
// The 2 kHz tone is mixed with the pass-through audio.
// ----------------------------------------------------------------------------
// $Revision: 1.16 $
// $Date: 2008/10/29 18:00:25 $
// ----------------------------------------------------------------------------
#include <boss.inc>
#include <bat.inc>
#include "Tone.inc"
#include "Tone_internal.inc"
Mem_Start_Reloc_Segment(Tone_segment, SYSTEM_MEMORY_TYPE_P, 0x1000)
// -----------------------------------------------------------------------------
// Function: Tone_TIMER_ISR
// Description: This interrupt occurs at the end of each timer time-out period
// according to the timer configuration in the application. When
// this interrupt happens, the YL_TONE_STATUS flag is toggled.
// The state of YL_TONE_STATUS flag is checked in the
// Tone_Generation function. A tone will be generated if
// YL_TONE_STATUS is set to TONE_ON.
// Clock cycles: Min: 16 Max: 18
// Modifies: None
// -----------------------------------------------------------------------------
// Control Registers
// -----------------------------------------------------------------------------
.global Tone_TIMER_ISR
Tone_TIMER_ISR:
PUSH ST
CLR ST
PUSH AE
PUSH AH
// Check Tone On/off flag (i.e. YL_TONE_STATUS)
// If YL_TONE_STATUS is on, turn YL_TONE_STATUS off.
// If YL_TONE_STATUS is off, turn YL_TONE_STATUS on.
LD A, YL_TONE_STATUS, Y
CMSI A, TONE_ON
BRA turn_tone_off, Z
// Tone is off. Therefore, turn on the tone by setting
// the YL_TONE_STATUS flag to TONE_ON
LDSI A, TONE_ON
BRA tone_timer_isr_end
turn_tone_off:
// Tone is on. Therefore, turn off the tone by setting
// the YL_TONE_STATUS flag to TONE_OFF
LDSI A, TONE_OFF
tone_timer_isr_end:
LD YL_TONE_STATUS, A, Y
POP AH
POP AE
POP ST
Enable_Int
RET R3
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -