Thank s Kiste
. oops, I've now replaced all on/off's with set_dutycycle_percent(..)
 the program that I use works fine with PWM1 but not with PWM2.
 So there must be a difference.
 Where should I look now?

Op maandag 4 april 2022 om 12:04:31 UTC+2 schreef Kiste:

> Sorry, no. 
>
> PWM2_off() does not set the LED off, it switches off the PWM module and 
> passes control of the output pin back to the simple digital output. The 
> digital output can be randomly set to "on", you did not set it to "off".
>
> If you want to keep PWM running and switch off the LED, use
>
> pwm2_set_dutycycle_percent(0)
>
> pwm2_on() and pwm2_off() is not switching the *output* to on or off, it 
> starts or stops the PWM module. If you want to set LED brightness, you 
> don't want to ever stop the module. It's like waiting at the traffic 
> lights: You're setting the car speed to zero (=duty_cycle(0)), but you 
> don't switch off the engine (=pwm_off()). If the street's going downhill, a 
> switched off engine will not surely prevent the car from moving. You need 
> to use the right means for the purpose of stopping the car. 
>
> Greets,
> Kiste
>
> Am Montag, 4. April 2022, 11:43:01 MESZ hat hans <[email protected]> 
> Folgendes geschrieben: 
>
>
> Hi Kiste,
> PWM2_off() sets the led ON and PMW2_on () sets the light off.. 
> regards Hans
>
> Op maandag 4 april 2022 om 09:21:03 UTC+2 schreef Kiste:
>
> Hi hans,
>
> this is what the program should do if the LED is connected to RC1 and GND 
> (with resistor):
>
> The LED will slowly light up from off to 99% within one second,
> then it will fade from 99% to 1% within another second.
>
> The LED stays at 1% for half a second
>
> PWM is disabled, so the LED will reflect the port pin, which is undefined 
> by default, for half a second 
>
> Then, PWM is reactivated and the LED will resume at 1% for 5 seconds, 
> before starting over again.
>
> That is not what you're seeing?
>
> Greets,
> Kiste
>
>
>
> Am Sonntag, 3. April 2022, 16:10:38 MESZ hat hans <[email protected]> 
> Folgendes geschrieben: 
>
>
> A question from a friend. Attached is a test program for the use of the 
> second PWM port C1. The results are opposite to the assignment. On is off 
> and off is on. See the end of the file, the LED would go on for a long time 
> but then it is just off 
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "jallib" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jallib/0fc3bf61-ee5b-435f-a883-fbe7e1f9188fn%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jallib/0fc3bf61-ee5b-435f-a883-fbe7e1f9188fn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "jallib" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
>
> https://groups.google.com/d/msgid/jallib/977fd495-4f9e-40f7-b9eb-caa72e361cd4n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jallib/977fd495-4f9e-40f7-b9eb-caa72e361cd4n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/8c775643-0126-4106-97d9-c807e0485fc2n%40googlegroups.com.

Reply via email to