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

📄 供暖控制_无线设备_v10.s43

📁 用MSP430汇编写的简单IP协议程序
💻 S43
📖 第 1 页 / 共 5 页
字号:
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        BIT.B   R15,&P1IN
        JC      WaitForRightClock
        JMP     NeedToResearchTraining           
        
WaitForRightClock
        MOV     #15,&TBR                      ;4 cycles,here have had high level,write to TBR to backoff the time 
        BIS     #MC0,&TBCTL                   ;which used for executing instructions,5 cycles 
        MOV     #FindNextGoodF0Training,&SPIReceiveEntrance   ;set next receive entrance
        RETI
        
FindNextGoodF0Training
        CMP.B   #0F0H,R15                          ;2 cycles,if this receive is F0h?
        JZ      IsGoodF0                           ;2 cycles,yes,is a good 10b
        INC     &ErrorF0Counter                    ;4 cycles,no,error counter+1
        CLR     &EdgeCounter                       ;clr edge counter
        CMP     #5,&ErrorF0Counter                 ;5 cycles,if have received more than 5 error bits?  
        JLO     IsNotGoodF0Bit                     ;2 cycles,no,to judge this receive and wait for high level
        JMP     NeedToResearchTraining1            ;have received more than 5 error,new begin
IsGoodF0
        INCD    &EdgeCounter                       ;4 cycles,this receive is right,edge counter+1
        CLR     &ErrorF0Counter                    ;4 cycles,error counter clr to zero
        CMP     #8,&EdgeCounter                    ;5 cycles,if have received 8 good 10b?
        JHS     FindGoodTraining                   ;2 cycles,yes,regard as have received good training
        MOV     #FindNextGoodF0Training,&SPIReceiveEntrance    ;5 cycles,no,prepare to receive next 10b
        RETI
        
FindGoodTraining
        CALL    #send_mode1_control_C_Hold         ;have received good training,TRF6900 hold
        MOV     #SearchForStartBit1,&SPIReceiveEntrance   ;begin to receive startbits
        RETI
;-----------------------------------------------------------        
SearchForStartBit1
        BIC.B   #00010000b,R15
        BIS.B   #00001000b,R15
        CMP.B   #0FH,R15                           ;if this receive is 0fh?
        JNZ     IsTrainingToo                      ;no,regard this is a training too
        MOV     #SearchForStartBit2,&SPIReceiveEntrance     ;yes,have receive startbit1,prepare to receive startbit2
        RETI
       
IsTrainingToo
        INCD    &EdgeCounter                       ;this receive is training too,edge counter+1
        CMP     #100,&EdgeCounter                  ;if training number is more than 100
        JHS     NeedToResearchTraining             ;yes,is not training,new begin
        MOV     #SearchForStartBit1,&SPIReceiveEntrance ;no,continue to search for startbit1
        RETI
        
SearchForStartBit2
        CMP.B   #0FFH,R15                         ;if this receive is 11b?
        JNZ     NeedToResearchTraining            ;no,new begin
        MOV     #SearchForStartBit3,&SPIReceiveEntrance   ;yes,prepare to find startbit3
        RETI
        
SearchForStartBit3
        BIS.B   #00010000b,R15
        BIC.B   #00001001b,R15
        CMP.B   #0F0H,R15                         ;if this receive is F0h?
        JNZ     NeedToResearchTraining            ;no,new begin
        MOV     #SearchForStartBit4,&SPIReceiveEntrance     ;yes,prepare to receive startbit4
        RETI
        
SearchForStartBit4
        BIS.B   #10000001b,R15                      ;2 cycles
        CMP.B   #0FFH,R15                           ;1 cycle,if this receive is FFh
        JNZ     NeedToResearchTraining              ;2 cycles,no ,new begin
        MOV     #0,&ByteLength                      ;4 cycles,yes,prepare to receive data
        MOV     #1,&ByteLength                      

        BIC     #MC0,&TBCTL                         ;5 cycles,stop TB                         
        BIS     #ID1,&TBCTL                         ;5 cycles,open TB                                                    ;5 Cycles,set TB frequency division is 4
        MOV     #Start_TBR_Value,&TBR               ;4 cycles,write to TBR to backoff executing instruction time
        BIS     #MC0,&TBCTL                         ;5 cycles,open TB
        MOV     #SPIReceiveLengthHigh,&SPIReceiveEntrance  ;begin to receive data
        CLR     &EdgeCounter
        CLR     &ErrorF0Counter
        CLR     &DeCRCOutput
        RETI       
