Try this and see what happens, should give you a 50% duty cycle ~36khz square wave on your o'scope:
And take note of Mr_E's note about adding values.Code:@ DEVICE pic16F877, HS_OSC ; System Clock Options @ DEVICE pic16F877, WDT_OFF ; Watchdog Timer @ DEVICE pic16F877, PWRT_ON ; Power-On Timer @ DEVICE pic16F877, BOD_OFF ; Brown-Out Detect @ DEVICE pic16F877, CPD_OFF ; Data Memory Code Protect @ DEVICE pic16F877, PROTECT_OFF DEFINE OSC 20 load con 65468:intcon=$c0:option_reg=0:adcon1=$87:t1con=1:pie1=1:c var byte goto main ON INTERRUPT GOTO SINUS TMR1L=LOAD.lowbyte:TMR1H=LOAD.highbyte MAIN: GOTO MAIN DISABLE SINUS: if pir1.0=1 then pir1.0=0:tmr1l=load.lowbyte:tmr1h=load.highbyte:c=c+1:portb.0=c.0 endif RESUME ENABLE END




Bookmarks