What kind of servo (brand/model). John Ferrell 6241 Phillippi Rd Julian NC 27283 Phone: (336)685-9606 johnferrell@earthlink.net Dixie Competition Products NSRCA 479 AMA 4190 W8CCW "My Competition is Not My Enemy" ----- Original Message ----- From: "Joel Middleton" To: Sent: Sunday, June 15, 2003 1:12 PM Subject: Re: [PIC]: Servo Pulse Problem > I found this schematic on the web and this is my exact > circuit except the servo signal is connected to pin 3 > on portb. Also I have all the unused pins connected to > ground. Anyone see anything wrong with the circuit? > > > --- rneel@COX.NET wrote: > > 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 > > > > > > > > > ATTACHMENT part 2 image/pjpeg name=pulse.jpg > > > > __________________________________ > 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