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

📄 rtc.asm

📁 带触摸按键的高端电磁炉设计 该方案采用CYPRESS的新器件CY8C22545,是一款专门针对中高端的家电触摸产品设计。除了集成触摸按键功能外
💻 ASM
字号:
;;*****************************************************************************
;;*****************************************************************************
;;  FILENAME: RTC.asm
;;   Version: 1.0, Updated on 2008/12/13 at 11:0:49
;;  Generated by PSoC Designer ???
;;
;;  DESCRIPTION: RTC User Module software implementation file
;;               for the 21x45/22x45 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 Semiconductor Corporation 2000-2008. All Rights Reserved.
;;*****************************************************************************
;;*****************************************************************************

include "m8c.inc"
include "memory.inc"
include "RTC.inc"

;-----------------------------------------------
;  Global Symbols
;-----------------------------------------------
export  RTC_EnableInt
export _RTC_EnableInt
export  RTC_DisableInt
export _RTC_DisableInt
export  RTC_Start
export _RTC_Start
export  RTC_Stop
export _RTC_Stop
export  RTC_SetIntPeriod
export _RTC_SetIntPeriod
export  RTC_bReadSecond
export _RTC_bReadSecond
export  RTC_bReadMinute
export _RTC_bReadMinute
export  RTC_bReadHour
export _RTC_bReadHour
export  RTC_SetSecond
export _RTC_SetSecond
export  RTC_SetMinute
export _RTC_SetMinute
export  RTC_SetHour
export _RTC_SetHour

AREA InterruptRAM (RAM,REL,CON)

;-----------------------------------------------
;  Constant Definitions
;-----------------------------------------------


;-----------------------------------------------
; Variable Allocation
;-----------------------------------------------

AREA UserModules (ROM, REL)

.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: RTC_EnableInt
;
;  DESCRIPTION:
;     Enables this RTC's interrupt by setting the interrupt enable mask bit
;     associated with this User Module. This function has no effect until and
;     unless the global interrupts are enabled (for example by using the
;     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.
;
 RTC_EnableInt:
_RTC_EnableInt:
   RAM_PROLOGUE RAM_USE_CLASS_1
   RTC_EnableInt_M
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret

.ENDSECTION


.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: RTC_DisableInt
;
;  DESCRIPTION:
;     Disables this RTC's 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.
;
 RTC_DisableInt:
_RTC_DisableInt:
   RAM_PROLOGUE RAM_USE_CLASS_1
   RTC_DisableInt_M
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret

.ENDSECTION


.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: RTC_Start
;
;  DESCRIPTION:
;     Enable the RTC UM to start the real timer clock. 
;     Set the start bit in RTC control register
;-----------------------------------------------------------------------------
;
;  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.
;
 RTC_Start:
_RTC_Start:
   RAM_PROLOGUE RAM_USE_CLASS_1
   M8C_SetBank1
   RTC_Start_M
   M8C_SetBank0
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret

.ENDSECTION


.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: RTC_Stop
;
;  DESCRIPTION:
;     Disable the RTC UM to stop the real timer clock 
;      by clearing the start bit in the Control
;     register.
;-----------------------------------------------------------------------------
;
;  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.
;
 RTC_Stop:
_RTC_Stop:
   RAM_PROLOGUE RAM_USE_CLASS_1
   M8C_SetBank1
   RTC_Stop_M
   M8C_SetBank0
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret

.ENDSECTION


.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: RTC_SetIntPeriod
;
;  DESCRIPTION:
;    Configure the interrupt period of RTC module. 
;    The period can be 1 second, 1 minute, 1 hour or 1 day.
;-----------------------------------------------------------------------------
;
;  ARGUMENTS: fastcall16 void SetIntPeriod (passed in A)
;  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.
;
 RTC_SetIntPeriod:
_RTC_SetIntPeriod:
   RAM_PROLOGUE RAM_USE_CLASS_2
   and   A, RTC_INT_SEL_MASK   
   mov   X, SP
   push  A                                  ; store value in stack
   M8C_SetBank1
   mov   A, reg[RTC_RTCCR_REG]  ; get register value
   and   A, ~RTC_INT_SEL_MASK   ; clear INT_SEL bits
   or    A, [X]                              ; set INT_SEL bits
   mov   reg[RTC_RTCCR_REG], A  ; set new register value
   M8C_SetBank0
   pop   A
   RAM_EPILOGUE RAM_USE_CLASS_2
   ret

.ENDSECTION


.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: RTC_bReadSecond
;
;  DESCRIPTION:
;     This function will access the data in seconds register at address 1A6h.
;
;-----------------------------------------------------------------------------
;
;  ARGUMENTS:   None
;  RETURNS:     fastcall16 BYTE bReadSecond (void)
;  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.
;
 RTC_bReadSecond:
_RTC_bReadSecond:
   RAM_PROLOGUE RAM_USE_CLASS_1
   M8C_SetBank1
   mov   A, reg[RTC_RTCS_REG] ; Read second value in BCD format
   M8C_SetBank0
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret

.ENDSECTION

.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: RTC_bReadMinute
;
;  DESCRIPTION:
;     This function will access the data in minutes register at address 1A5h.
;
;-----------------------------------------------------------------------------
;
;  ARGUMENTS:   None
;  RETURNS:     fastcall16 BYTE bReadMinute (void)
;  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.
;
 RTC_bReadMinute:
_RTC_bReadMinute:
   RAM_PROLOGUE RAM_USE_CLASS_1
   M8C_SetBank1
   mov   A, reg[RTC_RTCM_REG]   ; Read minute value in BCD format
   M8C_SetBank0
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret

.ENDSECTION

.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: RTC_bReadHour
;
;  DESCRIPTION:
;     This function will access the data in hours register at address 1A4h.
;
;-----------------------------------------------------------------------------
;
;  ARGUMENTS:   None
;  RETURNS:     fastcall16 BYTE bReadHour(void)
;  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.
;
 RTC_bReadHour:
_RTC_bReadHour:
   RAM_PROLOGUE RAM_USE_CLASS_1
   M8C_SetBank1
   mov  A,reg[RTC_RTCH_REG]  ; Read hour value in BCD format
   M8C_SetBank0
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret

.ENDSECTION

.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: RTC_SetSecond
;
;  DESCRIPTION:
;    This function will set the second value the data in seconds register at address 1A6h.
;
;-----------------------------------------------------------------------------
;
;  ARGUMENTS:    fastcall16 void SetSecond(passed in A)
;  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.
;
 RTC_SetSecond:
_RTC_SetSecond:
   RAM_PROLOGUE RAM_USE_CLASS_1
   M8C_SetBank1
   mov   reg[RTC_RTCS_REG], A   ; Set init second value
   M8C_SetBank0
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret

.ENDSECTION

.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: RTC_SetMinute
;
;  DESCRIPTION:
;    This function will set the minute value the data in minute register at address 1A5h.
;
;-----------------------------------------------------------------------------
;
;  ARGUMENTS:    fastcall16 void SetMinute(passed in A)
;  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.
;
 RTC_SetMinute:
_RTC_SetMinute:
   RAM_PROLOGUE RAM_USE_CLASS_1
   M8C_SetBank1
   mov   reg[RTC_RTCM_REG], A    ; Set init minute value
   M8C_SetBank0
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret

.ENDSECTION

.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: RTC_SetHour
;
;  DESCRIPTION:
;    This function will set the hour value the data in hour register at address 1A4h.
;
;-----------------------------------------------------------------------------
;
;  ARGUMENTS:    fastcall16 void SetHour(passed in A)
;  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.
;
 RTC_SetHour:
_RTC_SetHour:
   RAM_PROLOGUE RAM_USE_CLASS_1
   M8C_SetBank1
   mov   reg[RTC_RTCH_REG], A     ; Set init hour value
   M8C_SetBank0
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret

.ENDSECTION
; End of File RTC.asm

⌨️ 快捷键说明

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