|
发表于 2017-9-15 16:22:18
|
显示全部楼层
楼主,你这个移植到STM32单片机中,
void fx1n_init(void) {
//u8t reset_i=1;
//unsigned int i;
//const u8t ArrPass[] ="PASS!\r\n\0";
//const u8t DefaultSet[] ="System in factory default.\r\n\0";
//u8t PLCButtonState;
iap_init();
reset_RAM();
FX1NPLCSoftwareVerCheck(); // 上电,核实 PLC 软件版本号
// MJ 2010.01.11
//P1M0|=0x03;
//P1M1&=0xfc;
// 核查 复位标志 . 判断是 冷启动 还是 热启动 .
// 冷启动 指从加电开始直到系统的处理命令进行完毕为止;
// 热启动 指在冷启动后,系统不断电的情况下在系统中通过软件实现的重新启动.
//if(((PCON&0x10)==0x10)) // 冷启动
{
//PCON&=~0x10;
if((P1 & 0x03) == 0) // 为合理使用 [运行/停止]按钮 .去掉 X0 X1两点输入.
{ // 请不要再 PLC 程序中编写带有 X0 X1 的程序. 谢谢.
IAPFlashProgremMode(PLCStateRealAddr,PLCStateStop);
PLCRunFlag=0;
}
else
{
IAPFlashProgremMode(PLCStateRealAddr,PLCStateRun);
PLCRunFlag=1;
}
}
//else
PLCStateCheck(); // 热启动
//PLCButtonState=P1 & 0x03;
PLCRunFlag = 1;
LastPLCStateFlag = PLCRunFlag;
CODE_scan();
PLCRunFlag = 1;
rM8xxx[0].BYTE = (rM8xxx[0].BYTE & 0xfc) | 0x01;
IAPFlashProgremMode(PLCStateRealAddr, PLCStateRun);
}
--------------------------------------------------------------
if((P1 & 0x03) == 0) // 为合理使用 [运行/停止]按钮 .去掉 X0 X1两点输入.
这条语句中,STM32可是没有 P1 口哦。。。呵呵 |
|