well, now I have a new difficulty, trying to understand the calculator

Running OSC at 4mhz and PWM at 1khz I get:


And I found a post where Mister_e explains how to use it:
Code:
'
        '       38KHz PWM @ 4MHZ using a PIC16F877
        '       ----------------------------------
        @  __CONFIG _XT_OSC & _LVP_OFF
        '
        '
        TRISC = 0
        Duty        var byte
        
        '
        '       PWM SETUP
        '       =========
                ' PicMultiCalc says..
                '   Duty value for 50%=52
                '   PR2 = 25
                '   PRESCALLER 1:1
                '   
                '
        duty = 52                           ' duty value for 50% duty cycle
        PR2 = 25                            '
        T2CON = %00000100                   ' timer2 on, prescale 1:1
        CCPR1L = duty>>2                    ' MSB of duty cycle value
        CCP1CON=%00001100 | (dUTY<<5)       ' set PWM mode and store the 
                                            '   2 LSB of duty        
SpinInRound:
        goto spininround
If I understand correctly what you posted, I can start the HPWM before the main loop by using for example: HPMW 0,0,1000 and then within the loop adjust just the dutycycle.

Now what I dont understand is how I change the duty cycle, by using the calc I get 1000 values, but the duty variable is defined as BYTE

I could use some help/hint

Thanks!