📄 tx_serial.asm
字号:
;;*****************************************************************************
;;*****************************************************************************
;; FILENAME: TX_SERIAL.asm
;; Version: 2.2, Updated on 2003/11/18 at 15:02:31
;; Generated by PSoC Designer ver 4.1 BETA b923 : 11 December, 2003
;;
;; DESCRIPTION: TX8 User Module software implementation file
;; for 22/24/25/26/27xxx PSoc family of devices.
;;
;; 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 2000-2003. All Rights Reserved.
;;*****************************************************************************
;;*****************************************************************************
;-----------------------------------------------
; include instance specific register definitions
;-----------------------------------------------
include "m8c.inc"
include "TX_SERIAL.inc"
area UserModules (ROM, REL)
;-----------------------------------------------
; Global Symbols
;-----------------------------------------------
export TX_SERIAL_EnableInt
export _TX_SERIAL_EnableInt
export TX_SERIAL_DisableInt
export _TX_SERIAL_DisableInt
export TX_SERIAL_Start
export _TX_SERIAL_Start
export TX_SERIAL_Stop
export _TX_SERIAL_Stop
export TX_SERIAL_SendData
export _TX_SERIAL_SendData
export TX_SERIAL_bReadTxStatus
export _TX_SERIAL_bReadTxStatus
// Old labels, will be removed in future release
// Do Not Use.
export bTX_SERIAL_ReadTxStatus
export _bTX_SERIAL_ReadTxStatus
;-----------------------------------------------
; EQUATES
;-----------------------------------------------
bfCONTROL_REG_START_BIT: equ 1 ; Control register start bit
AREA UserModules (ROM, REL)
.SECTION
;-----------------------------------------------------------------------------
; FUNCTION NAME: TX_SERIAL_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:
; REGISTERS ARE VOLATILE: A AND X REGISTERS MAY BE MODIFIED!
;
; THEORY of OPERATION or PROCEDURE:
; Sets the specific user module interrupt enable mask bit.
;
;-----------------------------------------------------------------------------
TX_SERIAL_EnableInt:
_TX_SERIAL_EnableInt:
M8C_EnableIntMask TX_SERIAL_INT_REG, TX_SERIAL_bINT_MASK
ret
.ENDSECTION
.SECTION
;-----------------------------------------------------------------------------
; FUNCTION NAME: TX_SERIAL_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:
; REGISTERS ARE VOLATILE: A AND X REGISTERS MAY BE MODIFIED!
;
; THEORY of OPERATION or PROCEDURE:
; Clears the specific user module interrupt enable mask bit.
;
;-----------------------------------------------------------------------------
TX_SERIAL_DisableInt:
_TX_SERIAL_DisableInt:
M8C_DisableIntMask TX_SERIAL_INT_REG, TX_SERIAL_bINT_MASK
ret
.ENDSECTION
.SECTION
;-----------------------------------------------------------------------------
; FUNCTION NAME: TX_SERIAL_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:
; REGISTERS ARE VOLATILE: A AND X REGISTERS MAY BE MODIFIED!
;
; THEORY of OPERATION or PROCEDURE:
; Set the specified parity and start bits in the Control register.
;
;-----------------------------------------------------------------------------
TX_SERIAL_Start:
_TX_SERIAL_Start:
or A, bfCONTROL_REG_START_BIT
mov REG[TX_SERIAL_CONTROL_REG], A
ret
.ENDSECTION
.SECTION
;-----------------------------------------------------------------------------
; FUNCTION NAME: TX_SERIAL_Stop
;
; DESCRIPTION:
; Disables TX8 operation.
;
;-----------------------------------------------------------------------------
;
; ARGUMENTS: none
;
; RETURNS: none
;
; SIDE EFFECTS:
; REGISTERS ARE VOLATILE: A AND X REGISTERS MAY BE MODIFIED!
;
; THEORY of OPERATION or PROCEDURE:
; Clear the start bit in the Control register.
;
;-----------------------------------------------------------------------------
TX_SERIAL_Stop:
_TX_SERIAL_Stop:
and REG[TX_SERIAL_CONTROL_REG], ~bfCONTROL_REG_START_BIT
ret
.ENDSECTION
.SECTION
;-----------------------------------------------------------------------------
; FUNCTION NAME: TX_SERIAL_SendData
;
; DESCRIPTION:
; Sends one byte through serial port.
;
;-----------------------------------------------------------------------------
;
; ARGUMENTS:
; BYTE TxData - data to transmit.
;
; RETURNS:
;
; SIDE EFFECTS:
; REGISTERS ARE VOLATILE: A AND X REGISTERS MAY BE MODIFIED!
;
;-----------------------------------------------------------------------------
TX_SERIAL_SendData:
_TX_SERIAL_SendData:
mov REG[TX_SERIAL_TX_BUFFER_REG], A
ret
.ENDSECTION
.SECTION
;-----------------------------------------------------------------------------
; FUNCTION NAME: TX_SERIAL_bReadTxStatus
;
; DESCRIPTION:
; Reads the Tx Status bits in the Control/Status register.
;
;-----------------------------------------------------------------------------
;
; ARGUMENTS:
;
; RETURNS:
; BYTE bTxStatus - transmit status data. Use the following defined bits
; masks: TX_COMPLETE and TX_BUFFER_EMPTY
;
; SIDE EFFECTS:
; REGISTERS ARE VOLATILE: A AND X REGISTERS MAY BE MODIFIED!
;
; THEORY of OPERATION or PROCEDURE:
; Read the status and control register.
;
;-----------------------------------------------------------------------------
TX_SERIAL_bReadTxStatus:
_TX_SERIAL_bReadTxStatus:
bTX_SERIAL_ReadTxStatus:
_bTX_SERIAL_ReadTxStatus:
mov A, REG[TX_SERIAL_CONTROL_REG]
ret
.ENDSECTION
; End of File TX_SERIAL.asm
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -