; Let me give it a shot ; 2000 usec - 200 usec = 1800 usec ; 1800 usec/256 = 7 used bsf Aport,0 ;start the PWM output movlw 65 ;set up delay for minimum width movwf Loop_Counter Loop1 decfsz Loop_Counter goto Loop1 Loop2 movf Pulse_Width,w ;Get the desired pulse width subwf Loop_Counter ;Compare to the current loop count skpnc ;if current count is >= desired count bcf Aport,0 ;then terminate the pulse incfsz Loop_Counter ;count up the loop until it rolls over goto Loop ;back around to beginning of loop ______________________________ Reply Separator _________________________________ Subject: Timing Pulses Author: esukq@CSV.WARWICK.AC.UK at internet Date: 11/5/96 3:00 PM Hi, i need some help, i am trying to time a PWM signal whose length varies from 0.2-2mili seconds, i am using a loop at the moment that increments a counter until the pulse drops back to 0. The problem is that it does not seem to work very well. I need to get about 8 bits resolution. I will email the code if that helps. Thanks in advance. PS I am using a PIC16C84 running with a 4MHz crystal. -- +-------------------------------------------------------------------+ | Martin Bowman - University of Warwick, Coventry, UK | | - 3rd Year Electronic Engineering | | - E Mail (esukq@warwick.ac.uk) | | - Packet G7VHE@GB7COV.GBR.EU | +------------------ IF IT AINT BROKE - DONT FIX IT -----------------+