请问各位大师Wincc6.2与PLC317-2PN/DP能不能实现时钟同步,如果可以,请指导怎么操作?
问题补充:
请问SG9:DB1_FLAG,DB1_YEAR等这些变量的地址是什么?在S7中要不要做程序?
最佳答案
#include "apdefap.h"
void OnClick(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName)
{
#pragma code ("kernel32.dll");
void GetLocalTime (SYSTEMTIME *lpst);
#pragma code ();
SYSTEMTIME time;
if(GetTagBitWait("DB1_FLAG")==0)
{
GetLocalTime (&time);
SetTagByteWait("DB1_YEAR", (BYTE)(time.wYear-2000));
SetTagWordWait("DB1_MONTH", time.wMonth);
SetTagWordWait("DB1_DAY", time.wDay);
SetTagWordWait("DB1_HOUR", time.wHour);
SetTagWordWait("DB1_MINUTE", time.wMinute);
SetTagWordWait("DB1_SECOND", time.wSecond);
SetTagBitWait("DB1_FLAG", TRUE);
}
}
提问者对于答案的评价:
好,谢了!
原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc277802.html