大家帮忙看下WINCC的C语句哪里错了。

unsigned long DJS;
if(DJS==46)
{
SetPropChar(lpszPictureName,"画面窗口1","Tagprefix","no46.");
SetPropChar(lpszPictureName,"画面窗口1","Picturename","motor-bp1.pdl");  
SetPropChar(lpszPictureName,"画面窗口2","Tagprefix","PID3.");
SetPropChar(lpszPictureName,"画面窗口2","Picturename","motor-bp2.pdl");  
SetPropChar(lpszPictureName,"画面窗口3","Tagprefix","AI144.");
SetPropChar(lpszPictureName,"画面窗口3","Picturename","motor-bp4.pdl"); 
SetPropBOOL(lpszPictureName,"画面窗口1","Visible",1);
SetPropBOOL(lpszPictureName,"画面窗口2","Visible",1); 
SetPropBOOL(lpszPictureName,"画面窗口3","Visible",1);
}
else if(DJS==49)
{
SetPropChar(lpszPictureName,"画面窗口1","Tagprefix","no49.");
SetPropChar(lpszPictureName,"画面窗口1","Picturename","motor-bp1.pdl");  
SetPropChar(lpszPictureName,"画面窗口2","Tagprefix","PID4.");
SetPropChar(lpszPictureName,"画面窗口2","Picturename","motor-bp2.pdl");  
SetPropChar(lpszPictureName,"画面窗口3","Tagprefix","AI145.");
SetPropChar(lpszPictureName,"画面窗口3","Picturename","motor-bp4.pdl"); 
SetPropBOOL(lpszPictureName,"画面窗口1","Visible",1);
SetPropBOOL(lpszPictureName,"画面窗口2","Visible",1); 
SetPropBOOL(lpszPictureName,"画面窗口3","Visible",1);
}
else if(DJS==65)
{
SetPropChar(lpszPictureName,"画面窗口1","Tagprefix","no65.");
SetPropChar(lpszPictureName,"画面窗口1","Picturename","motor-bp1.pdl");  
SetPropChar(lpszPictureName,"画面窗口2","Tagprefix","PID5.");
SetPropChar(lpszPictureName,"画面窗口2","Picturename","motor-bp2.pdl");  
SetPropChar(lpszPictureName,"画面窗口3","Tagprefix","AI146.");
SetPropChar(lpszPictureName,"画面窗口3","Picturename","motor-bp4.pdl"); 
SetPropBOOL(lpszPictureName,"画面窗口1","Visible",1);
SetPropBOOL(lpszPictureName,"画面窗口2","Visible",1); 
SetPropBOOL(lpszPictureName,"画面窗口3","Visible",1);
}
以上语句就是不执行,三个画面窗口都不调用,如果不要else就只是执行最后一个。

问题补充:
DJS是一个内部变量,我在别的地方已经赋值,赋值我看过,在一个输入输出域里面显示46了。但是三个画面就是不显示。

最佳答案

if 
else if 
else if
最后应该还有个
else 
最后的else可以省略不写,程序控制结构完善,没啥问题啊

提问者对于答案的评价:
谢谢

原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc219335.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2017年12月2日 上午11:29
下一篇 2017年12月2日 上午11:30

相关推荐