about this section
seems to be a common used here to exit from a IF THEN statement... sorry that's a bad practice IMHO and can overflow the stack really fast.Code:vertpulse = vertpulse + 1 IF vertpulse < 512 THEN GOTO horizloop ELSE GOTO buttonloop ENDIF horizloop:
about thisCode:vertpulse = vertpulse + 1 IF vertpulse >= 512 THEN buttonloop horizloop:
copy/paste error !?! something missing between ELSE and ENDIF ?!?Code:IF INTCON.1 = 0 THEN ' PORTB.4 goes high as close GOTO Resetcheck ' to the external trigger's ELSE ' rising edge as possible ENDIF
For HPWM... looks that you'll have to do it manually... the following is an example for a PIC18F2320
Code:' PIC18F2320 TRISC.2=0 ' CCP1 AS OUTPUT Tmr2dutyvar VAR WORD Tmr2dutyvar=86 ' ((1/3600)/4)/20Mhz / 16(prescaller) PR2=$57 ' load frequency period (PWM freq=3.6 KHZ) 'set Duty cycle CCP1CON.5=Tmr2dutyvar.1 CCP1CON.4=Tmr2dutyvar.0 CCPR1L =(tmr2dutyvar>>2) T2CON=%00000110 ' start timer 2 ' set prescaler = 16 CCP1CON = %00001100 ' pwm mode for CCP1 HERE: GOTO HERE




Bookmarks