let pins and pwm

retepsnikrep

Senior Member
I have an 08M and I want to control some of the outputs high/low using let pins.

However I also have a pwm output set up on pin 2.

So if i use the command

let pins = %00010011 ;Switch on Outputs 0,1,4

and then later use

let pins = %00000000 ;Switch off Outputs 0,1,4

Will this also deactivate the pwm running on pin 2?

Or will it just stop it's output? so if I then used

let pins = %00010111 ;Switch on Outputs 0,1,2,4

Would the pwm output re-appear at the pin? Or would it have to be initialised?
 

alband

Senior Member
Good point.
This is a problem I've been stumped by in the past and have had to resort to "highing and lowing" the required pins manually. I checked the manual a few times looking for a "mask" (like with the interrupt setup" but there doesn't appear to be one.

If there is a better solution, I too would be keen to know it...
 

hippy

Ex-Staff (retired)
Often the best way is to try it ...

#Picaxe 08M
PwmOut 2,255,5
Pause 1000
pins = %00000000
Pause 1000
pins = %00010111
Do : Loop

Assigning pins= has no effect upon pin 2 output until a PWMOUT 2,OFF command is executed. Then the PWMOUT relinquishes its control over the I/O pin and the last pins= setting takes effect
 
Top