execution speed EZSBC

scrub
Posts: 3
Joined: Sat Nov 28, 2015 1:14 pm

execution speed EZSBC

Unread post 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.
Daniel
Posts: 133
Joined: Tue Nov 13, 2012 2:10 pm

Re: execution speed EZSBC

Unread post by Daniel »

Try using the IFF statement. It is faster. Also, brackets may speed up the evaluation.
scrub
Posts: 3
Joined: Sat Nov 28, 2015 1:14 pm

Re: execution speed EZSBC

Unread post 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.
Post Reply