I don't want to confuse you but this does not translate to Pin2 being off. It just means it's held low. If you connected a LED with limiting resistor between Pin2 and the Vdd (+5V) the LED would turn on brightly when PwmOut is executed and then ramp down when the PwmDuty loop is executed. .. Capice?
Yes, sir. I do.
The thing that screwed me up was thinking "99" as being the number of on/off cycles, when in reality it's the length of a SINGLE on/off cycle, and 400 is the length of a single ON cycle @100%. It's the word variable (0 to 400) in the "for next" loop (pwmduty C.2, w1) that ramps up the brightness of the LED.
I still don't understand how the 99/400 is calculated, but I don't need to know. I know enough for now.
On thing that puzzles me, and this has nothing to do with PWM, I was writing the code for my "deflector dish control", for when I get my 14M2 chip (as I need two PWM ports for this). In writing my code, I copied this section of the code I'm using now with my 08M2 chip.
Code:
main:
If pressed=1 then 'Test the status of the switch
pressed = 0 'Reset the the switch status for the next press
If counter >4 then 'If the counter is > 4
counter=0 'reset it to start over again
endif 'end the if statement
In the picaxe programming editor I changed my chip to the 14M2 to run the simulator, but it flagged my code "if command without endif", but this code runs perfectly fine in the code I borrowed it from. The simulator doesn't complain about a missing endif. Wuzzup with that? Is it just a glitch, or did overlook the missing endif in the previous code?
Another thing, it flagged the interrupt command for debouncing my switch....
Code:
init:
setint %00001000,%00001000 ' activate interrupt when pin3 only goes high
'pin3 is the push button
the interrupt command can only be used on pins C.0 to C.2 on the 14M2. That's strange because ONLY pin C.3 is an
input only according to the 14M2 pinout. C.0, 1 and 2 are inputs or outputs. If I use the interrupt command for C.0, will it automatically recognize C.0 as an input?
For the interrupt to be active high on pin C.0, would I type it as....
Code:
setint %00000001,%00000001
????