PWM1_Set_Duty destroys its parameter (P12F1572)

Beta Testing discussion on mikroPascal PRO for PIC.
Post Reply
Author
Message
Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

PWM1_Set_Duty destroys its parameter (P12F1572)

#1 Post by Dany » 14 Oct 2021 19:49

I discovered that the PWM library of the P12F1572 (routine PWM1_Set_Duty) destroys it parameter value (sets it to zero).
Apparently it is a var parameter instead of a value parameter. In the latter case the parameter copy would be destroyed, and not the variable used to forward the parameter to the routine.
The PWM library used is __Lib_PWM_a025. This library is also used by the P12(L)F1571 and the P12LF 1572.
An easy solution (found after a relative long time) is to use an extra variable, give it the value of the PWM duty and pass that one on to the routine.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: PWM1_Set_Duty destroys its parameter (P12F1572)

#2 Post by filip » 19 Oct 2021 08:39

Hi,

Yes, you are right, the parameter is declared as var, I will forward this to our developers.

I apologize for the inconvenience.

Regards,
Filip.

Post Reply

Return to “mikroPascal PRO for PIC Beta Testing”