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

📄 sampleapphw.s51

📁 用IAR开发的ZIGBEE网络路由例子
💻 S51
📖 第 1 页 / 共 2 页
字号:

        ASEGN SFR_AN:DATA:NOROOT,0f6H
// unsigned char volatile __sfr P1INP
P1INP:
        DS 1

        ASEGN SFR_AN:DATA:NOROOT,0fdH
// unsigned char volatile __sfr P0DIR
P0DIR:
        DS 1

        ASEGN SFR_AN:DATA:NOROOT,0feH
// unsigned char volatile __sfr P1DIR
P1DIR:
        DS 1
//   20 #include "hal_defs.h"
//   21 
//   22 #include "SampleAppHw.h"
//   23 
//   24 /*********************************************************************
//   25  * MACROS
//   26  */
//   27 
//   28 /*********************************************************************
//   29  * CONSTANTS
//   30  */
//   31 
//   32 #if defined( CC2430DB )
//   33   /* NOTES:   Jumper should be between P7.1 and P7.3 on the CC2430DB.
//   34    *          P7.1 -> CC2430 P1.3
//   35    *          p7.3 -> CC2430 P0.4
//   36    */
//   37   #define JUMPERIN_BIT  0x08
//   38   #define JUMPERIN_SEL  P1SEL
//   39   #define JUMPERIN_DIR  P1DIR
//   40   #define JUMPERIN_INP  P1INP
//   41   #define JUMPERIN      P1
//   42   
//   43   #define JUMPEROUT_BIT 0x10
//   44   #define JUMPEROUT_SEL P0SEL
//   45   #define JUMPEROUT_DIR P0DIR
//   46   #define JUMPEROUT_INP P0INP
//   47   #define JUMPEROUT     P0
//   48 
//   49 #elif defined( CC2430EB )
//   50   /* NOTES:   Jumper should be between I/O A pin 9 and 11 on the CC2430EB.
//   51    *          I/O A pin 9  -> CC2430 P0.2
//   52    *          I/O A pin 11 -> CC2430 P0.3
//   53    */
//   54   #define JUMPERIN_BIT  0x04
//   55   #define JUMPERIN_SEL  P0SEL
//   56   #define JUMPERIN_DIR  P0DIR
//   57   #define JUMPERIN_INP  P0INP
//   58   #define JUMPERIN      P0
//   59   
//   60   #define JUMPEROUT_BIT 0x08
//   61   #define JUMPEROUT_SEL P0SEL
//   62   #define JUMPEROUT_DIR P0DIR
//   63   #define JUMPEROUT_INP P0INP
//   64   #define JUMPEROUT     P0
//   65 
//   66   #if defined (HAL_UART) && (HAL_UART==TRUE)
//   67     #error The UART will not work with this configuration. The RX & TX pins are used.
//   68   #endif
//   69 #else
//   70   #error Unsupported board
//   71 #endif
//   72 /*********************************************************************
//   73  * TYPEDEFS
//   74  */
//   75 
//   76 /*********************************************************************
//   77  * GLOBAL VARIABLES
//   78  */
//   79 
//   80 /*********************************************************************
//   81  * EXTERNAL VARIABLES
//   82  */
//   83 
//   84 /*********************************************************************
//   85  * EXTERNAL FUNCTIONS
//   86  */
//   87 
//   88 /*********************************************************************
//   89  * LOCAL VARIABLES
//   90  */
//   91 
//   92 /*********************************************************************
//   93  * LOCAL FUNCTIONS
//   94  */
//   95 
//   96 /*********************************************************************
//   97  * @fn      readCoordinatorJumper
//   98  *
//   99  * @brief   Checks for a jumper to determine if the device should
//  100  *          become a coordinator
//  101  *
//  102  * NOTES:   Jumper should be between P7.1 and P7.3 on the CC2430DB.
//  103  *          P7.1 -> CC2430 P1.3
//  104  *          p7.3 -> CC2430 P0.4
//  105  *
//  106  * NOTES:   Jumper should be between I/O A pin 9 and 11 on the CC2430EB.
//  107  *          I/O A pin 9  -> CC2430 P0.2
//  108  *          I/O A pin 11 -> CC2430 P0.3
//  109  *
//  110  * @return  TRUE if the jumper is there, FALSE if not
//  111  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  112 uint8 readCoordinatorJumper( void )
readCoordinatorJumper:
        CFI Block cfiBlock0 Using cfiCommon0
        CFI Function readCoordinatorJumper
//  113 {
        MOV	A,#-0xa
        LCALL	?BANKED_ENTER_XDATA
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 10)
        ; Saved register size: 10
        ; Auto size: 0
//  114   uint8 jumpered;
//  115   uint8 x, y;
//  116   uint8 result;
//  117   uint8 saveJumpInSEL;
//  118   uint8 saveJumpInDIR;
//  119   uint8 saveJumpInINP;
//  120   uint8 saveJumpOutSEL;
//  121   uint8 saveJumpOutDIR;
//  122   uint8 saveJumpOutINP;
//  123   
//  124   jumpered = TRUE;
        MOV	R1,#0x1
