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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/19/10 11:00
Read: times


 
#172592 - absolutely-locating xdata at 256 byte boundary
Responding to: ???'s previous message
Andy Neil said:
Frieder Ferlemann said:
unsigned char __xdata __at(0x0000) table_P2_over_time[200 + 1];

I guess that's SDCC syntax?

Yes it's SDCC syntax.

Keil would be somewhat different.

What is the point in absolutely-locating it? Seems unnecessary to me...


The point is to tell the compiler that it's located at a 256 byte boundary. So it does not need a full 16 bit addition of array base address and index but instead can directly load dpl with the high byte of the address and dpl with the index.

So you the 8bit indexed xdata array access is only:

   0006 85*00 82            383         mov     dpl,_ms_tenth_countdown
   0009 75 83 00            384         mov     dph,#(_table_P2_over_time >> 8)
   000C E0                  385         movx    a,@dptr

 

instead of:
   000B E5*00               386         mov     a,_ms_tenth_countdown
   000D 24r00               387         add     a,#_table_P2_over_time
   000F F5 82               388         mov     dpl,a
   0011 E4                  389         clr     a
   0012 34s00               390         addc    a,#(_table_P2_over_time >> 8)
   0014 F5 83               391         mov     dph,a
   0016 E0                  392         movx    a,@dptr

 


AFAIK you'd tell Keil the absolute location of the variable at the linking stage (which is to late for code generation so the 16 bit addition has been generated). So out of the box Keil probably cannot do it.


void Timer0_ISR (void) interrupt 1 {

For Keil, consider adding a using option to specify a Register Bank - this can significantly reduce the overhead on entering & leaving the ISR...


For SDCC you can consider using using as well. But as SDCC doesn't use R0..R7 in the proposed code snippet there is no overhead to reduce:^)

List of 41 messages in thread
TopicAuthorDate
Controlling multiple servo motors            01/01/70 00:00      
   executing code takes time            01/01/70 00:00      
      PWM code            01/01/70 00:00      
         Thanks...now, about the PCA timer..            01/01/70 00:00      
   If SDCC Then Keil            01/01/70 00:00      
      PWM IRQ code in C, bitops, 45 byte            01/01/70 00:00      
         Optimization having no effect.            01/01/70 00:00      
      PWM IRQ code in C, lookup table, 32 byte            01/01/70 00:00      
         I haven't understood the table lookup concept very well...            01/01/70 00:00      
            table lookup            01/01/70 00:00      
         PWM IRQ code in C, lookup table, 30 byte            01/01/70 00:00      
            Compiler specifics            01/01/70 00:00      
               absolutely-locating xdata at 256 byte boundary            01/01/70 00:00      
                  I see.            01/01/70 00:00      
            An example code..            01/01/70 00:00      
               Keil: Specifics and non-specifics            01/01/70 00:00      
                  Not really working...            01/01/70 00:00      
                     Enough power?            01/01/70 00:00      
                        RE: running 32 servo motors            01/01/70 00:00      
      The chip sounds perfect...            01/01/70 00:00      
         not worth it            01/01/70 00:00      
            Servo control will become difficult then...            01/01/70 00:00      
               output            01/01/70 00:00      
               HCT chips have ...            01/01/70 00:00      
                  Eval a concept with a single PCA and 3:8 HCT multiplexer?            01/01/70 00:00      
               Check their website            01/01/70 00:00      
                  Here is the code...            01/01/70 00:00      
                     "sbit MTRS=P2^0;" is not OK here            01/01/70 00:00      
                        Keil syntax?            01/01/70 00:00      
                           "#define" not working.."sbit" works            01/01/70 00:00      
                              Yes, you were correct originally!            01/01/70 00:00      
            Seconded            01/01/70 00:00      
   Servo_0.1.zip            01/01/70 00:00      
      links            01/01/70 00:00      
   Eventually feed the guys at http://servomaster.sf.net ?            01/01/70 00:00      
      servomaster.sf.net FLOSS            01/01/70 00:00      
   Maybe of some use...            01/01/70 00:00      
      Whoops... found a bug            01/01/70 00:00      
         What bug?            01/01/70 00:00      
            Bug            01/01/70 00:00      
   Improved version uploaded            01/01/70 00:00      

Back to Subject List