Page 1 of 1

How to Skip at a set number of button pushes

Posted: Fri Sep 17, 2010 2:15 pm
by trisb
Hi Guys.

I have a Simply PWM signal that goes up and down in 10% steps at the press of a button.
How ever if the Up power button is pressed 10 times and the PWM is up to 100% it will revert back to 0%.

What do i need to do to get it to skip this part of my code if the button has been pushed 10 times...
I have tried many ways but have not been able to work it out.

Could some one help my out. copy of program attached.

Thanks Tristan.

Re: How to Skip at a set number of button pushes

Posted: Fri Sep 17, 2010 2:47 pm
by Benj
Hello Tristan,

I have added decisions into your macro to detect if the PWM is already at one or the other extreme. If the extreme is detected then the PWM signal will not be allowed to go beyond this.

Re: How to Skip at a set number of button pushes

Posted: Fri Sep 17, 2010 2:51 pm
by trisb
Thanks Ben,,

That just what i was looking for.

Have a good weekend.

Tristan

Re: How to Skip at a set number of button pushes

Posted: Fri Sep 17, 2010 3:23 pm
by Dan81
Hello Tristan

If you want to have 10% steps (exactly) , you must change the period register to 249.
Or you will not be able to get 100% (but only 98% as you can see in the simulation)

Daniel

Re: How to Skip at a set number of button pushes

Posted: Wed Sep 22, 2010 1:38 pm
by trisb
Thanks Daniel.