following piece of code takes about instruction 4700 cycles
and it should be a lot less than 4096
Any ideas on how to improve on that?
I guess the generated asm code could be improved
with some inline assembly but I'm not that great at it.
The code is for sending GSdata to a TLC5940 chip within an ISR
and it should be a lot less than 4096
Any ideas on how to improve on that?
I guess the generated asm code could be improved
with some inline assembly but I'm not that great at it.
Code:
// Makro's
#define setLo(pin) (pin=0)
#define setHi(pin) (pin=1)
#define pulse(pin) do { setHi(pin); setLo(pin); } while (0)
Code:
for(ii=0;ii<16;ii++) { // 16 bits
bitmask = 0x800;
currentdata=gsData[ii];
for(jj=0;jj<12;jj++) {
if(currentdata & bitmask) setHi(TLC_SIN); // 1
else setLo(TLC_SIN); // 0
pulse(TLC_SCLK);
bitmask >>=1; // Next bit
}
}
The code is for sending GSdata to a TLC5940 chip within an ISR
Last edited: