Proton BASIC Community

Proton (Positron) => Proton8 threads => Topic started by: xvovanx on Jan 30, 2024, 07:37 PM

Title: Positron PWM 2 channels problem
Post by: xvovanx on Jan 30, 2024, 07:37 PM
Hello!
Why do two PWM channels work perfectly on the old version of Proton 3.5.6.5, but only one PWM channel works on Proton newer versions 3.6.x.x and Positron? What's the Positron problem I don't understand?
Title: Re: Positron PWM 2 channels problem
Post by: trastikata on Jan 30, 2024, 09:00 PM
Hello,

add those declares and see if it works:

Declare HPWM1_Pin PORTC.2
Declare HPWM2_Pin PORTC.1


Title: Re: Positron PWM 2 channels problem
Post by: xvovanx on Jan 30, 2024, 09:27 PM
Thanks, worked  :)
Title: Re: Positron PWM 2 channels problem
Post by: top204 on Jan 31, 2024, 10:51 AM
For about 10 years, most PIC microcontrollers have PPS (Peripheral Pin Select), so the user can choose which pins do what for a particular peripheral (with some restrictions), so the Declares are required so the compiler can auto manage the PPS for a particular peripheral used by a command and load particular SFRs with the port and pin chosen, and if the microcontroller does not have PPS, it needs the declares to tell it what pins are used because microchip keep moving them around on devices, so a default pin is no use anymore. The HPWM command is one of those commands that use the CCP or PWM peripherals, so PPS comes into play with them if the device has it on-board.