PWM -- SX/B Question
Macgruber
Posts: 20
So I've been trying to use some switching between an LED being full on and PWM and I'm running into some problems... The below code demonstrates what I'm seeing...
The behaviour I expected was that for the first second the LED is PWM and then after that it is full on... What I am seeing is that the LED goes off after the first second of PWM???
Why is this happening!?!
' BUG.SXB DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX, BOR42 FREQ 4_000_000 Led PIN RC.7 OUTPUT increaseVal VAR BYTE PROGRAM Start Start: increaseVal = 0 DO IF increaseVal > 10 THEN Led = 1 ELSE PWM Led, 50, 2 ENDIF PAUSE 100 INC increaseVal LOOP
The behaviour I expected was that for the first second the LED is PWM and then after that it is full on... What I am seeing is that the LED goes off after the first second of PWM???
Why is this happening!?!
Comments
During the PAUSE 100 there is no PWM to the LED.
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"The welfare of the people in particular has always been the alibi of tyrants." ~ Camus
www.iElectronicDesigns.com
·
From the help file PWM page:
After outputting the PWM pulses, the SX leaves the pin in input mode...
Sweet! Thanks! I was pulling my hair for a little bit there! Thanks for the help!