2003-11-18 04:29 AM
jitter - when using Outout compare/pwm
2003-11-18 04:29 AM
hi !
i'm using the st72264 with the in dart and i encounter jitter which is un acceptional while using output compare function or even the PWM function. i measure time and when the time is over i toggle a pin (PB2) with a desire fix frequency. the jitter comes up every time the S/W has to deal with the toggle of the pin, let me explain, when i use the PWM function with OLV1 != OLV2 i get a fixed no jitter signal, but when i use the INT for toggling the bit (and with output compare )a jitter appears. i added the basic application : void main(void) { PBDDR = 0xFF; PBOR = 0XFF; // /* PORTS_Init(); // init ports */ ClrBit(PADDR,5); // set Port A, 5 and 7 pins as floating input ClrBit(PADDR,7); ClrBit(PAOR,5); ClrBit(PAOR,7); PCDDR |= 0x04; PCOR |= 0x04; MISCR1 |=0x20; /* using the output compare */ TBCLR = 0 ; // reset the counter TBCR1 = OCIE ; TBCR2 = Fcpu8 ; TBOC1HR = 0; TBOC1LR = 100; asm (''rim''); while(1) { } } // main loop interrupt 8 void TIMER_B_INT (void) { unsigned char temp=0; asm (''sim''); temp=TBSR; if (temp & OCF1) { TBCLR = 0 ; // reset the counter TBOC1HR = 0; TBCR1 = OCIE ; TBCR2 = Fcpu8 ; TBOC1LR = 100; if (ValBit(Data,j)) PBDR|=0x04; else { PBDR &= 0b11111011; } j++; if (j==9) j=1; } asm (''rim''); } and i attached an oscilloscope picture, what could be the problem ??????? adi. [ This message was edited by: Bamba on 18-11-2003 18:01 ] ________________ Attachments : TEK00001.PCX : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I08u&d=%2Fa%2F0X0000000bVh%2FquSf7QdXgWF0A1PpSkfjJYq17BKWDOztJJCH1e30fBc&asPdf=false