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

📄 simplecontroller.s51

📁 CC2430上开关控制灯和温度传感器采集两个例子
💻 S51
📖 第 1 页 / 共 3 页
字号:
//  182       {
//  183       }
//  184     }
//  185     if ( keys & HAL_KEY_SW_3 )
//  186     {
//  187     }
//  188     if ( keys & HAL_KEY_SW_4 )
//  189     {
//  190     }
//  191   }
//  192 }
??zb_HandleKeys_0:
        MOV	A,#0x2
        LCALL	?DEALLOC_XSTACK8
        CFI EndBlock cfiBlock1
        REQUIRE ?Subroutine1
        ; // Fall through to label ?Subroutine1

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine1:
        CFI Block cfiBlock2 Using cfiCommon0
        CFI NoFunction
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 9)
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        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)))
        MOV	R7,#0x1
        LJMP	?BANKED_LEAVE_XDATA
        CFI EndBlock cfiBlock2

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine0:
        CFI Block cfiCond3 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_1
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 11)
        CFI Block cfiCond4 Using cfiCommon0
        CFI (cfiCond4) NoFunction
        CFI (cfiCond4) Conditional ??CrossCallReturnLabel_0
        CFI (cfiCond4) R6 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond4) VB load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond4) V0 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond4) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond4) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond4) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond4) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond4) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond4) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond4) CFA_SP SP+0
        CFI (cfiCond4) CFA_XSP16 add(XSP16, 11)
        CFI Block cfiPicker5 Using cfiCommon1
        CFI (cfiPicker5) NoFunction
        CFI (cfiPicker5) Picker
        MOV	A,#0x4
        MOVX	@DPTR,A
        ; Setup parameters for call to function zb_WriteConfiguration
        ; Setup parameters for call to function zb_WriteConfiguration
        MOV	R4,DPL
        MOV	R5,DPH
        MOV	R2,#0x1
        MOV	R1,#0x3
        MOV	DPTR,#(zb_WriteConfiguration & 0xffff)
        MOV	A,#((zb_WriteConfiguration >> 16) & 0xff)
        RET
        CFI EndBlock cfiCond3
        CFI EndBlock cfiCond4
        CFI EndBlock cfiPicker5
//  193 /******************************************************************************
//  194  * @fn          zb_StartConfirm
//  195  *
//  196  * @brief       The zb_StartConfirm callback is called by the ZigBee stack
//  197  *              after a start request operation completes
//  198  *
//  199  * @param       status - The status of the start operation.  Status of
//  200  *                       ZB_SUCCESS indicates the start operation completed
//  201  *                       successfully.  Else the status is an error code.
//  202  *
//  203  * @return      none
//  204  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  205 void zb_StartConfirm( uint8 status )
zb_StartConfirm:
        CFI Block cfiBlock6 Using cfiCommon0
        CFI Function zb_StartConfirm
//  206 {
        FUNCALL zb_StartConfirm, osal_start_timer
        LOCFRAME XSTACK, 9, STACK
        ARGFRAME XSTACK, 9, STACK
        MOV	A,#-0x9
        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 V0 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 9)
        ; Saved register size: 9
        ; Auto size: 0
//  207  // If the device sucessfully started, change state to running
//  208   if ( status == ZB_SUCCESS )
        MOV	A,R1
        JNZ	??zb_StartConfirm_0
//  209   {
//  210     myAppState = APP_START;
        MOV	A,#0x1
        MOV	DPTR,#??myAppState
        MOVX	@DPTR,A
        SJMP	??zb_StartConfirm_1
//  211   }
//  212   else
//  213   {
//  214     // Try again later with a delay
//  215     osal_start_timer( MY_START_EVT, myStartRetryDelay );
??zb_StartConfirm_0:
        ; Setup parameters for call to function osal_start_timer
        MOV	DPTR,#??myStartRetryDelay
        MOVX	A,@DPTR
        MOV	R4,A
        MOV	R5,#0x0
        MOV	R2,#0x1
        MOV	R3,#0x0
        MOV	DPTR,#(osal_start_timer & 0xffff)
        MOV	A,#((osal_start_timer >> 16) & 0xff)
        LCALL	?BCALL               ; Banked call to: DPTR()
