Very simple dimmer?
I am attempting to dim a 2v LED at a specified rate with just 1 pin from the SX chip and no other extra circuitry from that pin. Is this possible?
Here is kind of what i want to do :
dim_pin VAR RB.4
dim_rate VAR Byte
Main:
dim_pin = do_dim dim_rate
GOTO Main
do_dim:
'Dim function or sub
RETURN
Here is kind of what i want to do :
dim_pin VAR RB.4
dim_rate VAR Byte
Main:
dim_pin = do_dim dim_rate
GOTO Main
do_dim:
'Dim function or sub
RETURN

Comments
and then use the PWM command, changing the dutycycle to
control the led intensity.
regards peter
When the PWM command is finished, it makes the pin an INPUT.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Uhhhm, that was on fire when I got here...
www.iElectronicDesigns.com
·
RB.4 = 1
PWM RB.4, 0, 1000
....running something else even while the PWM command is still working
RB.3 = 1
PWM RB.3, 1, 2000
It turns the LED on for a spit second at a low voltage, but it does not dim or brighten. What do I have wrong?
FOR temp=255 TO 0 STEP -1
· PWM RB.3, temp, 10
NEXT
Also why are you doing "RB.3 = 1" ?
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Uhhhm, that was on fire when I got here...
www.iElectronicDesigns.com
·
Are you sure you're using a 33k resistor?· I wouldn't expect to see any light at all with that.· The suggested 270 ohm sounds more like it.· If the LED can handle 20mA, you could go as low as 150 ohms for max brightness.
Chris I.
' 5 Intensities FOR Hi_Nib = 0 TO 4 FOR Byt_Part = $00 TO $FF HIGH RA.3 PAUSEUS 100 LOW RA.3 PAUSEUS 900 NEXT Byt_Part NEXT Hi_Nib FOR Hi_Nib = 0 TO 4 FOR Byt_Part = $00 TO $FF HIGH RA.3 PAUSEUS 250 LOW RA.3 PAUSEUS 750 NEXT Byt_Part NEXT Hi_Nib FOR Hi_Nib = 0 TO 4 FOR Byt_Part = $00 TO $FF HIGH RA.3 PAUSEUS 500 LOW RA.3 PAUSEUS 500 NEXT Byt_Part NEXT Hi_Nib FOR Hi_Nib = 0 TO 4 FOR Byt_Part = $00 TO $FF HIGH RA.3 PAUSEUS 750 LOW RA.3 PAUSEUS 250 NEXT Byt_Part NEXT Hi_Nib FOR Hi_Nib = 0 TO 4 FOR Byt_Part = $00 TO $FF HIGH RA.3 PAUSEUS 950 LOW RA.3 PAUSEUS 50 NEXT Byt_Part NEXT Hi_Nib· Just FYI "RA.3 = 1" executes much faster (and generate less code) than "HIGH RA.3" because HIGH and LOW always sets the direction bit. Of course you must make sure the pin is already an output.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Uhhhm, that was on fire when I got here...
www.iElectronicDesigns.com
·