************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Hi, Darrel
I Was a bit surprised by those lines :
are those 6 times " GOTO _GetCH_2 " ( L368 , 370 - 373 , 378 ) something " regular " ???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
the source for 12F683 @ 8 Mhz internal is :
RegardsCode:@ __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
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
The lines showing the same labels is the result of Disassembling.
There are actually 6 different labels, with the code in-between optimized out since the chip doesn't have 5 CCP modules.
It comes from this section ...
The GOTO's are created by the Branch statement.Code:;----- Get Current DutyCycle ------------------------------------------------ Branch HP_Channel,[GetCH_Done,GetCH_1,GetCH_2,GetCH_3,GetCH_4,GetCH_5] GetCH_1: ASM ifdef CCP1CON MOVE?BB CCPR1L, _HP_Temp MOVE?BB CCP1CON, _HP_Temp + 1 goto _GetCH_Done endif endasm GetCH_2: ASM ifdef CCP2CON MOVE?BB CCPR2L, _HP_Temp MOVE?BB CCP2CON, _HP_Temp + 1 goto _GetCH_Done endif endasm
And it looks like this in the .LST file ...Since the labels are all at the same address, the disassembler chooses the first label it finds at that address (_GetCH_2).Code:016B 3001 M movlw (jmptbl) >> 8 016C 008A M movwf PCLATH 016D 084C M movf _HP_Channel, W 016E 0782 M addwf PCL, F 016F M jmptbl 016F 297A M goto _GetCH_Done 0170 2975 M goto _GetCH_1 0171 297A M goto _GetCH_2 0172 297A M goto _GetCH_3 0173 297A M goto _GetCH_4 0174 297A M goto _GetCH_5 0175 M L00001 0175 M _GetCH_1 0175 0813 M movf CCPR1L, W 0176 00C0 M movwf _HP_Temp 0177 0815 M movf CCP1CON, W 0178 00C1 M movwf _HP_Temp + 1 0179 297A 00326 goto _GetCH_Done 017A M _GetCH_2 017A M _GetCH_3 017A M _GetCH_4 017A M _GetCH_5 017A M _GetCH_Done
DT
Hi, Darrel
Tanks for your explanation
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Bookmarks