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

📄 sci_ascii.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
                BSR     SendAscii

                DBNZX   SCI_Next

                LDA     #$0A
                BSR     SciChrOut                       ;Add an EOL char.
                LDA     #$0D
                BSR     SciChrOut
                RTS


SciChrOut:      BRCLR   7,SCS1,*                        ;Wait until SCTE clear
                STA     SCDR                            ;Send the data byte out the SCI.
                RTS


SendAscii:      PSHA
                LSRA
                LSRA
                LSRA
                LSRA                                    ;Get high nybble.
                ADD     #$30                            ;Convert to ASCII.
                CMP     #$39
                BLS     D0to9a
                ADD     #$07
D0to9a:         BSR     SciChrOut

                PULA
                AND     #$0F                            ;Get low nybble.
                ADD     #$30                            ;Converto to ASCII.
                CMP     #$39
                BLS     D0to9b
                ADD     #$07
D0to9b:         BSR     SciChrOut
                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:
Rec_Done:       RTS

⌨️ 快捷键说明

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