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

📄 tx8_1.asm

📁 Application Note Abstract This Application Note introduces a complete and detailed PSoC&reg project
💻 ASM
字号:
;------------------------------------------------------------------------------
;  FILENAME:   TX8_1.asm
;   VERSION:   Rev B, 2002 May 24
;------------------------------------------------------------------------------
;  DESCRIPTION:
;     TX8_1 TX8 User Module API.
;------------------------------------------------------------------------------
;	Copyright (c) Cypress MicroSystems 2000-2002. All Rights Reserved.
;------------------------------------------------------------------------------

;-----------------------------------------------
; include instance specific register definitions
;-----------------------------------------------
include "m8c.inc"
include "TX8_1.inc"

area text (ROM, REL)

;-------------------------------------------------------------------
;  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   TX8_1_EnableInt
export  _TX8_1_EnableInt
export   TX8_1_DisableInt
export  _TX8_1_DisableInt
export   TX8_1_Start
export  _TX8_1_Start
export   TX8_1_Stop
export  _TX8_1_Stop
export   TX8_1_SendData
export  _TX8_1_SendData
export   bTX8_1_ReadTxStatus
export  _bTX8_1_ReadTxStatus

;-----------
;  EQUATES
;-----------
bfCONTROL_REG_START_BIT:   equ   1     ; Control register start bit 

;-----------------------------------------------------------------------------
;  FUNCTION NAME: TX8_1_EnableInt
;
;  DESCRIPTION:
;     Enables this Transmitter'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:
;     none.
;
;  THEORY of OPERATION:  
;     Sets the specific user module interrupt enable mask bit.
;
;-----------------------------------------------------------------------------
 TX8_1_EnableInt:
_TX8_1_EnableInt:
   M8C_EnableIntMask  TX8_1_INT_REG, bTX8_1_INT_MASK
   ret	

	
;-----------------------------------------------------------------------------
;  FUNCTION NAME: TX8_1_DisableInt
;
;  DESCRIPTION:
;     Disables this TX8's interrupt by clearing the interrupt enable mask bit
;     associated with this User Module. 
;
;  ARGUMENTS:
;     none.
;
;  RETURNS:
;     none.
;
;  SIDE EFFECTS:
;     none.
;
;  THEORY of OPERATION:  
;     Clears the specific user module interrupt enable mask bit.
;
;-----------------------------------------------------------------------------
 TX8_1_DisableInt:
_TX8_1_DisableInt:
   M8C_DisableIntMask TX8_1_INT_REG, bTX8_1_INT_MASK
   ret


;-----------------------------------------------------------------------------
;  FUNCTION NAME: TX8_1_Start(BYTE bParity)
;
;  DESCRIPTION:
;     Sets the start bit and parity in the Control register of this user module. 
;     The transmitter will begin transmitting if a byte has been written into the
;     transmit buffer.
;
;  ARGUMENTS:
;     BYTE bParity - parity of transmitted data.  Use defined masks.
;
;  RETURNS:
;     none.
;
;  SIDE EFFECTS:
;     none.
;
;  THEORY of OPERATION:  
;     Set the specified parity and start bits in the Control register.
;
;-----------------------------------------------------------------------------
 TX8_1_Start:
_TX8_1_Start:
   or    A, bfCONTROL_REG_START_BIT
   mov   REG[TX8_1_CONTROL_REG], A
   ret	


;-----------------------------------------------------------------------------
;  FUNCTION NAME: TX8_1_Stop
;
;  DESCRIPTION:
;     Disables TX8 operation.
;
;  ARGUMENTS:
;     none.
;
;  RETURNS:
;     none.
;
;  SIDE EFFECTS:
;     none.
;
;  THEORY of OPERATION:  
;     Clear the start bit in the Control register.
;
;-----------------------------------------------------------------------------
 TX8_1_Stop:
_TX8_1_Stop:
   and   REG[TX8_1_CONTROL_REG], ~bfCONTROL_REG_START_BIT
   ret	


;-----------------------------------------------------------------------------
;  FUNCTION NAME: TX8_1_SendData
;
;  DESCRIPTION:
;     Disables TX8 operation.
;
;  ARGUMENTS:
;     BYTE  TxData - data to transmit.
;
;  RETURNS:
;     none.
;
;  SIDE EFFECTS:
;     none.
;
;  THEORY of OPERATION:  
;     Writes data to the TX buffer register.
;
;-----------------------------------------------------------------------------
 TX8_1_SendData:
_TX8_1_SendData:
	mov REG[TX8_1_TX_BUFFER_REG], A
	ret


;-----------------------------------------------------------------------------
;  FUNCTION NAME: bTX8_1_ReadTxStatus
;
;  DESCRIPTION:
;     Reads the Tx Status bits in the Control/Status register.
;
;  ARGUMENTS:
;     none.
;
;  RETURNS:
;     BYTE  bTxStatus - transmit status data.  Use the following defined bits 
;                       masks: TX_COMPLETE and TX_BUFFER_EMPTY
;
;  SIDE EFFECTS:
;     none.
;
;  THEORY of OPERATION:  
;     Read the status and control register.
;
;-----------------------------------------------------------------------------
 bTX8_1_ReadTxStatus:
_bTX8_1_ReadTxStatus:
	mov A,  REG[TX8_1_CONTROL_REG]
	ret
   

;	end of TX8 API code

⌨️ 快捷键说明

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