CH552/projects/examples/IAP/CH554IAPDemo.C
2019-01-04 15:58:00 +08:00

45 lines
1.5 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/********************************** (C) COPYRIGHT ******************************
* File Name : CH554IAPDemo.C
* Author : WCH
* Version : V1.0
* Date : 2017/01/20
* Description : 上电运行后P17LED灯闪烁当检测“EnableIAP”脚为低电平后将从用户程序跳转至BOOT通过BOOT升级用户程序
*******************************************************************************/
#include "./Public/CH554.H"
#include "./Public/Debug.H"
sbit EnableIAP = P1^6;
#define BOOT_ADDR 0x3800
#pragma NOAREGS
/*******************************************************************************
* Function Name : main
* Description : 主函数
*
* Input : None
* Output : None
* Return : None
*******************************************************************************/
typedef void( *pTaskFn)( void );
pTaskFn tasksArr[1];
void main( void )
{
UINT16 i=0;
while(1){
SCK = ~SCK; //P17闪烁
mDelaymS(50);
if(EnableIAP == 0){ //P16引脚检测到低电平跳转
break;
}
}
EA = 0; //关闭总中断,必加
tasksArr[0] = BOOT_ADDR;
mDelaymS( 100 );
(tasksArr[0])( ); //跳至BOOT升级程序,使用ISP工具升级
while(1);
}