Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 13:29 11 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : PWM Channel, STOP Query

Author Message
Chopperp

Guru

Joined: 03/01/2018
Location: Australia
Posts: 1106
Posted: 06:07am 10 Jun 2018
Copy link to clipboard 
Print this post

Hi,

As an aside to Zonker's post on PWM, can anyone tell me why the PWM STOP code within the loop prevents the actual PWM code from working. Place it outside the loop & it works as expected.

I can't see that I am doing anything wrong.

option autorun on

do
for x = 1 to 9
'pwm 1,stop 'Loop does not work with this enabled
width = x * 10
pause 1000
pwm 1, 100, width
next x

pwm 1,stop 'Loop works with this enabled

loop

ChopperP
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4126
Posted: 06:55am 10 Jun 2018
Copy link to clipboard 
Print this post

With it in the loop you will do this:
1. at x=1, start the pwm
2. at x=2 (about 10uS later or so) you will stop the PWM

and so on.

So it is working but you immediately stop it as there is no time delay between loops.

John
 
Chopperp

Guru

Joined: 03/01/2018
Location: Australia
Posts: 1106
Posted: 07:37am 10 Jun 2018
Copy link to clipboard 
Print this post

Thanks John.

Works with the pause moved down a bit.
ChopperP
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025