📄 rx_232.asm
字号:
;------------------------------------------------------------------------------
; FILENAME: Rx_232.asm
; VERSION: Rev B, 2002 Mar 30
;------------------------------------------------------------------------------
; DESCRIPTION:
; Rx_232 RX8 User Module API.
;------------------------------------------------------------------------------
; Copyright (c) Cypress MicroSystems 2000-2002. All Rights Reserved.
;------------------------------------------------------------------------------
;-----------------------------------------------
; include instance specific register definitions
;-----------------------------------------------
include "m8c.inc"
include "Rx_232.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 Rx_232_EnableInt
export _Rx_232_EnableInt
export Rx_232_DisableInt
export _Rx_232_DisableInt
export Rx_232_Start
export _Rx_232_Start
export Rx_232_Stop
export _Rx_232_Stop
export bRx_232_ReadRxData
export _bRx_232_ReadRxData
export bRx_232_ReadRxStatus
export _bRx_232_ReadRxStatus
;-----------
; EQUATES
;-----------
bfCONTROL_REG_START_BIT: equ 1 ; Control register start bit
;-----------------------------------------------------------------------------
; FUNCTION NAME: Rx_232_EnableInt
;
; DESCRIPTION:
; Enables this receiver'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.
;
;-----------------------------------------------------------------------------
Rx_232_EnableInt:
_Rx_232_EnableInt:
M8C_EnableIntMask Rx_232_INT_REG, bRx_232_INT_MASK
ret
;-----------------------------------------------------------------------------
; FUNCTION NAME: Rx_232_DisableInt
;
; DESCRIPTION:
; Disables this RX8'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.
;
;-----------------------------------------------------------------------------
Rx_232_DisableInt:
_Rx_232_DisableInt:
M8C_DisableIntMask Rx_232_INT_REG, bRx_232_INT_MASK
ret
;-----------------------------------------------------------------------------
; FUNCTION NAME: Rx_232_Start(BYTE bParity)
;
; DESCRIPTION:
; Sets the start bit and parity in the Control register of this user module.
;
; ARGUMENTS:
; BYTE bParity - parity of received data. Use defined masks.
; passed in A register.
;
; RETURNS:
; none.
;
; SIDE EFFECTS:
; none.
;
; THEORY of OPERATION:
; Set the specified parity and start bits in the Control register.
;
;-----------------------------------------------------------------------------
Rx_232_Start:
_Rx_232_Start:
or A, bfCONTROL_REG_START_BIT
mov REG[Rx_232_CONTROL_REG], A
ret
;-----------------------------------------------------------------------------
; FUNCTION NAME: Rx_232_Stop
;
; DESCRIPTION:
; Disables RX8 operation.
;
; ARGUMENTS:
; none.
;
; RETURNS:
; none.
;
; SIDE EFFECTS:
; none.
;
; THEORY of OPERATION:
; Clear the start bit in the Control register.
;
;-----------------------------------------------------------------------------
Rx_232_Stop:
_Rx_232_Stop:
and REG[Rx_232_CONTROL_REG], ~bfCONTROL_REG_START_BIT
ret
;-----------------------------------------------------------------------------
; FUNCTION NAME: bRx_232_ReadRxData
;
; DESCRIPTION:
; Reads the RX buffer register. Should check the status regiser to make
; sure data is valid.
;
; ARGUMENTS:
; none.
;
; RETURNS:
; bRxData - returned in A.
;
; SIDE EFFECTS:
; none.
;
; THEORY of OPERATION:
; none.
;
;-----------------------------------------------------------------------------
bRx_232_ReadRxData:
_bRx_232_ReadRxData:
mov A, REG[Rx_232_RX_BUFFER_REG]
ret
;-----------------------------------------------------------------------------
; FUNCTION NAME: bRx_232_ReadRxStatus
;
; DESCRIPTION:
; Reads the RX Status bits in the Control/Status register.
;
; ARGUMENTS:
; none.
;
; RETURNS:
; BYTE bRXStatus - transmit status data. Use the following defined bits
; masks: RX_COMPLETE and RX_BUFFER_EMPTY
; returned in A.
;
; SIDE EFFECTS:
; none.
;
; THEORY of OPERATION:
; Read the status and control register.
;
;-----------------------------------------------------------------------------
bRx_232_ReadRxStatus:
_bRx_232_ReadRxStatus:
mov A, REG[Rx_232_CONTROL_REG]
ret
; end of RX8 API code
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -