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

📄 sci.asm

📁 胎压检测系统接收部分源码
💻 ASM
字号:
* SCI.asm

**********************************************************************
* Contains the SCI control software.                                 *
**********************************************************************

**********************************************************************
* SCI_Send                                                           *
* Sends the data stored in DATA through the SCI.  Recall that the    *
* data there is reversed, so it is sent last byte first.             *
**********************************************************************
SCI_Send:       CLRH

                LDX     #NB_DATA                        ;Reset index register
SCI_Next:       LDA     DATA-1,X                        ;Get data to transmit
                BRCLR   7,SCS1,*                        ;Wait until SCTE clear
                STA     SCDR                            ;Send the data byte out the SCI.
                DBNZX   SCI_Next

                RTS

**********************************************************************
* SCI_Rec                                                            *
* Receive the data sent in through the SCI.  The SCI input is used   *
* to change the low pressure threshold, and the tire IDs, which are  *
* to be sent in binary (not ASCII).                                  *
* First, it checks to see if a byte is there.                        *
* If it is there, it takes that as the threshold and sends an ack-   *
* nowledement byte.                                                  *
* It then receives four bytes which it takes as the new tire IDs.    *
* Order: LF, RF, LR, RR                                              *
**********************************************************************
SCI_Rec:        CLRH
                BRCLR   5,SCS1,Rec_Done                 ;Check if data in SCDR.
                LDA     SCDR
                STA     THRESHOLD                       ;Load the new threshold.

                BRCLR   7,SCS1,*
                STA     SCDR                            ;Send some junk back to the SCI (handshake)

                MOV     #!16,TEMP
                LDHX    #LFID                           ;The 4-byte ID for all 4 tires will be
NEXT_ID:        BRCLR   5,SCS1,*                        ;sequential starting with LFID.
                LDA     SCDR
                STA     ,X
                INCX
                DBNZ    TEMP,NEXT_ID

                JSR     Wrflash                         ;Burn the new threshold and IDs into
                                                        ;Flash NVM.
                JSR     BlinkLEDs
Rec_Done:       RTS

⌨️ 快捷键说明

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