120ThingsIn20Years
Senior Member
I'm not sure what you are trying to do ( other than exploring or randomly trying things ) but PWM and PWMOUT are two entirely different commands. PWM is software generation, PWMOUT is hardware background generation of a PWM signal.
What's happening is that when you issue a PWMOUT pin,OFF or PWMOUT pin,0,0 ( they are the same ) you are actually turning background PWM generation on in order to set it to 'off'.
I must admit I'm not clear on what you see happening which is wrong and I haven't tested it nor simulated it. Perhaps you could provide an example bit of code to demonstrate what the issue is ?
My discovery was just because I happened to be using the obsolete ...
PWM PIN.#, #,#
and when it was suggested I try instead
PWMOUT PIN.#,#,#
I appended the second command to the program to experiment with it as a comparison as in the code within post 316
When I did so I got unexpected results as the
PWMOUT PIN.#, OFF
command, and the
PWMOUT PIN.#,0,0
command both failed to turn off the LED when following a prior
PWM PIN.#, #,#
command
But all is well.
Obsolete commands are obsolete commands. The only reason I was using
PWM PIN.#,#,#
was because I didnt understand the distinction between PWM and the command "PWM" when Pete suggested I look at PWM next.
But like I said obsolete commands are obsolete commands.
----------------------------------------------------------
So for your own interest, if you have a ...
PWM PIN.#, #,#
command followed at some later stage in you code by a ...
PWMOUT PIN.#,#,#
the commands...
PWMOUT PIN.#, OFF
and..
PWMOUT PIN.#,0,0
work in simulate mode, but do nothing in the real world
---------------------------
this could actually have some real world impact as C.1 can still be used with the PWM but if you try to use PWMOUT on C.1 you get
"Error: Invalid pwmout pin!" as it isn't supported.
This means that the user that has used PWMOUT on C.2 might be tempted to try PWM on C.1 as well. If they do they could be in for some grief if they want to use...
PWMOUT PIN.#, OFF
or...
PWMOUT PIN.#,0,0 .
If they try to squeeze an extra PWM'ed output out of an 08M chip, and code the PWM stuff on C.1, and then the PWMOUT stuff on C.2, they will find they cant turn off C.2.
I've checked it a few times.