lpcware

Faster way for IF() and Adding?

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by Dave3891 on Sun Jun 19 09:58:24 MST 2011
Is there a faster way to do this?
[SIZE=2]
[LEFT]error2 -= cp2;
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](error2 < 0 ){
error2 += cp1;
LPC_GPIO2->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]MASKED_ACCESS[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][(1<<4)] = (1<<4);
position2++;[/LEFT]
}
[/SIZE]

It takes about 70 clock cycles to do this operation and I need to use 6 of these within a timer interrupt, and I cant speed up my timer freq without speeding up this operation.


Thanks
Dave

Outcomes