//  125   
//  126   // Setup PORTs
//  127   saveJumpInSEL = JUMPERIN_SEL;
        MOV	A,0xf4
        MOV	R4,A
//  128   saveJumpInDIR = JUMPERIN_DIR;
        MOV	A,0xfe
        MOV	R5,A
//  129   saveJumpInINP = JUMPERIN_INP;
        MOV	A,0xf6
        MOV	R6,A
//  130   saveJumpOutSEL = P0SEL;
        MOV	A,0xf3
        MOV	R7,A
//  131   saveJumpOutDIR = P0DIR;
        MOV	A,0xfd
        MOV	?V0 + 0,A
//  132   saveJumpOutINP = P0INP;
        MOV	A,0x8f
        MOV	?V0 + 1,A
//  133   
//  134   JUMPERIN_SEL &= ~(JUMPERIN_BIT);
        ANL	0xf4,#0xf7
//  135   JUMPERIN_DIR &= ~(JUMPERIN_BIT);
        ANL	0xfe,#0xf7
//  136   JUMPERIN_INP &= ~(JUMPERIN_BIT);
        ANL	0xf6,#0xf7
//  137   JUMPEROUT_SEL &= ~(JUMPEROUT_BIT);
        ANL	0xf3,#0xef
//  138   JUMPEROUT_DIR |= JUMPEROUT_BIT;
        ORL	0xfd,#0x10
//  139   JUMPEROUT_INP &= ~(JUMPERIN_BIT);
        ANL	0x8f,#0xf7
//  140   
//  141   for ( x = 0; x < 8; x++ )
        MOV	R3,#0x0
//  142   {    
//  143     if ( x & 0x01 )
//  144     {
//  145       JUMPEROUT |= JUMPEROUT_BIT;      
//  146       for ( y = 0; y < 8; y++ );
//  147       result = JUMPERIN & JUMPERIN_BIT;
//  148       if ( result != JUMPERIN_BIT )
//  149         jumpered = FALSE;
//  150     }
//  151     else
//  152     {      
//  153       JUMPEROUT &= ~(JUMPEROUT_BIT);      
??readCoordinatorJumper_0:
        CLR	0x80.4
//  154       for ( y = 0; y < 8; y++ );
        MOV	R2,#0x8
??readCoordinatorJumper_1:
        DEC	R2
        MOV	A,R2
        JNZ	??readCoordinatorJumper_1
//  155       result = JUMPERIN & JUMPERIN_BIT;
        MOV	A,#0x8
        ANL	A,0x90
//  156       if ( result != 0x00 )
        JNZ	??readCoordinatorJumper_2
//  157         jumpered = FALSE;
//  158     }
??readCoordinatorJumper_3:
        INC	R3
        MOV	A,R3
        CLR	C
        SUBB	A,#0x8
        JNC	??readCoordinatorJumper_4
        MOV	A,R3
        MOV	C,0xE0 /* A   */.0
        JNC	??readCoordinatorJumper_0
        SETB	0x80.4
        MOV	R2,#0x8
??readCoordinatorJumper_5:
        DEC	R2
        MOV	A,R2
        JNZ	??readCoordinatorJumper_5
        MOV	A,#0x8
        ANL	A,0x90
        MOV	R2,A
        MOV	A,#0x8
        XRL	A,R2
        JZ	??readCoordinatorJumper_3
??readCoordinatorJumper_2:
        MOV	R1,#0x0
        SJMP	??readCoordinatorJumper_3
//  159   }
//  160   
//  161   // Restore directions
//  162   JUMPERIN_SEL = saveJumpInSEL;
??readCoordinatorJumper_4:
        MOV	0xf4,R4
//  163   JUMPERIN_DIR = saveJumpInDIR;
        MOV	0xfe,R5
//  164   JUMPERIN_INP = saveJumpInINP;
        MOV	0xf6,R6
//  165   JUMPEROUT_SEL = saveJumpOutSEL;
        MOV	0xf3,R7
//  166   JUMPEROUT_DIR = saveJumpOutDIR;
        MOV	0xfd,?V0 + 0
//  167   JUMPEROUT_INP = saveJumpOutINP;
        MOV	0x8f,?V0 + 1
//  168   
//  169   return ( jumpered );
        MOV	R7,#0x2
        LJMP	?BANKED_LEAVE_XDATA
        CFI EndBlock cfiBlock0
//  170 }

        ASEGN SFR_AN:DATA:NOROOT,080H
// union <unnamed> volatile __sfr _A_P0
_A_P0:
        DS 1

        ASEGN SFR_AN:DATA:NOROOT,090H
// union <unnamed> volatile __sfr _A_P1
_A_P1:
        DS 1

        END
// 
// 114 bytes in segment BANKED_CODE
//   8 bytes in segment SFR_AN
// 
// 114 bytes of CODE memory
//   0 bytes of DATA memory (+ 8 bytes shared)
//
//Errors: none
//Warnings: none

⌨️ 快捷键说明

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