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 08:39
Read: times


 
#172586 - table lookup
Responding to: ???'s previous message
The lookup table together with the IRQ routine allows you to set Port1 with its 8 output pin (P1_0, P1_1, P1_2, ... P1_7) to any value with a time resolution of 0.1ms and a cyclic repetition of the pattern every 18 ms.

Maybe it helps to think of it as a kind of a (arbitrary) binary function generator with 8 outputs, fixed 0.1ms resolution and fixed pattern length of 180 entries.

Taking
servo(12,10,15,14);
of your posted code as example.

You'd want to setup the table so it gives you

0x0f,  /* 0.0 ms: pin0=1, pin1=1, pin2=1, pin3=1, pin4..7= 0 */
0x0f,  /* 0.1 ms:                              same          */
0x0f,
0x0f,
0x0f,

0x0f,
0x0f,
0x0f,
0x0f,
0x0f,

0x0b,  /* 1.0 ms: pin0=1, pin1=1, pin2=0, pin3=1, pin4..7= 0 */
0x0b,
0x03,  /* 1.2 ms: pin0=1, pin1=1, pin2=0, pin3=0, pin4..7= 0 */
0x03,
0x02,  /* 1.4 ms: pin0=0, pin1=1, pin2=0, pin3=0, pin4..7= 0 */

0x00,  /* 1.5 ms: pin0=0, pin1=0, pin2=0, pin3=0, pin4..7= 0 */
0x00,
0x00,
...    /* another 162 zero's following here */

 

when the table contents are read and fed to P1 with:
P1 = table_P1_over_time [ ms_tenth_countdown ];

(Note, I used a countdown to index the table so the compiler could later make use of the compact djnz instruction)

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