News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Problem with HPWM 5

Started by Yves, Sep 10, 2024, 01:31 PM

Previous topic - Next topic

Yves

Hello all,
I'm pulling my hair to run HPWM routine below. It runs all the time even when the duty cycle is at 0. Is some one could tell me where i'm going wrong? Many thanks in advance.
Yves


Device = 18F26K22

Declare Xtal = 64
Declare HPWM5_Pin PORTA.4 ' Select HPWM port and bit for PWM 5 module (ch 5) pin 6 in 18F26k22
Dim Duty_cycle as byte


While 1=1

    Duty_cycle = 200
    LED = 1
    HPWM 5, Duty_cycle, 2000
DelayMS 15000

 
                ---------------------
LED = 0
   
HPWM 5, 0, 2000
DelayMS 15000
   
Wend

Yves

midali

Hi Yves ,

Try this one :


Declare  CCP5_Pin   = PORTA.4