Hi, Darrel
I Was a bit surprised by those lines :
Code:
Line Address Opcode Label Disassembly
359 166 00BD MOVWF 0x3d
360 167 084C MOVF _HP_Channel, W
361 168 3C05 SUBLW 0x5
362 169 1C03 BTFSS STATUS, 0
363 16A 2975 GOTO L00001
364 16B 3001 MOVLW 0x1
365 16C 008A MOVWF PCLATH
366 16D 084C MOVF _HP_Channel, W
367 16E 0782 ADDWF PCL, F
368 16F 297A GOTO _GetCH_2
369 170 2975 GOTO L00001
370 171 297A GOTO _GetCH_2
371 172 297A GOTO _GetCH_2
372 173 297A GOTO _GetCH_2
373 174 297A GOTO _GetCH_2
374 175 0813 L00001 MOVF CCPR1L, W
375 176 00C0 MOVWF _HP_Temp
376 177 0815 MOVF CCP1CON, W
377 178 00C1 MOVWF _HP_Temp??HIGHBYTE
378 179 297A GOTO _GetCH_2
379 17A 0840 _GetCH_2 MOVF _HP_Temp, W
380 17B 00A0 MOVWF BANK0_START
381 17C 01A1 CLRF 0x21
382 17D 3002 MOVLW 0x2
383 17E 205A CALL SHIFTL
are those 6 times " GOTO _GetCH_2 " ( L368 , 370 - 373 , 378 ) something " regular " ???
the source for 12F683 @ 8 Mhz internal is :
Code:
@ __config _INTRC_OSC_NOCLKOUT &_FCMEN_OFF &_IESO_OFF & _WDT_ON &_PWRTE_ON & _MCLRE_OFF & _CP_OFF
OSCCON = %01110111 ' Internal Clock 8 Mhz
CMCON0 = 7
VRCON = 0
ADCON0 = 0
ANSEL = 0
DEFINE OSC 8 'Declare 8 Mhz operation
DEFINE PULSIN_MAX 4500
' PINS DEFINITIONS
Signal var GPIO.3
Drive var GPIO.2
GPIO = 0
TRISIO = %00001000
' VARIABLE DEFINITIONS
speed var Word ' assign Word variable to speed demand
w1 var Word ' Table output
DutyCycle VAR WORD
Frequency VAR WORD
Temp VAR WORD
include "HPWM10.bas"
LOW Drive ; Set CCP1 pin to output low
Frequency = 10000
'******************************************************************************
'MAIN LOOP
main:
pulsin Signal,0,speed ' Read servo pulse ( Inverted !!! )
'******************************************************************************
' Throttle amount topped to 100 and reduced to 25 steps
if speed > 300 then
speed = ( speed - 300 )MIN 100
else
speed = ( 300 - speed )MIN 100
endif
speed = speed >> 2
'******************************************************************************
' Conversion logarithmique 10 bits - 800 maxi à 10 khz
lookup2 speed, [0,0,161,277,378,467,543,611,670,721,766,804,836,867,893,_
933,950,965,978,990,1000,1009,1017,1023,1023 ],w1
'******************************************************************************
' !!! Passer en " HPWM 10 " !!!
if w1 <> DutyCycle then DutyCycle = w1
@ HPWM10 1, _DutyCycle, _Frequency
goto main
END
Regards
Alain
Bookmarks