I'm having trouble getting a simple pwm output on a 14M version.
My program is back to basics turning a pulse train on and off on pin 5, or that's what I wanted . . .
What happens is that it works as expected exactly 8 times on the eighth time the pin goes high and switches the pwm on and off as always. On the scope it looks like zero volt baseline, with a half second of square wave, going to +4 volts. On the eighth time the base line shifts to +4 and the pulses go to zero.
The led turns on and off eight times, then gets brighter and dimmer eight times, then back to on and off eight times.
I figure there's something I'm not understanding about using inputs as outputs on the 14M. I passes the syntax check and I did try adding the "portc" instruction and it still does the baseline shift.
My program:
My program is back to basics turning a pulse train on and off on pin 5, or that's what I wanted . . .
What happens is that it works as expected exactly 8 times on the eighth time the pin goes high and switches the pwm on and off as always. On the scope it looks like zero volt baseline, with a half second of square wave, going to +4 volts. On the eighth time the base line shifts to +4 and the pulses go to zero.
The led turns on and off eight times, then gets brighter and dimmer eight times, then back to on and off eight times.
I figure there's something I'm not understanding about using inputs as outputs on the 14M. I passes the syntax check and I did try adding the "portc" instruction and it still does the baseline shift.
My program:
Code:
'Led output
'pickaxe 14M
start:
pause 100
pwmout 2,100,200 'generate 10khz pulse train on pin5 (output2)
pause 500 'wait half a second
pwmout 2,0,0 'turn off pulse train on pin 5
pause 500 'wait half a second
goto start 'repeat forever