Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
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


List of 30 messages in thread
TopicAuthorDate
General Pulse Width Modulation on 8051            01/01/70 00:00      
   The logic seems good            01/01/70 00:00      
      How to post code            01/01/70 00:00      
      Code I'm using            01/01/70 00:00      
         Problem lies with SDCC and PSW handling.            01/01/70 00:00      
            similar "issue" with Keil?            01/01/70 00:00      
            PSW not touched in recent version            01/01/70 00:00      
               Old SDCC (ver ??) vs New SDCC (ver 2.50)            01/01/70 00:00      
                  strange            01/01/70 00:00      
                     not strange, sorry            01/01/70 00:00      
                        Still no good            01/01/70 00:00      
                           Still not strange            01/01/70 00:00      
   Alternative method            01/01/70 00:00      
   65536, not 65535            01/01/70 00:00      
      Caught that errror            01/01/70 00:00      
         why not use the PCA, it is made for this            01/01/70 00:00      
            No PCA available            01/01/70 00:00      
               slim PICkins            01/01/70 00:00      
               go ahead, spend $7            01/01/70 00:00      
                  Why not read 8051 stuff?            01/01/70 00:00      
                     Excellent - Thanks            01/01/70 00:00      
                  Atmel Flip            01/01/70 00:00      
                     MAX232(equivalent)            01/01/70 00:00      
                        Another Option            01/01/70 00:00      
                     level convertor            01/01/70 00:00      
                        aka "Transceiver"            01/01/70 00:00      
         JSIM.EXE is all you need and it FREE.            01/01/70 00:00      
   Still not strange            01/01/70 00:00      
   Follow Up to the original post            01/01/70 00:00      
      Dumb and dumberrer            01/01/70 00:00      

Back to Subject List