
WINCC几个常用C语言编程.doc
2页全局脚本编程(按钮连续增减)说明:1、建立全局脚本函数2、建立全局动作C脚本3、在启动画面的打开画面中调用全局脚本函数4、在计算机的启动选项中选中全局脚本全局脚本函数InitAction()externchartagname[30]="";externSHORTcount=0;externFLOATlow=0;externFLOAThigh=0;externFLOATstep=0;voidInitAction()按钮左键按下连续增加externchartagname[30];externSHORTcount;externFLOATlow;externFLOAThigh;externFLOATstep;strcpy(tagname,"S32i_varia_but_04");count=1;low=0;high=1400;step=0.5;按钮左键按下连续减少externchartagname[30];externSHORTcount;externFLOATlow;externFLOAThigh;externFLOATstep;strcpy(tagname,"S32i_varia_but_04");count=2;low=0;high=1400;step=0.5;按钮左键松开停止增减externSHORTcount;count=0;全局动作C脚本(counter.pas)#include"apdefap.h"intgscAction(void){externchartagname[30];externSHORTcount;externFLOATlow;externFLOAThigh;externFLOATstep;FLOATvalue;if((count==1)||(count==2)){//getcurrentvaluevalue=GetTagFloat(tagname);if(count==1){//incvalue=value+step;if(value>high)(value=high);//highlimit}//ifif(count==2){//decvalue=value-step;if(value
