📄 beep.asm
字号:
;;*****************************************************************************
;;*****************************************************************************
;; FILENAME: Beep.asm
;; Version: 1.2, Updated on 2006/10/26 at 11:51:45
;; Generated by PSoC Designer ver 4.4 b1884 : 14 Jan, 2007
;;
;; DESCRIPTION: LED user module for 22/24/27/29xxx PSoC family of devices.
;;
;;
;; NOTE: User Module APIs conform to the fastcall16 convention for marshalling
;; arguments and observe the associated "Registers are volatile" policy.
;; This means it is the caller's responsibility to preserve any values
;; in the X and A registers that are still needed after the API functions
;; returns. For Large Memory Model devices it is also the caller's
;; responsibility to perserve any value in the CUR_PP, IDX_PP, MVR_PP and
;; MVW_PP registers. Even though some of these registers may not be modified
;; now, there is no guarantee that will remain the case in future releases.
;;-----------------------------------------------------------------------------
;; Copyright (c) Cypress MicroSystems 2005. All Rights Reserved.
;;*****************************************************************************
;;*****************************************************************************
include "Beep.inc"
include "memory.inc"
export _Beep_Start
export Beep_Start
export _Beep_Stop
export Beep_Stop
export _Beep_On
export Beep_On
export _Beep_Off
export Beep_Off
export _Beep_Switch
export Beep_Switch
export _Beep_Invert
export Beep_Invert
export _Beep_GetState
export Beep_GetState
AREA UserModules (ROM, REL)
.SECTION
;-----------------------------------------------------------------------------
; FUNCTION NAME: Beep_Start(void)
; FUNCTION NAME: Beep_Stop(void)
;
; FUNCTION NAME: Beep_Switch(void)
;
; DESCRIPTION: ( Switch )
; Turn LED on or off
;
; DESCRIPTION: ( Start, Stop )
; Turn LED off
;
;-----------------------------------------------------------------------------
;
; ARGUMENTS: ( Switch )
; A => If 0, turn off LED, if > 0 turn on LED
;
; ARGUMENTS: ( Start, Stop )
; None
;
; RETURNS: none
;
; SIDE EFFECTS:
; REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
;
;-----------------------------------------------------------------------------
_Beep_On:
Beep_On:
mov A,0x01
jmp Beep_Switch
_Beep_Start:
Beep_Start:
_Beep_Stop:
Beep_Stop:
_Beep_Off:
Beep_Off:
mov A,0x00
_Beep_Switch:
Beep_Switch:
RAM_PROLOGUE RAM_USE_CLASS_4
RAM_PROLOGUE RAM_USE_CLASS_2
RAM_SETPAGE_CUR >Port_1_Data_SHADE
or A,0x00 ; Check mode
jz .Turn_Off_LED
.Turn_On_LED:
IF(0) ; Active High Digit Drive
or [Port_1_Data_SHADE],Beep_PinMask
ELSE ; Active Low Digit Drive
and [Port_1_Data_SHADE],~Beep_PinMask
ENDIF
jmp .Switch_LED
.Turn_Off_LED:
IF(0) ; Active High Digit Drive
and [Port_1_Data_SHADE],~Beep_PinMask
ELSE ; Active Low Digit Drive
or [Port_1_Data_SHADE],Beep_PinMask
ENDIF
.Switch_LED:
mov A,[Port_1_Data_SHADE]
mov reg[Beep_PortDR],A
RAM_EPILOGUE RAM_USE_CLASS_2
RAM_EPILOGUE RAM_USE_CLASS_4
ret
.ENDSECTION
.SECTION
;-----------------------------------------------------------------------------
; FUNCTION NAME: Beep_Invert(void)
;
; DESCRIPTION:
; Invert state of LED
;
;-----------------------------------------------------------------------------
;
; ARGUMENTS: none
;
; RETURNS: none
;
; SIDE EFFECTS:
; REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
;
;-----------------------------------------------------------------------------
_Beep_Invert:
Beep_Invert:
RAM_PROLOGUE RAM_USE_CLASS_4
RAM_PROLOGUE RAM_USE_CLASS_2
RAM_SETPAGE_CUR >Port_1_Data_SHADE
xor [Port_1_Data_SHADE],Beep_PinMask
mov A,[Port_1_Data_SHADE]
mov reg[Beep_PortDR],A
RAM_EPILOGUE RAM_USE_CLASS_2
RAM_EPILOGUE RAM_USE_CLASS_4
ret
.ENDSECTION
.SECTION
;-----------------------------------------------------------------------------
; FUNCTION NAME: Beep_GetState(void)
;
; DESCRIPTION:
; Get state of LED
;
;-----------------------------------------------------------------------------
;
; ARGUMENTS: none
;
; RETURNS:
; State of LED 1 = ON, 0 = OFF
;
; SIDE EFFECTS:
; REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
;
;-----------------------------------------------------------------------------
_Beep_GetState:
Beep_GetState:
RAM_PROLOGUE RAM_USE_CLASS_4
RAM_PROLOGUE RAM_USE_CLASS_2
RAM_SETPAGE_CUR >Port_1_Data_SHADE
mov A,[Port_1_Data_SHADE] ; Get shade value
IF(0) ; Active High Digit Drive
// Nothing for now
ELSE ; Active Low Digit Drive
cpl A ; Invert bit if Active low
ENDIF
and A,Beep_PinMask ; Mask off the trash
jz .End_LED_GS ; If zero, we're done
mov A,0x01 ; Return a 1 no mater what the mask is.
.End_LED_GS:
RAM_EPILOGUE RAM_USE_CLASS_2
RAM_EPILOGUE RAM_USE_CLASS_4
ret
.ENDSECTION
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -