⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bpf2_1.asm

📁 测量脉搏的源码 Cypress公司使用 CY27443 完成相关的功能
💻 ASM
字号:
;;*****************************************************************************
;;*****************************************************************************
;;  FILENAME: BPF2_1.asm
;;   Version: 5.0, Updated on 2003/08/26 at 16:00:05
;;  Generated by PSoC Designer ver 4.0 b865 : 27 August, 2003
;;
;;  DESCRIPTION: Asm source for 2 Pole Switched Capacitor Band Pass Filter
;;
;;  NOTE: User Module APIs conform to the fastcall 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
;;        function returns. Even though these registers may be preserved now,
;;        there is no guarantee they will be preserved in future releases.
;;-----------------------------------------------------------------------------
;;  Copyright (c) Cypress MicroSystems 2001-2003. All Rights Reserved.
;;*****************************************************************************
;;*****************************************************************************

include "m8c.inc"
include "BPF2_1.inc"


;-----------------------------------------------
;  Global Symbols
;-----------------------------------------------
export  BPF2_1_Start
export _BPF2_1_Start
export  BPF2_1_SetPower
export _BPF2_1_SetPower

export  BPF2_1_SetC1
export _BPF2_1_SetC1
export  BPF2_1_SetC2
export _BPF2_1_SetC2
export  BPF2_1_SetC3
export _BPF2_1_SetC3
export  BPF2_1_SetC4
export _BPF2_1_SetC4
export  BPF2_1_SetCA
export _BPF2_1_SetCA
export  BPF2_1_SetCB
export _BPF2_1_SetCB

export  BPF2_1_Stop
export _BPF2_1_Stop


;-----------------------------------------------
; Variable Allocation
;-----------------------------------------------
AREA bss (RAM,REL)



;-----------------------------------------------
;  EQUATES
;-----------------------------------------------
bPOWERMASK:          equ   03h         ; Power field mask for CR3
BPF_CNUMMASK:        equ   1fh         ; Mask for A, B & C Caps
BPF_CFBMASK:         equ   80h         ; Mask for Feedback Caps



AREA UserModules (ROM,REL)
;-----------------------------------------------------------------------------
;  FUNCTION NAME: BPF2_1_Start
;
;  DESCRIPTION: Applies power setting to the module's PSoC blocks
;
;-----------------------------------------------------------------------------
;
;  ARGUMENTS:    A register contains the power setting (constant)
;  RETURNS:      Nothing
;  SIDE EFFECTS: REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
;

 BPF2_1_Start:
_BPF2_1_Start:
 BPF2_1_SetPower:
_BPF2_1_SetPower:

    and A, bPOWERMASK                        ; mask A to protect unchanged bits
    mov X, SP                                ; define temp store location

    push A                                   ; put power value in temp store
    mov A, reg[BPF2_1_FLIN_CR3]    ; read power value
    and A, ~bPOWERMASK                       ; clear power bits in A
    or  A, [X]                               ; combine power value with balance of reg.
    mov reg[BPF2_1_FLIN_CR3], A    ; move complete value back to register

    mov A, reg[BPF2_1_FLFB_CR3]    ; read power value
    and A, ~bPOWERMASK                       ; clear power bits in A
    or  A, [X]                               ; combine power value with balance of reg.
    mov reg[BPF2_1_FLFB_CR3], A    ; move complete value back to register
    pop A
    ret

;-----------------------------------------------------------------------------
;  FUNCTION NAME: BPF2_1_SetCn, n=1..4
;
;  DESCRIPTION:   Alters the filter transfer function by modifying the value
;                 of the capacitors (defined in BPF2_1.inc)
;
;-----------------------------------------------------------------------------
;
;  ARGUMENTS:    The A register contains a non-negative integer less than 32
;  RETURNS:
;  SIDE EFFECTS: REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
;

 BPF2_1_SetC1:
