--0-1236380810-1055654510=:40835 Content-Type: text/plain; charset=us-ascii Content-Id: Content-Disposition: inline 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 --0-1236380810-1055654510=:40835 Content-Type: image/pjpeg; name="pulse.jpg" Content-Transfer-Encoding: base64 Content-Description: pulse.jpg Content-Disposition: inline; filename="pulse.jpg" /9j/4AAQSkZJRgABAgEASABIAAD/wAALCABXAWQBAREA/9sAhAAFAwMEAwMF BAQEBQUFBgcNCAcHBwcQCwwJDRMQFBMSEBISFRceGRUWHBYSEhojGhwfICEi IRQZJSckICceISEgAQUFBQcGBw8ICA8gFRIVFSAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICD/xADSAAABBQEBAQEB AQAAAAAAAAAAAQIDBAUGBwgJCgsQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUS ITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2 Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqS k5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh 4uPk5ebn6Onq8fLz9PX29/j5+v/aAAgBAQAAPwD7Looooooooooooooooooo oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo oooooorM17xZoHhWEza9rmmaVEIjMXvbtIVCB0QtliOA0sak9MyKOrDPP/8A C9vhZ/0UvwZ/4Pbb/wCLo/4Xt8LP+il+DP8Awe23/wAXW14Y8d+FfGv2j/hG fEui639l2+f/AGdfR3Hlbs7d2wnbna2M9cH0rZoooooooooooorn/EfxJ8F+ Db5LDxH4v8P6NdyRCZIL/Uord2QkgMFdgSMqwz0yD6Vmf8L2+Fn/AEUvwZ/4 Pbb/AOLo/wCF7fCz/opfgz/we23/AMXXQeG/FmgeMbF77w5rmmazaRyGF57C 7S4jVwASpZCQDhlOOuCPWtOiiiiiiiiiiiiiiiiiiiiiiiuGvrC01/46aZM1 r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