写个单片机程序最后搞得像PLC程序一样

2019-07-21 04:15发布

[mw_shl_code=c,true]void M_updata(void) { u32 i; switch(Set_screen_id ) { case screen_0: //选择画面 { } break; case screen_1: //自动画面 { for (i = 100;i < 101 ;i++) { if (m != mtemp) { SetButtonValue(Set_screen_id,madd+i,m); mtemp = m; } } for (i = 0;i < osize ;i++) { if (o != otemp) { AnimationPlayFrame(Set_screen_id,oadd+i,o); otemp = o; } } } break; case screen_2: //手动画面 { for (i = 100;i < 118 ;i++) { if (m != mtemp) { SetButtonValue(Set_screen_id,madd+i,m); mtemp = m; } } } break; case screen_3: //参数画面 { } break; case screen_4: { } break; case screen_5: //输入画面 { for (i = 0;i < xsize ;i++) { if ((x != xtemp) ||(Set_screen_id != Set_screen_idtemp)) { AnimationPlayFrame(Set_screen_id,xadd+i,x); xtemp = x; } } Set_screen_idtemp = Set_screen_id; } break; case screen_6: //输出画面 { for (i = 0;i < ysize ;i++) { if ((y != ytemp) ||(Set_screen_id != Set_screen_idtemp)) { AnimationPlayFrame(Set_screen_id,yadd+i,y); ytemp = y; } } Set_screen_idtemp = Set_screen_id; } break; case screen_7: { } break; } } void main1 (void ) { u8 i; if (X0) Y0 = 0; if (m[100] == 1 && mp100 == 0) { mf100 = 0; mp100 = 1; o[2] = 1; m[10] = 1; //回原点 } else if (m[100] ==0 && mf100 == 0) //M100程序启动 o2程序指示 { o[2] = 0; mp100 = 0; mf100 = 1; for (i=0;i<msize;i++) m = 0; for (i=0;i<ysize;i++) y = 0; } if (m[0]) o[0] = 1; //M0手动自动选择 o0指示 else o[0] = 0; if (m[1]) o[1] = 1; //M1规格选择 o1规格指示 else o[1] = 0; if (m[2]) o[3] = 1; //M2清洗 o3指示 else o[3] = 0; if (m[3]) d[0] = 0,m[3] = 0; //M3清零 }[/mw_shl_code]
0条回答

一周热门 更多>