??? 06/28/05 23:09 Read: times |
#96146 - PSW not touched in recent version Responding to: ???'s previous message |
Hi Charles,
you're probably not using an up-to-date version of SDCC. The IRQ routine of a more recent version should compile to something which is pretty close to what you'd code in assembly: 304 ;servo.c:12: void Timer0_ISR (void) interrupt 1 0013 308 _Timer0_ISR: 0013 20 D5 0E 321 jb _F0,00102$ 0016 322 00107$: 323 ;servo.c:15: F0 = HIGH; 0016 D2 D5 325 setb _F0 326 ;servo.c:16: P1_0 = OFF; /* Turning on P1_0 */ 0018 C2 90 328 clr _P1_0 329 ;servo.c:17: TH0 = 0xFA; /* Setting timer start value to 64245 */ 001A 75 8C FA 331 mov _TH0,#0xFA 332 ;servo.c:18: TL0 = 0xF5; 001D 75 8A F5 334 mov _TL0,#0xF5 335 ;servo.c:19: TF0 = 0; /* Reset Timer Overflow Flag */ 0020 C2 8D 337 clr _TF0 0022 80 0C 339 sjmp 00103$ 0024 340 00102$: 341 ;servo.c:23: F0 = LOW ; 0024 C2 D5 343 clr _F0 344 ;servo.c:24: P1_0 = ON; /* Turning off P1_0 */ 0026 D2 90 346 setb _P1_0 347 ;servo.c:25: TH0 = 0xC3; /* Setting initial timer value to 50068 */ 0028 75 8C C3 349 mov _TH0,#0xC3 350 ;servo.c:26: TL0 = 0x94; 002B 75 8A 94 352 mov _TL0,#0x94 353 ;servo.c:27: TF0 = 0; /* Reset Timer Overflow Flag */ 002E C2 8D 355 clr _TF0 0030 356 00103$: 357 ;servo.c:30: return; 0030 359 00104$: 0030 32 360 reti 361 ; eliminated unneeded push/pop psw 362 ; eliminated unneeded push/pop dpl 363 ; eliminated unneeded push/pop dph 364 ; eliminated unneeded push/pop b 365 ; eliminated unneeded push/pop acc (using F0 as a FLAG probably is not a good idea (as Andy pointed out). If one really wanted to be sure this is preserved upon interrupt entry you'd have to use the attribute '_naked' for the IRQ routine and do the register saving by yourself) Note, there might be synergies with the project servomaster at http://servomaster.sourceforge.net/ Greetings, Frieder |