📄 pitimer12.asm
字号:
;;*****************************************************************************
;;*****************************************************************************
;; FILENAME: PITIMER12.asm
;; Version: 1.1, Updated on 2005/05/31 at 12:29:17
;; Generated by PSoC Designer ver 4.2 b1013 : 02 September, 2004
;;
;; DESCRIPTION: PITIMER User Module software implementation file
;; for CY7C639XX, CY7C638XX and related 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 Semiconductor 2004. All Rights Reserved.
;;*****************************************************************************
;;*****************************************************************************
include "m8c.inc"
include "memory.inc"
include "PITIMER12.inc"
;-----------------------------------------------
; Global Symbols
;-----------------------------------------------
export PITIMER12_EnableInt
export _PITIMER12_EnableInt
export PITIMER12_DisableInt
export _PITIMER12_DisableInt
export PITIMER12_Start
export _PITIMER12_Start
export PITIMER12_Stop
export _PITIMER12_Stop
export PITIMER12_SetReload
export _PITIMER12_SetReload
export PITIMER12_GetReload
export _PITIMER12_GetReload
export PITIMER12_GetInterval
export _PITIMER12_GetInterval
;-----------------------------------------------
; Constant Definitions
;-----------------------------------------------
area UserModules (ROM, REL)
.SECTION
;-----------------------------------------------------------------------------
; FUNCTION NAME: PITIMER12_EnableInt
;
; DESCRIPTION:
; Enables the PITIMER interrupt by setting the interrupt enable mask
; bit associated with this User Module.
;
; NOTE: Remember to enable the global interrupt by calling the
; M8C global macro: M8C_EnableGInt
;
;-----------------------------------------------------------------------------
;
; ARGUMENTS: none
;
; RETURNS: none
;
; SIDE EFFECTS:
; The A and X registers may be modified by this or future implementations
; of this function. The same is true for all RAM page pointer registers in
; the Large Memory Model. When necessary, it is the calling function's
; responsibility to perserve their values across calls to fastcall16
; functions.
;
; THEORY of OPERATION or PROCEDURE:
; Sets the specific user module interrupt enable mask bit.
;
;-----------------------------------------------------------------------------
PITIMER12_EnableInt:
_PITIMER12_EnableInt:
RAM_PROLOGUE RAM_USE_CLASS_1
M8C_EnableIntMask INT_MSK1, INT_MSK1_PIT ; Enable the interrupt
RAM_EPILOGUE RAM_USE_CLASS_1
RET
.ENDSECTION
.SECTION
;-----------------------------------------------------------------------------
; FUNCTION NAME: PITIMER12_DisableInt
;
; DESCRIPTION:
; Disables this PITIMER interrupt by clearing the interrupt enable mask bit
; associated with this User Module.
;
;-----------------------------------------------------------------------------
;
; ARGUMENTS: none
;
; RETURNS: none
;
; SIDE EFFECTS:
; The A and X registers may be modified by this or future implementations
; of this function. The same is true for all RAM page pointer registers in
; the Large Memory Model. When necessary, it is the calling function's
; responsibility to perserve their values across calls to fastcall16
; functions.
;
; THEORY of OPERATION or PROCEDURE:
; Clears the specific user module interrupt enable mask bit.
;
;-----------------------------------------------------------------------------
PITIMER12_DisableInt:
_PITIMER12_DisableInt:
RAM_PROLOGUE RAM_USE_CLASS_1
M8C_DisableIntMask INT_MSK1, INT_MSK1_PIT ; Disable the interrupt
RAM_EPILOGUE RAM_USE_CLASS_1
RET
.ENDSECTION
.SECTION
;-----------------------------------------------------------------------------
; FUNCTION NAME: PITIMER12_Stop
;
; DESCRIPTION:
; Disables PITIMER operation.
;
;-----------------------------------------------------------------------------
;
; ARGUMENTS: none
;
; RETURNS: none
;
; SIDE EFFECTS:
; The A and X registers may be modified by this or future implementations
; of this function. The same is true for all RAM page pointer registers in
; the Large Memory Model. When necessary, it is the calling function's
; responsibility to perserve their values across calls to fastcall16
; functions.
;
; THEORY of OPERATION or PROCEDURE:
;
;-----------------------------------------------------------------------------
PITIMER12_Stop:
_PITIMER12_Stop:
RAM_PROLOGUE RAM_USE_CLASS_1
M8C_DisableIntMask INT_MSK1, INT_MSK1_PIT ; Disable the interrupt
RAM_EPILOGUE RAM_USE_CLASS_1
RET
.ENDSECTION
.SECTION
;-----------------------------------------------------------------------------
; FUNCTION NAME: PITIMER12_Start
; PITIMER12_SetReload
;
; DESCRIPTION:
;
;-----------------------------------------------------------------------------
;
; ARGUMENTS: A:X 12 bit Reload Value
;
; RETURNS: none
;
; SIDE EFFECTS:
; The A and X registers may be modified by this or future implementations
; of this function. The same is true for all RAM page pointer registers in
; the Large Memory Model. When necessary, it is the calling function's
; responsibility to perserve their values across calls to fastcall16
; functions.
;
; THEORY of OPERATION or PROCEDURE:
;
;-----------------------------------------------------------------------------
PITIMER12_Start:
_PITIMER12_Start:
PITIMER12_SetReload:
_PITIMER12_SetReload:
RAM_PROLOGUE RAM_USE_CLASS_1
MOV REG[PIRL], A ; Set the reload LSB first
SWAP A, X ; Get the MSB
AND A, 0x0F ; Make sure the upper 4 bits are clear (12 bit reload)
MOV REG[PIRH], A ; Set the reload LSB first
RAM_EPILOGUE RAM_USE_CLASS_1
RET
.ENDSECTION
.SECTION
;-----------------------------------------------------------------------------
; FUNCTION NAME: PITIMER12_GetReload
;
; DESCRIPTION:
;
;-----------------------------------------------------------------------------
;
; ARGUMENTS: None
;
; RETURNS: A:X 12 bit Reload Value
;
; SIDE EFFECTS:
; The A and X registers may be modified by this or future implementations
; of this function. The same is true for all RAM page pointer registers in
; the Large Memory Model. When necessary, it is the calling function's
; responsibility to perserve their values across calls to fastcall16
; functions.
;
; THEORY of OPERATION or PROCEDURE:
;
;-----------------------------------------------------------------------------
PITIMER12_GetReload:
_PITIMER12_GetReload:
RAM_PROLOGUE RAM_USE_CLASS_1
MOV A, REG[PIRL] ; Get the reload LSB first
SWAP A, X ; Save the LSB
MOV A, REG[PIRH] ; Get the reload MSB first
AND A, 0x0F ; Make sure the upper 4 bits are clear (12 bit reload)
SWAP A, X ; Put them into the right registers
RAM_EPILOGUE RAM_USE_CLASS_1
RET
.ENDSECTION
.SECTION
;-----------------------------------------------------------------------------
; FUNCTION NAME: PITIMER12_GetInterval
;
; DESCRIPTION:
;
;-----------------------------------------------------------------------------
;
; ARGUMENTS: None
;
; RETURNS: A:X 12 bit Reload Value
;
; SIDE EFFECTS:
; The A and X registers may be modified by this or future implementations
; of this function. The same is true for all RAM page pointer registers in
; the Large Memory Model. When necessary, it is the calling function's
; responsibility to perserve their values across calls to fastcall16
; functions.
;
; THEORY of OPERATION or PROCEDURE:
;
;-----------------------------------------------------------------------------
PITIMER12_GetInterval:
_PITIMER12_GetInterval:
RAM_PROLOGUE RAM_USE_CLASS_1
MOV A, REG[PITMRL] ; Get the interval LSB first
SWAP A, X ; Save the LSB
MOV A, REG[PITMRH] ; Get the interval MSB first
AND A, 0x0F ; Make sure the upper 4 bits are clear (12 bit reload)
SWAP A, X ; Put them into the right registers
RAM_EPILOGUE RAM_USE_CLASS_1
RET
.ENDSECTION
; End of File PITIMER12.asm
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -