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

📄 uart.asm

📁 带触摸按键的高端电磁炉设计 该方案采用CYPRESS的新器件CY8C22545,是一款专门针对中高端的家电触摸产品设计。除了集成触摸按键功能外
💻 ASM
📖 第 1 页 / 共 4 页
字号:
;;*****************************************************************************
;;*****************************************************************************
;;  Filename:   UART.asm
;;  Version: 5.2, Updated on 2008/12/13 at 10:58:58
;;  Generated by PSoC Designer ???
;;
;;  DESCRIPTION:  UART User Module software implementation file for the
;;                22/24/25/26/27xxx families.
;;
;;
;;  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 2000-2003. All Rights Reserved.
;;*****************************************************************************
;;*****************************************************************************


include "m8c.inc"
include "memory.inc"
include "UART.inc"

;-----------------------------------------------
;  Global Symbols
;-----------------------------------------------
;-------------------------------------------------------------------
;  Declare the functions global for both assembler and C compiler.
;
;  Note that there are two names for each API. First name is
;  assembler reference. Name with underscore is name refence for
;  C compiler.  Calling function in C source code does not require
;  the underscore.
;-------------------------------------------------------------------
export  UART_SetTxIntMode
export _UART_SetTxIntMode
export  UART_EnableInt
export _UART_EnableInt
export  UART_DisableInt
export _UART_DisableInt

export  UART_Start
export _UART_Start
export  UART_Stop
export _UART_Stop
export  UART_SendData
export _UART_SendData
export  UART_bReadTxStatus
export _UART_bReadTxStatus
export  UART_bReadRxData
export _UART_bReadRxData
export  UART_bReadRxStatus
export _UART_bReadRxStatus

export  UART_IntCntl
export _UART_IntCntl

export  UART_TxIntMode
export _UART_TxIntMode

export  UART_PutSHexByte
export _UART_PutSHexByte
export  UART_PutSHexInt
export _UART_PutSHexInt

export  UART_CPutString
export _UART_CPutString
export  UART_PutString
export _UART_PutString
export  UART_PutChar
export _UART_PutChar
export  UART_Write
export _UART_Write
export  UART_CWrite
export _UART_CWrite

export  UART_cGetChar
export _UART_cGetChar
export  UART_cReadChar
export _UART_cReadChar
export  UART_iReadChar
export _UART_iReadChar
export  UART_PutCRLF
export _UART_PutCRLF

IF (UART_RXBUF_ENABLE)
export  UART_CmdReset
export _UART_CmdReset
export  UART_bCmdCheck
export _UART_bCmdCheck
export  UART_bCmdLength
export _UART_bCmdLength
export  UART_bErrCheck
export _UART_bErrCheck

export  UART_szGetParam
export _UART_szGetParam
export  UART_szGetRestOfParams
export _UART_szGetRestOfParams
ENDIF

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; WARNING WARNING WARNING
; The following exports are for backwards compatibility only and should
; not be used for new designs. They may be eliminated in a future release.
; Their status is "NO FURTHER MAINTENANCE". 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
export  bUART_ReadTxStatus
export _bUART_ReadTxStatus
export  bUART_ReadRxData
export _bUART_ReadRxData
export  bUART_ReadRxStatus
export _bUART_ReadRxStatus
	
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;             END WARNING
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;-----------------------------------------------
; Variable Allocation
;-----------------------------------------------
IF (UART_RXBUF_ENABLE)
    
area UART_RAM (RAM, REL, CON)
    
 ptrParam:   BLK  1

ENDIF

area text (ROM,REL)

;-----------------------------------------------
;  EQUATES
;-----------------------------------------------
bfCONTROL_REG_START_BIT:        equ    1    ; Control register start bit
bfFUNCTION_REG_TX_INT_MODE_BIT: equ 0x10    ; the TX Int Mode bit

area UserModules (ROM, REL, CON)

;=============================================================================
;=============================================================================
;
;     Low-Level Commands
;
;=============================================================================
;=============================================================================

.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: UART_EnableInt
;
;  DESCRIPTION:
;     Enables this UART's interrupt by setting the interrupt enable mask
;     bit associated with this User Module. Remember to call the global
;     interrupt enable function 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.
;
 UART_EnableInt:
_UART_EnableInt:
   RAM_PROLOGUE RAM_USE_CLASS_1
   M8C_EnableIntMask UART_TX_INT_REG, UART_TX_INT_MASK
   M8C_EnableIntMask UART_RX_INT_REG, UART_RX_INT_MASK
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret
.ENDSECTION

    
.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: UART_DisableInt
;
;  DESCRIPTION:
;     Disables this UART'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.
;
 UART_DisableInt:
_UART_DisableInt:
   RAM_PROLOGUE RAM_USE_CLASS_1
   M8C_DisableIntMask UART_TX_INT_REG, UART_TX_INT_MASK
   M8C_DisableIntMask UART_RX_INT_REG, UART_RX_INT_MASK
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret
.ENDSECTION


.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: UART_SetTxIntMode(BYTE bTxIntMode)
;
;  DESCRIPTION:
;     Sets the Tx Interrupt Mode bit in the Function Register.
;-----------------------------------------------------------------------------
;
;  ARGUMENTS:
;     BYTE bTxIntMode - The TX Interrupt mode setting. Use defined masks.
;        Passed in the A register
;
;  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 TX interrupt mode bit to define whether the interrupt occurs
;     on TX register empty or TX transmit complete
;
 UART_SetTxIntMode:
_UART_SetTxIntMode:
   RAM_PROLOGUE RAM_USE_CLASS_1
   M8C_SetBank1
   and   A, UART_INT_MODE_TX_COMPLETE
   jz    .SetModeRegEmpty
   or    REG[UART_TX_FUNC_REG], bfFUNCTION_REG_TX_INT_MODE_BIT
   M8C_SetBank0
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret

.SetModeRegEmpty:
   and   REG[UART_TX_FUNC_REG], ~bfFUNCTION_REG_TX_INT_MODE_BIT
   M8C_SetBank0
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret
.ENDSECTION


.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: UART_Start(BYTE bParity)
;
;  DESCRIPTION:
;     Sets the start bit and parity in the Control register of this user module.
;-----------------------------------------------------------------------------
;
;  ARGUMENTS:
;     BYTE bParity - parity setting for the Transmitter and receiver. Use defined masks.
;        Passed in the A register.
;
;  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.
;
 UART_Start:
_UART_Start:
   RAM_PROLOGUE RAM_USE_CLASS_1
   ; Note, Proxy Class 4 only if receive buffer used; otherwise Proxy Class 1.

   or    A, bfCONTROL_REG_START_BIT
   mov   REG[UART_TX_CONTROL_REG], A
   mov   REG[UART_RX_CONTROL_REG], A
IF ( UART_RXBUF_ENABLE )
   call  _UART_CmdReset
ENDIF
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret
.ENDSECTION


.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: UART_Stop
;
;  DESCRIPTION:
;     Disables UART 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.
;
 UART_Stop:
_UART_Stop:
   RAM_PROLOGUE RAM_USE_CLASS_1
   and   REG[UART_TX_CONTROL_REG], ~bfCONTROL_REG_START_BIT
   and   REG[UART_RX_CONTROL_REG], ~bfCONTROL_REG_START_BIT
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret
.ENDSECTION


.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: UART_SendData
;
;  DESCRIPTION:
;     Initiates a transmission of data.
;-----------------------------------------------------------------------------
;
;  ARGUMENTS:
;     BYTE  TxData - data to transmit. PASSED in A register.
;
;  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.
;

⌨️ 快捷键说明

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