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

📄 rf04dev.lst

📁 zigbee location examples
💻 LST
📖 第 1 页 / 共 2 页
字号:
##############################################################################
#                                                                            #
# IAR 8051 C/C++ Compiler V7.20H/W32                   16/Jan/2007  15:30:16 #
# Copyright 2004-2006 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Core               =  plain                                             #
#    Code model         =  banked                                            #
#    Data model         =  large                                             #
#    Calling convention =  xdata reentrant                                   #
#    Constant location  =  data                                              #
#    Dptr setup         =  1,16                                              #
#    Source file        =  E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_Engi #
#                          ne\lib\hal\CC2430\RF04Dev.c                       #
#    Command line       =  -I "C:\Program Files\IAR Systems\Embedded         #
#                          Workbench 4.05 Evaluation version\8051\INC\" -I   #
#                          "C:\Program Files\IAR Systems\Embedded Workbench  #
#                          4.05 Evaluation version\8051\SRC\LIB\" -I         #
#                          "C:\Program Files\IAR Systems\Embedded Workbench  #
#                          4.05 Evaluation version\8051\INC\CLIB\" -I        #
#                          E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_Engi #
#                          ne\Test\mac\mac_loc\..\..\..\include\ -I          #
#                          E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_Engi #
#                          ne\Test\mac\mac_loc\..\..\..\include\mac\cc2430\  #
#                          -I E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_E #
#                          ngine\Test\mac\mac_loc\..\..\..\include\hal\cc243 #
#                          0\ -I E:\公司产品资料\Zigbee\cc2431\cc2431定位\LO #
#                          C_Engine\Test\mac\mac_loc\..\..\..\apps\ -D       #
#                          CC2430EB -D USE_LED -lCN                          #
#                          E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_Engi #
#                          ne\Test\mac\mac_loc\CC2430EB\List\ -lA            #
#                          E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_Engi #
#                          ne\Test\mac\mac_loc\CC2430EB\List\ -o             #
#                          E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_Engi #
#                          ne\Test\mac\mac_loc\CC2430EB\Obj\ -e -s9 --debug  #
#                          --core=plain --dptr=16,1 --data_model=large       #
#                          --code_model=banked --calling_convention=xdata_re #
#                          entrant --place_constants=data --nr_virtual_regs  #
#                          8 E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_En #
#                          gine\lib\hal\CC2430\RF04Dev.c                     #
#    List file          =  E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_Engi #
#                          ne\Test\mac\mac_loc\CC2430EB\List\RF04Dev.lst     #
#    Object file        =  E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_Engi #
#                          ne\Test\mac\mac_loc\CC2430EB\Obj\RF04Dev.r51      #
#                                                                            #
#                                                                            #
##############################################################################

E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_Engine\lib\hal\CC2430\RF04Dev.c
      1          /******************************************************************************
      2          *                                                                             *
      3          *        **********                                                           *
      4          *       ************                                                          *
      5          *      ***        ***                                                         *
      6          *     ***    ++    ***                                                        *
      7          *     ***   +  +   ***                      CHIPCON                           *
      8          *     ***   +                                                                 *
      9          *     ***   +  +   ***                                                        *
     10          *     ***    ++    ***                                                        *
     11          *      ***        ***                                                         *
     12          *       ************                                                          *
     13          *        **********                                                           *
     14          *                                                                             *
     15          *******************************************************************************
     16          
     17          Filename:     RF04Dev.c
     18          Target:       cc2430
     19          Author:       KJA
     20          Revised:      16/1-2006
     21          Revision:     x.x
     22          
     23          Description:
     24          Implementation of commonly used functions for the RF04EB and CC2430DB.
     25          
     26          * For use with CC2430DB add "CC2430DB" to project options.
     27            Project -> Options... -> C compiler -> Preprocessor -> Defined symbols
     28          
     29          * For use with RF04EB do _not_ add "CC2430DB to project options.
     30          
     31          ******************************************************************************/
     32          
     33          #include "ioCC2430.h"
     34          
     35          #ifdef CC2430DB
     36             #include "CC2430DB.h"
     37          #else
     38             #include "RF04EB.h"
     39          #endif
     40          
     41          
     42          /******************************************************************************
     43          * @fn  getJoystickDirection
     44          *
     45          * @brief
     46          *      This function utilizes the 8-bit ADC to give an indication of the
     47          *      current position of the joystick. Current support is for 90 degrees
     48          *      positioning only.
     49          *
     50          * Parameters:
     51          *
     52          * @param  void
     53          *
     54          * @return JOYSTICK_DIRECTION 
     55          *          DOWN: Joystick direction is down (270 degrees)
     56          *          LEFT: Joystick direction is left (180 degrees)
     57          *	   RIGHT: Joystick direction is right (0 degrees)
     58          *	   UP: Joystick direction is up (90 degrees)
     59          *	   CENTRED: Joystick direction is centred (passive position)
     60          *
     61          ******************************************************************************/

   \                                 In segment BANKED_CODE, align 1, keep-with-next
     62          JOYSTICK_DIRECTION getJoystickDirection( void ) {
   \                     getJoystickDirection:
   \   000000   74F7         MOV     A,#-0x9
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 9
   \   000005                ; Auto size: 2
   \   000005   74FE         MOV     A,#-0x2
   \   000007   12....       LCALL   ?ALLOC_XSTACK8
     63              INT8 adcValue, i;
     64              JOYSTICK_DIRECTION direction[2];
     65          
     66          
     67              for(i = 0; i < 2; i++){
   \   00000A   85..82       MOV     DPL,?XSP + 0
   \   00000D   85..83       MOV     DPH,?XSP + 1
   \   000010   AE82         MOV     R6,DPL
   \   000012   AF83         MOV     R7,DPH
   \   000014   75..02       MOV     ?V0 + 0,#0x2
     68                 adcValue = halAdcSampleSingle(ADC_REF_AVDD, ADC_8_BIT, ADC_INPUT_JOYSTICK);
   \                     ??getJoystickDirection_0:
   \   000017                ; Setup parameters for call to function halAdcSampleSingle
   \   000017   7B06         MOV     R3,#0x6
   \   000019   7A00         MOV     R2,#0x0
   \   00001B   7980         MOV     R1,#-0x80
   \   00001D   90....       MOV     DPTR,#(halAdcSampleSingle & 0xffff)
   \   000020   74..         MOV     A,#((halAdcSampleSingle >> 16) & 0xff)
   \   000022   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
   \   000025   EA           MOV     A,R2
     69          
     70                 if (adcValue < 0x10) {
   \   000026   C3           CLR     C
   \   000027   9410         SUBB    A,#0x10
   \   000029   A2D2         MOV     C,0xD0 /* PSW */.2
   \   00002B   65D0         XRL     A,PSW
   \   00002D   33           RLC     A
   \   00002E   5004         JNC     ??getJoystickDirection_1
     71                    direction[i] = DOWN;  // Measured [0xFC, 0x03]
   \   000030   7404         MOV     A,#0x4
   \   000032   802E         SJMP    ??getJoystickDirection_2
     72                 } else if (adcValue < 0x39) {
   \                     ??getJoystickDirection_1:
   \   000034   EA           MOV     A,R2
   \   000035   C3           CLR     C
   \   000036   9439         SUBB    A,#0x39
   \   000038   A2D2         MOV     C,0xD0 /* PSW */.2
   \   00003A   65D0         XRL     A,PSW
   \   00003C   33           RLC     A
   \   00003D   5004         JNC     ??getJoystickDirection_3
     73                    direction[i] = LEFT;  // Measured [0x2E, 0x37]
   \   00003F   7401         MOV     A,#0x1
   \   000041   801F         SJMP    ??getJoystickDirection_2
     74                 } else if (adcValue < 0x56) {
   \                     ??getJoystickDirection_3:
   \   000043   EA           MOV     A,R2
   \   000044   C3           CLR     C
   \   000045   9456         SUBB    A,#0x56
   \   000047   A2D2         MOV     C,0xD0 /* PSW */.2
   \   000049   65D0         XRL     A,PSW
   \   00004B   33           RLC     A
   \   00004C   5004         JNC     ??getJoystickDirection_4
     75                    direction[i] = RIGHT; // Measured [0x4C, 0x54]
   \   00004E   7402         MOV     A,#0x2
   \   000050   8010         SJMP    ??getJoystickDirection_2
     76                 } else if (adcValue < 0x68) {
   \                     ??getJoystickDirection_4:
   \   000052   EA           MOV     A,R2
   \   000053   C3           CLR     C
   \   000054   9468         SUBB    A,#0x68
   \   000056   A2D2         MOV     C,0xD0 /* PSW */.2
   \   000058   65D0         XRL     A,PSW
   \   00005A   33           RLC     A
   \   00005B   5004         JNC     ??getJoystickDirection_5
     77                    direction[i] = UP;    // Measured [0x59, 0x64]
   \   00005D   7403         MOV     A,#0x3
   \   00005F   8001         SJMP    ??getJoystickDirection_2
     78                 } else {
     79                    direction[i] = CENTRED; // Measured [0x69, 73]
   \                     ??getJoystickDirection_5:
   \   000061   E4           CLR     A
   \                     ??getJoystickDirection_2:
   \   000062   8E82         MOV     DPL,R6
   \   000064   8F83         MOV     DPH,R7
   \   000066   F0           MOVX    @DPTR,A
     80                 }
     81              }
   \   000067   A3           INC     DPTR
   \   000068   AE82         MOV     R6,DPL
   \   00006A   AF83         MOV     R7,DPH
   \   00006C   15..         DEC     ?V0 + 0
   \   00006E   E5..         MOV     A,?V0 + 0
   \   000070   70A5         JNZ     ??getJoystickDirection_0
     82          
     83              if(direction[0] == direction[1]){
   \   000072   85..82       MOV     DPL,?XSP + 0
   \   000075   85..83       MOV     DPH,?XSP + 1
   \   000078   E0           MOVX    A,@DPTR
   \   000079   FA           MOV     R2,A
   \   00007A   7401         MOV     A,#0x1
   \   00007C   12....       LCALL   ?XSTACK_DISP0_8
   \   00007F   E0           MOVX    A,@DPTR
   \   000080   6A           XRL     A,R2
   \   000081   700A         JNZ     ??getJoystickDirection_6
     84                 return direction[0];
   \   000083   85..82       MOV     DPL,?XSP + 0
   \   000086   85..83       MOV     DPH,?XSP + 1
   \   000089   E0           MOVX    A,@DPTR
   \   00008A   F9           MOV     R1,A
   \   00008B   8002         SJMP    ??getJoystickDirection_7
     85              }
     86              else{
     87                 return CENTRED;
   \                     ??getJoystickDirection_6:
   \   00008D   7900         MOV     R1,#0x0
   \                     ??getJoystickDirection_7:
   \   00008F   7402         MOV     A,#0x2
   \   000091   12....       LCALL   ?DEALLOC_XSTACK8
   \   000094   7F01         MOV     R7,#0x1
   \   000096   02....       LJMP    ?BANKED_LEAVE_XDATA
     88              }
     89          }
     90          
     91          
     92          /******************************************************************************
     93          * @fn  getPotValue
     94          *
     95          * @brief 
     96          *      This function utilizes the 8-bit ADC to obtain a digital value for the
     97          *      potentiometer resistance.
     98          *
     99          * Parameters:
    100          *
    101          * @param  void
    102          *
    103          * @return UINT8
    104          *         0xFF
    105          *         0x00        
    106          *
    107          ******************************************************************************/

   \                                 In segment BANKED_CODE, align 1, keep-with-next
    108          UINT8 getPotValue( void ){
   \                     getPotValue:
   \   000000   C082         PUSH    DPL
   \   000002   C083         PUSH    DPH
   \   000004                ; Saved register size: 2
   \   000004                ; Auto size: 0
    109              INT8 adcValue = halAdcSampleSingle(ADC_REF_AVDD, ADC_8_BIT, ADC_INPUT_POT);
   \   000004                ; Setup parameters for call to function halAdcSampleSingle
   \   000004   7B07         MOV     R3,#0x7
   \   000006   7A00         MOV     R2,#0x0
   \   000008   7980         MOV     R1,#-0x80
   \   00000A   90....       MOV     DPTR,#(halAdcSampleSingle & 0xffff)
   \   00000D   74..         MOV     A,#((halAdcSampleSingle >> 16) & 0xff)
   \   00000F   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
   \   000012   EA           MOV     A,R2
    110              return (adcValue > 0) ? adcValue : 0;
   \   000013   C3           CLR     C
   \   000014   9401         SUBB    A,#0x1
   \   000016   A2D2         MOV     C,0xD0 /* PSW */.2
   \   000018   65D0         XRL     A,PSW
   \   00001A   33           RLC     A
   \   00001B   4004         JC      ??getPotValue_0
   \   00001D   EA           MOV     A,R2
   \   00001E   F9           MOV     R1,A
   \   00001F   8002         SJMP    ??getPotValue_1
   \                     ??getPotValue_0:
   \   000021   7900         MOV     R1,#0x0
   \                     ??getPotValue_1:
   \   000023                REQUIRE ?Subroutine0
   \   000023                ; // Fall through to label ?Subroutine0
    111          }

   \                                 In segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine0:
   \   000000   D083         POP     DPH
   \   000002   D082         POP     DPL
   \   000004   02....       LJMP    ?BRET
    112          
    113          
    114          /******************************************************************************
    115          * @fn  buttonPushed
    116          *
    117          * @brief
    118          *      This function detects if the button is being pushed. The function
    119          *      implements software debounce. Return true only if previuosly called
    120          *      with button not pushed. Return true only once each time the button

⌨️ 快捷键说明

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