Question about pwmout on a bidi pin...

vttom

Senior Member
I just got to thinking...

If, on a PICAXE with bidi pins (the 08M for example) I execute the following three instructions:

pwmout 2, 52, 105
input 2
output 2

What will be the state of pin2 after the 3rd instruction? Will it go back to wiggling according to the pwmout settings, or will it be at a static high or low?
 

eclectic

Moderator
The following program
Code:
#picaxe 08M

pwmout 2, 52, 52 ;DIM
pause 2000

input 2          ;OFF
pause 2000

output 2         ;DIM
pause 2000

pwmout 2, off

high 2           ;BRIGHT

stop
shows
Dim Off Dim Bright

e
 

vttom

Senior Member
Excellent. So I take that to mean that the PWM stays running internally even when I reverse the direction of the pin.

This will make my IR Remote Control project much easier, then. I can use "pwmout 2, 52, 105" (assuming 8MHz) to fire up a 38kHz carrier on pin 2, and then key it on and off with "input 2" and "output 2" without needing an external gate.
 
Top