//  216   }
//  217 }
??zb_StartConfirm_1:
        SJMP	?Subroutine1
        CFI EndBlock cfiBlock6
//  218 
//  219 /******************************************************************************
//  220  * @fn          zb_SendDataConfirm
//  221  *
//  222  * @brief       The zb_SendDataConfirm callback function is called by the
//  223  *              ZigBee after a send data operation completes
//  224  *
//  225  * @param       handle - The handle identifying the data transmission.
//  226  *              status - The status of the operation.
//  227  *
//  228  * @return      none
//  229  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  230 void zb_SendDataConfirm( uint8 handle, uint8 status )
zb_SendDataConfirm:
        CFI Block cfiBlock7 Using cfiCommon0
        CFI Function zb_SendDataConfirm
//  231 {
        ; Saved register size: 0
        ; Auto size: 0
//  232 }
        LJMP	?BRET
        CFI EndBlock cfiBlock7
//  233 
//  234 /******************************************************************************
//  235  * @fn          zb_BindConfirm
//  236  *
//  237  * @brief       The zb_BindConfirm callback is called by the ZigBee stack
//  238  *              after a bind operation completes.
//  239  *
//  240  * @param       commandId - The command ID of the binding being confirmed.
//  241  *              status - The status of the bind operation.
//  242  *
//  243  * @return      none
//  244  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  245 void zb_BindConfirm( uint16 commandId, uint8 status )
zb_BindConfirm:
        CFI Block cfiBlock8 Using cfiCommon0
        CFI Function zb_BindConfirm
//  246 {
        ; Saved register size: 0
        ; Auto size: 0
//  247 }
        LJMP	?BRET
        CFI EndBlock cfiBlock8
//  248 /******************************************************************************
//  249  * @fn          zb_AllowBindConfirm
//  250  *
//  251  * @brief       Indicates when another device attempted to bind to this device
//  252  *
//  253  * @param
//  254  *
//  255  * @return      none
//  256  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  257 void zb_AllowBindConfirm( uint16 source )
zb_AllowBindConfirm:
        CFI Block cfiBlock9 Using cfiCommon0
        CFI Function zb_AllowBindConfirm
//  258 {
        FUNCALL zb_AllowBindConfirm, HalLedSet
        LOCFRAME ISTACK, 2, STACK
        ARGFRAME ISTACK, 2, STACK
        PUSH	DPL
        CFI DPL0 Frame(CFA_SP, 4)
        CFI CFA_SP SP+-4
        PUSH	DPH
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        ; Saved register size: 2
        ; Auto size: 0
//  259   // Flash LED
//  260   HalLedSet( HAL_LED_1, HAL_LED_MODE_BLINK );
        ; Setup parameters for call to function HalLedSet
        MOV	R2,#0x2
        MOV	R1,#0x1
        MOV	DPTR,#(HalLedSet & 0xffff)
        MOV	A,#((HalLedSet >> 16) & 0xff)
        LCALL	?BCALL               ; Banked call to: DPTR()
        CFI EndBlock cfiBlock9
//  261 }
        REQUIRE ?Subroutine2
        ; // Fall through to label ?Subroutine2

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine2:
        CFI Block cfiBlock10 Using cfiCommon0
        CFI NoFunction
        CFI CFA_SP SP+-5
        CFI DPL0 Frame(CFA_SP, 4)
        CFI DPH0 Frame(CFA_SP, 5)
        POP	DPH
        CFI CFA_SP SP+-4
        CFI DPH0 SameValue
        POP	DPL
        CFI CFA_SP SP+-3
        CFI DPL0 SameValue
        LJMP	?BRET
        CFI EndBlock cfiBlock10
//  262 /******************************************************************************
//  263  * @fn          zb_FindDeviceConfirm
//  264  *
//  265  * @brief       The zb_FindDeviceConfirm callback function is called by the
//  266  *              ZigBee stack when a find device operation completes.
//  267  *
//  268  * @param       searchType - The type of search that was performed.
//  269  *              searchKey - Value that the search was executed on.
//  270  *              result - The result of the search.
//  271  *
//  272  * @return      none
//  273  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  274 void zb_FindDeviceConfirm( uint8 searchType, uint8 *searchKey, uint8 *result )
zb_FindDeviceConfirm:
        CFI Block cfiBlock11 Using cfiCommon0
        CFI Function zb_FindDeviceConfirm
//  275 {
        ; Saved register size: 0
        ; Auto size: 0
//  276 }
        LJMP	?BRET
        CFI EndBlock cfiBlock11
//  277 
//  278 /******************************************************************************
//  279  * @fn          zb_ReceiveDataIndication
//  280  *
//  281  * @brief       The zb_ReceiveDataIndication callback function is called
//  282  *              asynchronously by the ZigBee stack to notify the application
//  283  *              when data is received from a peer device.
//  284  *
//  285  * @param       source - The short address of the peer device that sent the data
//  286  *              command - The commandId associated with the data
//  287  *              len - The number of bytes in the pData parameter
//  288  *              pData - The data sent by the peer device
//  289  *
//  290  * @return      none
//  291  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  292 void zb_ReceiveDataIndication( uint16 source, uint16 command, uint16 len, uint8 *pData  )
zb_ReceiveDataIndication:
        CFI Block cfiBlock12 Using cfiCommon0
        CFI Function zb_ReceiveDataIndication
//  293 {
        FUNCALL zb_ReceiveDataIndication, HalLedSet
        LOCFRAME ISTACK, 2, STACK
        ARGFRAME ISTACK, 2, STACK
        PUSH	DPL
        CFI DPL0 Frame(CFA_SP, 4)
        CFI CFA_SP SP+-4
        PUSH	DPH
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        ; Saved register size: 2
        ; Auto size: 0
//  294   if (command == TOGGLE_LIGHT_CMD_ID)
        MOV	A,#0x1
        XRL	A,R4
        JNZ	??zb_ReceiveDataIndication_0
        MOV	A,R5
??zb_ReceiveDataIndication_0:
        JNZ	??zb_ReceiveDataIndication_1
//  295   {
//  296     // Received application command to toggle the LED
//  297     HalLedSet(HAL_LED_1, HAL_LED_MODE_TOGGLE);
        ; Setup parameters for call to function HalLedSet
        MOV	R2,#0x8
        MOV	R1,#0x1
        MOV	DPTR,#(HalLedSet & 0xffff)
        MOV	A,#((HalLedSet >> 16) & 0xff)
        LCALL	?BCALL               ; Banked call to: DPTR()
//  298   }
//  299 }
??zb_ReceiveDataIndication_1:
        SJMP	?Subroutine2
        CFI EndBlock cfiBlock12

        RSEG XDATA_ID:CODE:NOROOT(0)
`?<Initializer for myStartRetryDelay>`:
        DB 10

        RSEG XDATA_ID:CODE:NOROOT(0)
`?<Initializer for myAllowBindTimeout>`:
        DB 10

        RSEG XDATA_ID:CODE:NOROOT(0)
`?<Initializer for zb_InCmdList>`:
        DW 1

        RSEG XDATA_ID:CODE:NOROOT(0)
`?<Initializer for zb_SimpleDesc>`:
        DB 2
        DW 3856, 2
        DB 1, 1
        DW zb_InCmdList
        DB 0
        DW 0H

        END
// 
// 359 bytes in segment BANKED_CODE
//  16 bytes in segment XDATA_I
//  16 bytes in segment XDATA_ID
//   1 byte  in segment XDATA_Z
// 
// 375 bytes of CODE  memory
//  17 bytes of XDATA memory
//
//Errors: none
//Warnings: none

⌨️ 快捷键说明

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