deuhhh, if my Sunday's brain and logic is still good... the conditions could be reduced a little bit, but multiple IF-THENs still execute faster
Code:
START:
@ SIZESTART
if (ML_Value[0] > $5A) and (ML_Value[0] < $82) then
Summe_Alarm.0 = 0
else
summe_alarm.0 = 1
endif
if (ML_Value[1] > $5A) and (ML_Value[1] < $82) then
Summe_Alarm.1 = 0
else
summe_alarm.1 = 1
endif
if (ML_Value[2] > $5A) and (ML_Value[2] < $82) then
Summe_Alarm.2 = 0
else
summe_alarm.2 = 1
endif
if (ML_Value[3] > $5A) and (ML_Value[3] < $82) then
Summe_Alarm.3 = 0
else
summe_alarm.3 = 1
endif
if (ML_Value[4] > $5A) and (ML_Value[4] < $82) then
Summe_Alarm.4 = 0
else
summe_alarm.4 = 1
endif
if (ML_Value[5] > $5A) And (ML_Value[5] < $82) then
Summe_Alarm.5 = 0
else
summe_alarm.5 = 1
endif
if (ML_Value[6] > $5A) and (ML_Value[6] < $82) then
Summe_Alarm.6 = 0
else
summe_alarm.6 = 1
endif
if (ML_Value[7] > $5A) and (ML_Value[7] < $82) then
Summe_Alarm.7 = 0
else
summe_alarm.7 = 1
endif
@ SIZEEND "IF-THEN-ELSE"
@ SIZESTART
for temp = 0 to 7
if (ML_Value[temp] > $5A) and (ML_Value[temp] < $82) then
Summe_Alarm.0[temp] = 0
else
Summe_Alarm.0[temp] = 1
endif
next temp
@ SIZEEND "FOR-TO-NEXT"
@ SIZESTART
temp = 0
repeat
if (ML_Value[temp] > $5A) and (ML_Value[temp] < $82) then
Summe_Alarm.0[temp] = 0
else
summe_Alarm.0[temp]=1
endif
temp=temp+1
until temp = 8
@ SIZEEND "REPEAT - UNTIL"
@ SIZESTART
temp = 0
while temp!=8
if (ML_Value[temp] > $5A) and (ML_Value[temp] < $82) then
Summe_Alarm.0[temp] = 0
else
Summe_Alarm.0[temp] = 1
endif
temp=temp+1
wend
@ SIZEEND "WHILE - WEND"

Originally Posted by
BenchMark Report
IF-THEN-ELSE: 248 WORDS, 827 UsEC
FOR-TO-NEXT: 70 WORDS, 1380 UsEC
REPEAT - UNTIL: 66 WORDS, 1339 UsEC
WHILE - WEND: 68 WORDS, 1364 UsEC
Last edited by mister_e; - 28th May 2007 at 01:53.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks