This is a multi-part message in MIME format. ------=____1055688955633_Un+_btMaRs Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit I'm certainly no expert, but it looks like a classic capacitor discharge issue to me. If you have a cap on this output, it will take time for it to discharge causing the slow decay in voltage instead of a nice sharp corner. I can't see your circuit but do you have a cap connected across the pin 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=DEC > > 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 ------=____1055688955633_Un+_btMaRs Content-Transfer-Encoding: base64 Content-Type: image/pjpeg; name="pulse.jpg" Content-Disposition: inline; filename="pulse.jpg" /9j/4AAQSkZJRgABAgEASABIAAD/wAALCABXAWQBAREA/9sAhAAFAwMEAwMFBAQEBQUFBgcN CAcHBwcQCwwJDRMQFBMSEBISFRceGRUWHBYSEhojGhwfICEiIRQZJSckICceISEgAQUFBQcG Bw8ICA8gFRIVFSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICD/xADSAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgsQAAIBAwMCBAMFBQQEAAAB fQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2 Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqi o6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5 +v/aAAgBAQAAPwD7Looooooooooooooooooooooooooooooooooooooooooooooooooooooo ooooooooooooooooooo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