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

📄 rx8_1.asm

📁 单片机控制122x32液晶。液晶内部芯片包含RAM(类似于显存)
💻 ASM
📖 第 1 页 / 共 2 页
字号:
;;*****************************************************************************
;;*****************************************************************************
;;  FILENAME: RX8_1.asm
;;   Version: 3.1, Updated on 2004/07/29 at 17:46:48
;;  Generated by PSoC Designer ver 4.2  b1013 : 02 September, 2004
;;
;;  DESCRIPTION: RX8 User Module software implementation file
;;               for 22/24/25/26/27xxx 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 MicroSystems 2000-2003. All Rights Reserved.
;;*****************************************************************************
;;*****************************************************************************

;-----------------------------------------------
; include instance specific register definitions
;-----------------------------------------------
include "m8c.inc"
include "memory.inc"
include "RX8_1.inc"


;-----------------------------------------------
;  Global Symbols
;-----------------------------------------------
export   RX8_1_EnableInt
export  _RX8_1_EnableInt
export   RX8_1_DisableInt
export  _RX8_1_DisableInt
export   RX8_1_Start
export  _RX8_1_Start
export   RX8_1_Stop
export  _RX8_1_Stop
export   RX8_1_bReadRxData
export  _RX8_1_bReadRxData
export   RX8_1_bReadRxStatus
export  _RX8_1_bReadRxStatus

; Old function name convension, do not use.
; These will be removed in a future release.
export  bRX8_1_ReadRxData
export _bRX8_1_ReadRxData
export  bRX8_1_ReadRxStatus
export _bRX8_1_ReadRxStatus

;-----------------------------------------------
; High Level RX functions
;-----------------------------------------------

export  RX8_1_cGetChar
export _RX8_1_cGetChar
export  RX8_1_cReadChar
export _RX8_1_cReadChar
export  RX8_1_iReadChar
export _RX8_1_iReadChar

IF (RX8_1_RXBUF_ENABLE)
export  RX8_1_CmdReset
export _RX8_1_CmdReset
export  RX8_1_bCmdCheck
export _RX8_1_bCmdCheck
export  RX8_1_bCmdLength
export _RX8_1_bCmdLength
export  RX8_1_bErrCheck
export _RX8_1_bErrCheck

export  RX8_1_szGetParam
export _RX8_1_szGetParam
export  RX8_1_szGetRestOfParams
export _RX8_1_szGetRestOfParams

;-----------------------------------------------
;  Variables
;-----------------------------------------------

AREA RX8_1_RAM(RAM,REL,CON)
 ptrParam:   			BLK  1

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

area UserModules (ROM, REL)

.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: RX8_1_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:
;    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.
;
 RX8_1_EnableInt:
_RX8_1_EnableInt:
   RAM_PROLOGUE RAM_USE_CLASS_1
   M8C_EnableIntMask RX8_1_INT_REG, RX8_1_bINT_MASK
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret
.ENDSECTION

.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: RX8_1_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:
;    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.
;
 RX8_1_DisableInt:
_RX8_1_DisableInt:
   RAM_PROLOGUE RAM_USE_CLASS_1
   M8C_DisableIntMask RX8_1_INT_REG, RX8_1_bINT_MASK
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret
.ENDSECTION

.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: RX8_1_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:
;    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.
;
 RX8_1_Start:
_RX8_1_Start:
   RAM_PROLOGUE RAM_USE_CLASS_1
   or    A, bfCONTROL_REG_START_BIT
   mov   REG[RX8_1_CONTROL_REG], A
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret
.ENDSECTION

.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: RX8_1_Stop
;
;  DESCRIPTION:
;     Disables RX8 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.
;
 RX8_1_Stop:
_RX8_1_Stop:
   RAM_PROLOGUE RAM_USE_CLASS_1
   and   REG[RX8_1_CONTROL_REG], ~bfCONTROL_REG_START_BIT
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret
.ENDSECTION

.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: RX8_1_bReadRxData
;
;  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:
;    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.
;
 RX8_1_bReadRxData:
_RX8_1_bReadRxData:
 bRX8_1_ReadRxData:
_bRX8_1_ReadRxData:
   RAM_PROLOGUE RAM_USE_CLASS_1
   mov A, REG[RX8_1_RX_BUFFER_REG]
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret
.ENDSECTION

.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: RX8_1_bReadRxStatus
;
;  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
;
;  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.
;
 RX8_1_bReadRxStatus:
_RX8_1_bReadRxStatus:
 bRX8_1_ReadRxStatus:
_bRX8_1_ReadRxStatus:
   RAM_PROLOGUE RAM_USE_CLASS_1
   mov A,  REG[RX8_1_CONTROL_REG]
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret
.ENDSECTION

;-----------------------------------------------
; High Level RX functions
;-----------------------------------------------

.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: RX8_1_cGetChar
;
;  DESCRIPTION:
;     Read character from UART RX port.
;
;
;  ARGUMENTS:
;      none
;
;  RETURNS:
;     char that is returned from UART
;
;  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.
;    
;    Program flow will stay in this function until a character is received.
;    If the watchdog timer is used, care must be taken to make sure that
;    the delay between characters is less than the watchdog timeout.
;
 RX8_1_cGetChar:
_RX8_1_cGetChar:
   RAM_PROLOGUE RAM_USE_CLASS_1

.getChar_Loop:
   tst REG[RX8_1_CONTROL_REG],RX8_1_RX_REG_FULL  ; Check if a character is ready
   jz  .getChar_Loop                                        ; If not loop

   mov A, REG[RX8_1_RX_BUFFER_REG]               ; Get character
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret
.ENDSECTION

.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: RX8_1_cReadChar
;
;  DESCRIPTION:
;     Read character from UART RX port.
;
;  ARGUMENTS:
;      none
;
;  RETURNS:
;     char that is returned from UART
;
;  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.
;
;    A valid 0x00 character will be ignored, since a 0x00 return value
;    implies a valid character or an error condition occured.
;
 RX8_1_cReadChar:
_RX8_1_cReadChar:
   RAM_PROLOGUE RAM_USE_CLASS_1

   mov  A,REG[RX8_1_CONTROL_REG]                           ; Get Status of RX
   push A
   and  A,RX8_1_RX_COMPLETE                                ; Check if a character is ready
   jnz  .RX_DATA_RDY                                       ; Data Ready go read it.
   pop  A
   jmp  .RX_NO_VALID_CHAR

.RX_DATA_RDY:
   mov  A,REG[RX8_1_RX_BUFFER_REG]                         ; Read data first, then
   swap A,X                                                ; determine if data is valid

   pop  A                                                  ; Check for errors
   and  A,(RX8_1_RX_PARITY_ERROR | RX8_1_RX_FRAMING_ERROR)
   jnz  .RX_NO_VALID_CHAR                                  ; No character, exit
   swap A,X                                                ; Put data in A and exit
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret

.RX_NO_VALID_CHAR:
   mov A,0x00                                              ; Zero out character

 End_RX8_1_cReadChar:
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret
.ENDSECTION
																			
.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: RX8_1_iReadChar
;
; WARNING WARNING WARNING  Negative return value not correct!!!!  We may want
; to just set a value in the upper byte if error conditions exists.
;

⌨️ 快捷键说明

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