Page 1 of 1

execution speed EZSBC

Posted: Sun Apr 17, 2016 5:07 am
by scrub
In my program I have 15 blocks of code as follows:
if LED(X,1) & 1 = 1 then
outd R1, 1
else
outd R1, 0
endif
At the start of the code I put settick (0) and before the next X I put z = gettick. I got back 54 or 55 on subsequent runs. This would indicate that it took 5500 micro seconds or about 366 micro seconds per if. This seems exceeding slow, I was expecting less than 50 micro seconds per if.

Re: execution speed EZSBC

Posted: Sun Apr 17, 2016 5:07 pm
by Daniel
Try using the IFF statement. It is faster. Also, brackets may speed up the evaluation.

Re: execution speed EZSBC

Posted: Mon Apr 18, 2016 5:24 am
by scrub
I get a syntax error on: IIF(LED(X,1) & 1,OUTD R1,1,OUTD R1,0). Sitting reading something unrelated, I remembered something of the example in the manual. I changed everything around and the execution down to 48 ticks.