lzmtxp99
級(jí)別: 家園常客
|
這個(gè)程序該怎么理解,這個(gè)是先運(yùn)行if語句再運(yùn)行for循環(huán)語句嗎? GetData(name[0], "Local HMI", LW, 10, 7) // get name strings for i=0 to 500 step 1 GetData(temp[0], "Local HMI", RW, var+13, 7) if name[0]==temp[0] and name[1]==temp[1] and name[2]==temp[2] and name[3]==temp[3] and name[4]==temp[4] and name[5]==temp[5] and name[6]==temp[6] then SetData(var, "Local HMI", LW, 9200, 1) i=501 else var=var+20 end if next i SetData(OFF, "Local HMI", LB, 7, 1) |
---|---|
|
zhangzhiming
級(jí)別: 略有小成
|
macro_command main() GetData(name[0], "Local HMI", LW, 10, 7) //讀取LW里面的數(shù)據(jù)存到變量name里 //以下程序主要是用來查詢配方里的參數(shù)或者型號(hào)的 for i=0 to 500 step 1 GetData(temp[0], "Local HMI", RW, var+13, 7) //讀取RW里面的數(shù)據(jù)存到變量temp里(起始位置是變量var+13) if name[0]==temp[0] and name[1]==temp[1] and name[2]==temp[2] and name[3]==temp[3] and name[4]==temp[4] and name[5]==temp[5] and name[6]==temp[6] then SetData(var, "Local HMI", LW, 9200, 1) //當(dāng)name里的數(shù)據(jù)和temp里面的數(shù)據(jù)相等時(shí)變量var里的數(shù)據(jù)寫入到索引寄存器LW9200里實(shí)行翻頁 i=501 else var=var+20 //當(dāng)name里的數(shù)據(jù)和temp里面的數(shù)據(jù)不相等時(shí)for語句執(zhí)行0-500循環(huán),var以步進(jìn)為20自加 end if next i SetData(OFF, "Local HMI", LB, 7, 1) end macro_command [ 此帖被zhangzhiming在2014-04-04 08:23重新編輯 ] |
---|---|
|