_BPF2_1_SetC1:

    and A, BPF_CNUMMASK                      ; mask A to protect unchanged bits
    mov X, SP                                ; define temp store location
    push A                                   ; put C1 value in temp store
    mov A, reg[BPF2_1_FILT_C1_REG] ; read current C1
    and A, ~BPF_CNUMMASK                     ; clear C1 bits in A
    or  A, [X]                               ; combine C1 value with balance of reg.
    mov reg[BPF2_1_FILT_C1_REG], A ; move complete value back to register
    pop  A
    ret

 BPF2_1_SetC2:
_BPF2_1_SetC2:

    and A, BPF_CNUMMASK                      ; mask A to protect unchanged bits
    mov X, SP                                ; define temp store location
    push A                                   ; put C2 value in temp store
    mov A, reg[BPF2_1_FILT_C2_REG] ; read current C2
    and A, ~BPF_CNUMMASK                     ; clear C2 bits in A
    or  A, [X]                               ; combine C2 value with balance of reg.
    mov reg[BPF2_1_FILT_C2_REG], A ; move complete value back to register
    pop A
    ret

 BPF2_1_SetC3:
_BPF2_1_SetC3:

    and A, BPF_CNUMMASK                      ; mask A to protect unchanged bits
    mov X, SP                                ; define temp store location
    push A                                   ; put C3 value in temp store
    mov A, reg[BPF2_1_FILT_C3_REG] ; read current C3
    and A, ~BPF_CNUMMASK                     ; clear C3 bits in A
    or  A, [X]                               ; combine C3 value with balance of reg.
    mov reg[BPF2_1_FILT_C3_REG], A ; move complete value back to register
    pop A
    ret

 BPF2_1_SetC4:
_BPF2_1_SetC4:

    and A, BPF_CNUMMASK                      ; mask A to protect unchanged bits
    mov X, SP                                ; define temp store location
    push A                                   ; put C4 value in temp store
    mov A, reg[BPF2_1_FILT_C4_REG] ; read current C4
    and A, ~BPF_CNUMMASK                     ; clear C4 bits in A
    or  A, [X]                               ; combine C4 value with balance of reg.
    mov reg[BPF2_1_FILT_C4_REG], A ; move complete value back to register
    pop A
    ret


;-----------------------------------------------------------------------------
;  FUNCTION NAME: BPF2_1_SetCA
;            and  BPF2_1_SetCB
;
;  DESCRIPTION:   Alters the filter transfer function by modifying the value
;                 of the op-amp feedback capacitors (see BPF2_1.inc)
;-----------------------------------------------------------------------------
;
;  ARGUMENTS:    The A register contains one of the BPF2_1_FEEDBACK
;                  constants defined in BPF2_1.inc
;  RETURNS:      Nothing.
;  SIDE EFFECTS: REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
;

 BPF2_1_SetCA:
_BPF2_1_SetCA:
    cmp   A, BPF2_1_FEEDBACK_32    ; Change Feedback to 32 units?
    jz    .SetCAto32                         ;    Yes, go make it so
                                             ;     No, clear it to 16 units...
    and   reg[BPF2_1_FILT_CA_REG], ~BPF_CFBMASK
    ret
.SetCAto32:
    or    reg[BPF2_1_FILT_CA_REG],  BPF_CFBMASK
    ret


 BPF2_1_SetCB:
_BPF2_1_SetCB:
    cmp   A, BPF2_1_FEEDBACK_32    ; Change Feedback to 32 units?
    jz    .SetCAto32                         ;    Yes, go make it so
                                             ;     No, clear it to 16 units...
    and   reg[BPF2_1_FILT_CB_REG], ~BPF_CFBMASK
    ret
.SetCAto32:
    or    reg[BPF2_1_FILT_CB_REG],  BPF_CFBMASK
    ret


;-----------------------------------------------------------------------------
;  FUNCTION NAME: BPF2_1_Stop
;
;  DESCRIPTION: Cuts power to the user module.
;
;-----------------------------------------------------------------------------
;
;  ARGUMENTS:     None
;  RETURNS:       Nothing
;  SIDE EFFECTS: REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
;
 BPF2_1_Stop:
_BPF2_1_Stop:


    and reg[BPF2_1_FLIN_CR3], ~bPOWERMASK
    and reg[BPF2_1_FLFB_CR3], ~bPOWERMASK
    ret


; End of File BPF2_1.asm

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -