??? 01/21/08 15:46 Read: times |
#149814 - Thanks all. Responding to: ???'s previous message |
mainoff is the nubmer of ticks that the changeable delay takes.
because its a delay, its unsigned making it in range: 0 - 0xFFFF Now for mainoff ticks to pass till the overflow bit is set I need to fill the timer with its two compliment of mainoff and thats what I did. The code is in a crtical section so it has to exectue fast... Anyway in the end I used temp = ~(mainoff); temp++; TL2 = temp; TH2 = temp >> 8; where temp is unsigned int... which results in: mov a,_mainoff cpl a mov r2,a mov a,(_mainoff + 1) cpl a mov r3,a inc r2 cjne r2,#0x00,00124$ inc r3 00124$: mov _TL2,r2 mov ar2,r3 mov r3,#0x00 mov _TH2,r2 which could be hand optimized to temp = ~(mainoff); temp++; _asm mov _TL2,r2 mov _TH2,r3 _endasm; but its less portable and only saves two commands... Thank you all. |
Topic | Author | Date |
SDCC, copying integer in ASM | 01/01/70 00:00 | |
Shift-and-mask, or union | 01/01/70 00:00 | |
I used asm tag and the rr command but.... | 01/01/70 00:00 | |
Your question | 01/01/70 00:00 | |
Portable unions | 01/01/70 00:00 | |
Less non-portable? | 01/01/70 00:00 | |
Less non-portable | 01/01/70 00:00 | |
portable, schmortable | 01/01/70 00:00 | |
Disagree! | 01/01/70 00:00 | |
how portable? | 01/01/70 00:00 | |
emphasis | 01/01/70 00:00 | |
Real world portable![]() | 01/01/70 00:00 | |
using - does not give the same result | 01/01/70 00:00 | |
try this | 01/01/70 00:00 | |
You are exceeeding 2 byte signed integer limits | 01/01/70 00:00 | |
Fighting the tools | 01/01/70 00:00 | |
Thanks all. | 01/01/70 00:00 | |
Dangerous | 01/01/70 00:00 | |
Very important warning! | 01/01/70 00:00 |