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

📄 davinci_evm.lst

📁 msp430板子红外驱动
💻 LST
📖 第 1 页 / 共 5 页
字号:
    248            TACTL = 0;                                // Stop Timer_A
   \                     ??setDCO_2:
   \   000096   82436001     MOV.W   #0x0, &0x160
    249            TACCTL2 = 0;
   \   00009A   82436601     MOV.W   #0x0, &0x166
    250            orig |= BCSCTL1 & DCO_RSEL_MASK;          // Save new RSEL setting
   \   00009E   5C425700     MOV.B   &0x57, R12
   \   0000A2   7CF00700     AND.B   #0x7, R12
   \   0000A6   4EDC         BIS.B   R12, R14
    251            BCSCTL1 = orig;                           // Restore with new RSEL values
   \   0000A8   C24E5700     MOV.B   R14, &0x57
    252          }
   \   0000AC   3041         RET
    253          
    254          
    255          //
    256          // Configure Port I/O Pins
    257          //

   \                                 In segment CODE, align 2
    258          void configPortPins(void)
   \                     configPortPins:
    259          {
    260          // MW  P1OUT &= ~0x02;                           // Set P1.1 output low
    261            P1OUT |= 0x02;                            // Set P1.1 output high (deassert DaVinci interrupt)
   \   000000   E2D32100     BIS.B   #0x2, &0x21
    262            P1DIR |=  0x02;                           // Set P1.1 as output
   \   000004   E2D32200     BIS.B   #0x2, &0x22
    263          
    264            P3OUT |=  0x81;                            // Disable SM CE
   \   000008   F2D081001900 BIS.B   #0x81, &0x19
    265            P3OUT &= ~0x08;                            // Disable CompactFlash power
   \   00000E   F2C21900     BIC.B   #0x8, &0x19
    266            P3DIR |=  0x89;                            // Set P3.7, P3.3,0 as outputs
   \   000012   F2D089001A00 BIS.B   #0x89, &0x1a
    267          
    268          #ifdef FET_BOARD
    269            P2OUT = 0;
    270            P3OUT = 0;
    271          
    272            P2DIR |=  0x1E;                           // Set P2.4,3,2,1 as outputs
    273            P3DIR |=  0xC0;                           // Set P3.7,6 as outputs
    274          
    275            P2OUT |=  0x08;                           // Set P2.3 high
    276            P2OUT &= ~0x10;                           // Set P2.4 low
    277          #endif
    278          }
   \   000018   3041         RET
    279          
    280          
    281          //
    282          //  System Initialization
    283          //

   \                                 In segment CODE, align 2
    284          void sysInit(void)
   \                     sysInit:
    285          {
    286            configPortPins();                         // Configure port I/O pins
   \   000000   B012....     CALL    #configPortPins
    287          
    288            setDCO();                                 // Set DCO frequency
   \   000004   B012....     CALL    #setDCO
    289          
    290            configTimerA();                           // Configure Timer_A
   \   000008   B012....     CALL    #configTimerA
    291          
    292            configIR();                               // Configure IR
   \   00000C   B012....     CALL    #configIR
    293          
    294            configUart0();                            // Configure UART0
   \   000010   B012....     CALL    #configUart0
    295          
    296            configI2C();                              // Configure I2C
   \   000014   B012....     CALL    #configI2C
    297          
    298            configWDT();                              // Configure Watchdog Timer
   \   000018   3040....     BR      #configWDT
    299          }
    300          
    301          
    302          //
    303          // Configure TimerA
    304          //

   \                                 In segment CODE, align 2
    305          void configTimerA(void)
   \                     configTimerA:
    306          {
    307            // Configure Timer_A
    308            TACTL = TASSEL0 + MC1 + TACLR;            // ACLK, continuous mode, clear
   \   000000   B24024016001 MOV.W   #0x124, &0x160
    309          }
   \   000006   3041         RET
    310          
    311          
    312          //
    313          // Configure USART0 for UART mode
    314          //

   \                                 In segment CODE, align 2
    315          void configUart0(void)
   \                     configUart0:
    316          {
    317            unsigned int rate;
    318          
    319            // Calculate Buad Rate Clock divider values
    320            rate = DCO_FREQ/UART_BAUD_RATE;
   \   000000   3E40FE02     MOV.W   #0x2fe, R14
    321          
    322            P3SEL |= 0x30;                            // P3.4,5 = UTXD0/URXD0
   \   000004   F2D030001B00 BIS.B   #0x30, &0x1b
    323            ME2 |= UTXE0 + URXE0;                     // Enable USART0 TXD/RXD
   \   00000A   F2D003000500 BIS.B   #0x3, &0x5
    324            U0CTL |= (CHAR + SWRST);                  // 8-bit char, reset
   \   000010   F2D011007000 BIS.B   #0x11, &0x70
    325            U0TCTL |= SSEL1;                          // BRCLK = SMCLK
   \   000016   F2D020007100 BIS.B   #0x20, &0x71
    326            U0BR0 = (unsigned char)(rate & 0xff);     // Lower 8 bits of BR clk divider
   \   00001C   4F4E         MOV.B   R14, R15
   \   00001E   C24F7400     MOV.B   R15, &0x74
    327            U0BR1 = (unsigned char)(rate >> 8);       // Upper 8 bits of BR clk divider
   \   000022   0F4E         MOV.W   R14, R15
   \   000024   8F10         SWPB    R15
   \   000026   3FF0FF00     AND.W   #0xff, R15
   \   00002A   C24F7500     MOV.B   R15, &0x75
    328            U0MCTL = 0;                               // Modulation
   \   00002E   C2437300     MOV.B   #0x0, &0x73
    329            U0CTL &= ~SWRST;                          // Initialize USART state machine
   \   000032   D2C37000     BIC.B   #0x1, &0x70
    330            IE2 |= URXIE0;                            // Enable USART0 RX interrupt
   \   000036   D2D30100     BIS.B   #0x1, &0x1
    331          }
   \   00003A   3041         RET
    332          
    333          
    334          //
    335          // Configure Watchdog Timer (WDT)
    336          //

   \                                 In segment CODE, align 2
    337          void configWDT(void)
   \                     configWDT:
    338          {
    339            WDTCTL = WDT_ADLY_250;                    // Clk source is ACLK,
   \   000000   B2401D5A2001 MOV.W   #0x5a1d, &0x120
    340                                                      // interval timer mode,
    341                                                      // clear, divide by 8192
    342          
    343            IE1 |= WDTIE;                             // Enable WDT interrupt
   \   000006   D2D30000     BIS.B   #0x1, &0x0
    344          }
   \   00000A   3041         RET
    345          
    346          
    347          //
    348          // Configure IR
    349          //

   \                                 In segment CODE, align 2
    350          void configIR(void)
   \                     configIR:
    351          {
    352            IR_DIR &= ~IR_PIN;                        // Set IR pin as input
   \   000000   E2C22200     BIC.B   #0x4, &0x22
    353            IR_SEL |=  IR_PIN;                        // Select IR pin as CCI1A
   \   000004   E2D22600     BIS.B   #0x4, &0x26
    354          
    355            resetIR();
   \   000008   3040....     BR      #resetIR
    356          }
    357          
    358          
    359          //
    360          // Reset IR
    361          //

   \                                 In segment CODE, align 2
    362          void resetIR(void)
   \                     resetIR:
    363          {
    364            IRData = 1;                               // Initialize IR receive data
   \   000000   9243....     MOV.W   #0x1, &IRData
    365            IRBit = 14;                               // 2 start bits + 12 data bits
   \   000004   F2400E00.... MOV.B   #0xe, &IRBit
    366          
    367            // Configure TA1 to capture first falling edge of IR data packet
    368            TACCTL1 = CAP + CM1 + SCS + CCIE;         // Capture mode,
   \   00000A   B24010896401 MOV.W   #0x8910, &0x164
    369                                                      // capture on falling edge,
    370                                                      // synchronous capture,
    371                                                      // enable TACCR1 CCIFG interrupts
    372          }
   \   000010   3041         RET
    373          
    374          
    375          //
    376          // Configure I2C
    377          //

   \                                 In segment CODE, align 2
    378          void configI2C(void)
   \                     configI2C:
    379          {
    380            initSWI2C();                              // Initialize SW I2C
   \   000000   B012....     CALL    #initSWI2C
    381          
    382            i2cIndex = 0;
   \   000004   C243....     MOV.B   #0x0, &i2cIndex
    383            regI2CCallBack(i2cReadMsg);               // Register callback function
   \   000008   3C40....     MOV.W   #i2cReadMsg, R12
   \   00000C   3040....     BR      #regI2CCallBack
    384          }
    385          
    386          
    387          #ifdef FET_UART_DEBUG
    388          
    389          //
    390          // UART Function - transmit null-terminated string
    391          //

   \                                 In segment CODE, align 2
    392          void txStr(const char* pStr)
   \                     txStr:
    393          {
    394            unsigned int cnt = 0;
   \   000000   0F43         MOV.W   #0x0, R15
    395          
    396            for(; *pStr; ++pStr)
   \                     ??txStr_1:
   \   000002   CC930000     CMP.B   #0x0, 0(R12)
   \   000006   1124         JEQ     ??txStr_2
    397            {
    398              while (!(IFG2 & UTXIFG0))               // USART0 TX buffer ready?
   \                     ??txStr_0:
   \   000008   E2B30300     BIT.B   #0x2, &0x3
   \   00000C   0A2C         JC      ??txStr_3
    399              {
    400                if( ++cnt == UART_TX_RETRY )
   \   00000E   1F53         ADD.W   #0x1, R15
   \   000010   3F9050C3     CMP.W   #0xc350, R15
   \   000014   0A24         JEQ     ??txStr_2
    401                {
    402                  return;
    403                }
    404          
    405                if( cnt > MaxCnt )
   \   000016   829F....     CMP.W   R15, &MaxCnt
   \   00001A   F62F         JC      ??txStr_0
    406                {
    407                  MaxCnt = cnt;
   \   00001C   824F....     MOV.W   R15, &MaxCnt
   \   000020   F33F         JMP     ??txStr_0
    408                }
    409              }
    410              TXBUF0 = *pStr;                         // Transmit character
   \                     ??txStr_3:
   \   000022   E24C7700     MOV.B   @R12, &0x77
    411            }
   \   000026   1C53         ADD.W   #0x1, R12
   \   000028   EC3F         JMP     ??txStr_1
   \                     ??txStr_2:
   \   00002A   3041         RET
    412          }
    413          
    414          
    415          //
    416          // UART Function - transmit byte as ASCII characters
    417          //

   \                                 In segment CODE, align 2
    418          void txByte(unsigned char byte)
   \                     txByte:
    419          {
   \   000000   2182         SUB.W   #0x4, SP
   \   000002   4E4C         MOV.B   R12, R14
    420            unsigned char x;
    421            char str[3];
    422          
    423            str[0] = byte >> 4;
   \   000004   4C4E         MOV.B   R14, R12
   \   000006   7CF3         AND.B   #0xff, R12
   \   000008   B012....     CALL    #?ShiftRight16u_4
   \   00000C   C14C0000     MOV.B   R12, 0x0(SP)
    424            str[1] = (byte & 0x0f);
   \   000010   4F4E         MOV.B   R14, R15

⌨️ 快捷键说明

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