;--------------------------------------------------------
SPIReceiveLengthHigh 
        MOV.B   R15,&PHYToMACLenghthHigh 
        MOV.B   R15,&RFReceiveLengthHigh
        CALL    #OneByteCRC
        MOV     #SPIReceiveLengthLow,&SPIReceiveEntrance 
        RETI
;--------------------------------------------------------        
SPIReceiveLengthLow
        MOV.B   R15,&PHYToMACLenghthLow 
        MOV.B   R15,&RFReceiveLengthLow
        CALL    #OneByteCRC
        CMP     #119,&PHYToMACLenghth
        JLO     GoodSPIReceiveLength
BadSPIReceiveLength
        MOV     #25,&PHYToMACLenghth
        MOV     #HearSomeoneRF,&SPIReceiveEntrance
        RETI       
GoodSPIReceiveLength           
        MOV     #SPIReceiveControlHigh,&SPIReceiveEntrance
        RETI
;---------------------------------------------------------
SPIReceiveControlHigh
        MOV.B   R15,&PHYToMACFrameControlHgh
        CALL    #OneByteCRC
        MOV     #SPIReceiveControlLow,&SPIReceiveEntrance
        RETI
;---------------------------------------------------------
SPIReceiveControlLow
        MOV.B   R15,&PHYToMACFrameControlLow
        CALL    #OneByteCRC
        MOV     #SPIReceiveDurationHigh,&SPIReceiveEntrance
        RETI
;----------------------------------------------------------
SPIReceiveDurationHigh
        MOV.B   R15,&PHYToMACDurationHigh 
        CALL    #OneByteCRC
        MOV     #SPIReceiveDurationLow,&SPIReceiveEntrance
        RETI
;----------------------------------------------------------
SPIReceiveDurationLow
        MOV.B   R15,&PHYToMACDurationLow
        CALL    #OneByteCRC
        MOV     &PHYToMACFrameControl,R15
        AND     #FrameTypeMask,R15
        CMP     #DataFrameMask,R15
        JZ      IsADataFrame
        MOV     #InformationFrame,&SPIReceiveEntrance     
        RETI
IsADataFrame
        MOV     &PHYToMACDuration,R15
        CMP     #7041,R15
        JL      IsGoodDelayLenghth1
        MOV     #7040,R15
IsGoodDelayLenghth1    
        RRA     R15
        RRA     R15                            ;时间重新计算
        RRA     R15
        RRA     R15
        MOV     R15,&TACCR0Number
        BIS     #RFCannotSend
        MOV     #AboutRFSend,&TACCTL0Entrance
        BIC     #MC1,&TACTL
        MOV     &TAR,&CCR0
        BIS     #MC1,&TACTL
        ADD     #5120,&CCR0
        MOV     #CCIE,&CCTL0 
        clr     &dyingdying                    ;自恢复
        MOV     #SPIReceiveSequenceHigh,&SPIReceiveEntrance     
        RETI
;-----------------------------------------------------------     
SPIReceiveSequenceHigh                       
        MOV.B   R15,&PHYToMACSequenceHigh
        CALL    #OneByteCRC
        MOV     #SPIReceiveSequenceLow,&SPIReceiveEntrance
        RETI
;-----------------------------------------------------------     
SPIReceiveSequenceLow
        MOV.B   R15,&PHYToMACSequenceLow
        CALL    #OneByteCRC
        MOV     #SPIReceiveHeaderCRCHigh,&SPIReceiveEntrance
        RETI
;-----------------------------------------------------------     
SPIReceiveHeaderCRCHigh
        MOV.B   R15,&PHYToMACHeaderCRCHigh
        CALL    #OneByteCRC
        MOV     #SPIReceiveHeaderCRCLow,&SPIReceiveEntrance
        RETI
;-----------------------------------------------------------     
SPIReceiveHeaderCRCLow
        MOV.B   R15,&PHYToMACHeaderCRCLow
        CALL    #OneByteCRC
        CMP     #0,&DeCRCOutput
  

⌨️ 快捷键说明

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