Your duty-cycle technique sounds like it should give you what you expect = since=20 I use the same technique to vary LED brightness. I played with servos in= the=20 past, and did not have this problem. Have you tried separating the PIC c= kt=20 from the servo to isolate the problem? If you have an oscope, put a smal= l=20 load resistor at the output instead of the servo and see what you get the= n. =20 If clean, then the servo is causing the problem, and you could try swappi= ng=20 for another. If you still get that decay pattern, you have PIC problems.= =20 Try another port or PIC. Cheers, -Neil. On Sunday 15 June 2003 09:55, rneel@COX.NET scribbled: > I'm certainly no expert, but it looks like a classic capacitor discharg= e > issue to me. If you have a cap on this output, it will take time for i= t to > discharge causing the slow decay in voltage instead of a nice sharp cor= ner. > I can't see your circuit but do you have a cap connected across the pi= n > you measured with the scope? > > > From: Joel Middleton > > Date: 2003/06/15 Sun AM 01:21:50 EDT > > To: PICLIST@MITVMA.MIT.EDU > > Subject: [PIC]: Servo Pulse Problem > > > > I believe I am having a problem with the pulse I am > > sending to a servo connected directly to portb pin 3. > > I have tmr0 set to overflow ever .0001 seconds. The > > variable 'count' is incremented each time tmr0 > > overflows when count reaches 200 it is reset to 0. > > When count is equal to zero I set portb pin 3 and when > > count equals pw1 I clear the pin. I believe this > > should give me a 1ms pulse every 20ms. This was not > > working like I thought and I wanted to take a look at > > the pulse so I downloaded one of those ocilloscopes > > that runs through a sound card as I did not have > > access to a real one. Well I found out that I am not > > getting a nice square wave. The rising edge looks fine > > but the falling edge is a slope. Can anyone tell me > > how to correct this? I have included my code and also > > attached an image I captured from the occiloscope. > > Thanks. > > > > > > LIST R=3DDEC > > > > INCLUDE "p16f84a.inc" > > > > CBLOCK 0x0C > > _w > > _status > > _pclath > > _fsr > > count > > pw1 > > ENDC > > > > __CONFIG _CP_OFF & _WDT_OFF & _XT_OSC & _PWRTE_ON > > > > push macro > > movwf _w ;Save registers > > movf STATUS, w > > movwf _status > > movf PCLATH, w > > movwf _pclath > > clrf PCLATH > > endm > > > > pull macro > > swapf _pclath, w > > movwf PCLATH > > movf _status, w ;Restore registers > > movwf STATUS > > swapf _w, f > > swapf _w, w > > endm > > > > PAGE > > > > org 0 > > nop > > > > goto Main > > > > org 4 ;Interrupt > > > > push > > > > Timer0 > > btfss INTCON, T0IF > > goto Iend > > movlw 165 > > movwf TMR0 > > bcf INTCON, T0IF > > incf count > > movlw 200 > > subwf count, W > > btfss STATUS, Z > > goto Step1 > > movlw 0 > > movwf count > > Step1 > > movlw 0 > > subwf count, 0 > > btfsc STATUS, Z > > bsf PORTB, 3 > > movf pw1, W > > subwf count, 0 > > btfsc STATUS, Z > > bcf PORTB, 3 > > Iend > > > > pull > > > > retfie > > > > Main > > > > bsf INTCON, GIE > > bsf INTCON, T0IE > > > > bsf STATUS, RP0 > > bcf OPTION_REG, T0CS > > bsf OPTION_REG, PSA > > bcf STATUS,RP0 ; RAM PAGE 0 > > > > movlw 156 > > movwf TMR0 > > > > clrf PORTB > > > > bsf STATUS, RP0 > > bcf TRISA ^ 0x080, 1 > > bcf TRISA ^ 0x080, 2 > > clrf TRISB > > bcf STATUS, RP0 > > > > clrf PORTA > > clrf PORTB > > clrf count > > > > movlw 10 > > movwf pw1 > > > > Loop > > nop > > goto Loop > > end > > > > > > __________________________________ > > Do you Yahoo!? > > SBC Yahoo! DSL - Now only $29.95 per month! > > http://sbc.yahoo.com > > > > -- > > http://www.piclist.com hint: To leave the PICList > > mailto:piclist-unsubscribe-request@mitvma.mit.edu -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu