Searching \ for '[PIC] Need urgent help with pic code' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'Need urgent help with pic code'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] Need urgent help with pic code'
2007\03\16@054452 by Tal Go

flavicon
face
Hi All,



I was asked to build a flasher for my brother in law for his TV performance
2 weeks from now.



The idea is a circuit of 8 channel hi-bright led with a specific pattern.
When the circuit is powered on, all 8 channels are fade-in slowly for about
2 seconds (start to illuminate from off state to max bright light) when the
led are fully on, some pattern is running (any pattern, doesn't matter).



When power off, the led are fade out.



Can anyone help please?



Thanks in advance



Tal



2007\03\16@060219 by Alan B. Pearce

face picon face
>The idea is a circuit of 8 channel hi-bright led with a specific pattern.
>When the circuit is powered on, all 8 channels are fade-in slowly for about
>2 seconds (start to illuminate from off state to max bright light) when the
>led are fully on, some pattern is running (any pattern, doesn't matter).
>
>When power off, the led are fade out.

Look in the piclist.com archives for some code by Scott Dattalo for 8
channel PWM. That will give you the ability to fade in and out. Then you
just need to do the code for the pattern generation.

2007\03\16@070251 by Jinx

face picon face
> The idea is a circuit of 8 channel hi-bright led with a specific pattern.
> When the circuit is powered on, all 8 channels are fade-in slowly for
> about 2 seconds (start to illuminate from off state to max bright light)
> when the led are fully on, some pattern is running (any pattern, doesn't
> matter).

Here's something I'm working on, maybe you can adapt it or use the
method. What you could do is increment a variable (duty_on) over
2 secs, with a timer rather than ADC, and use duty_on's contents
as the mark:space ratio. The LED pattern is ANDed with the PWM
in RAM and sent to the port or the pattern comes out of the port and
the PWM is used to turn the LED transistor(s) on/off

This s/w reads a pot and outputs a duty cycle. In this case, 0/64 to
63/64. I need to add 64/64. 1/64th should be fine for LEDs. I'm
using 64ths because there's a lot of other stuff going on and there's
no time for finer resolution. This is for an 18F2520

;Set on:off duty

duty     anch3 ; select ADC channel 3, sample
        call    us10 ;short delay
        bsf     adcon0,go_done
        btfsc   adcon0,go_done
        bra     $-2

        movff   adresl,duty_on ;copy ADC result into variables
        movff   adresh,temp2

;divide ADC by 16, result in duty_on

        swapf   duty_on,w
        andlw   0x0f
        movwf   duty_on
        swapf   temp2,w
        iorwf   duty_on            ;number of slices on out of 64

In the timer loop

;test if this is an 'on' slice

tst_on   bcf     pulse             ;pin low in case not 'on'
        tstfsz  duty_on           ;keep off if not 'on' slice
        decf    duty_on           ;else decrement 'on' slices

        tstfsz  duty_on           ;skip if not 'on'
        bsf     pulse             ;o/p on

> When power off, the led are fade out.

You'll want to hold the power up to fade out. That suggests a
transistor controlling it

2007\03\16@100458 by Doug Metzler

picon face
Seems like you could have one PWM signal driving an NPN on the negative side
and then a small PNP for each bulb on the positive side to drive the
pattern.

DougM

{Original Message removed}

2007\03\16@114204 by Dr Skip

picon face
Not exactly a Pic (or even PC here perhaps... ;) but what about a large
cap and resistor to +V, LEDs powered off the cap, LED cathode to an OC
Binary to one-of decoder (I forget the number), then a counter to that
and a 555 as osc? Osc comes up with +V, RC=2, R can also be the dropping
resistance, and wire the outputs in the order you want since the pattern
doesn't have to change...

He said quick, and if he used variable res. in the rc part and the 555,
the dimming and the timing could be changed in instantly on the set (if
the director or anyone wants different), rather than reprogramming and
risking code problems 2 minutes before the show...

-Skip

>> The idea is a circuit of 8 channel hi-bright led with a specific pattern.
>> When the circuit is powered on, all 8 channels are fade-in slowly for about
>> 2 seconds (start to illuminate from off state to max bright light) when the
>> led are fully on, some pattern is running (any pattern, doesn't matter).
>>
>> When power off, the led are fade out.
>>    

2007\03\16@115822 by Bob Barr

flavicon
face
On Fri, 16 Mar 2007 11:45:58 +0200, "Tal Go" wrote:

<snip>
>
>When power off, the led are fade out.
>

Depending on the size of your power supply filter caps, that will
happen pretty much automatically, won't it? :=)


Regards, Bob

2007\03\16@180458 by Jinx

face picon face
I wrote -

> In the timer loop
>
> ;test if this is an 'on' slice

That should be "In the timer ISR". There's another pot to set the
frequency, and its result goes into 16-bit TMR0

2007\03\16@213616 by Jinx

face picon face

> Thanks for your help, but I have very lack skills to write my own code.
>
> I thought the piclisters will direct me to ready or semi-ready project so
I
> can try to build in a short time

You might Google for 555 pwm pin 5 as you want to control it with a
rising and falling voltage. I have seen a circuit for the 555 as an audio
amplifier, using signal into pin 5 and the output (pin 3) to drive a small
speaker with PWM (Class D I think that is)

Googling for that might help

> It seems that I have to give up the fancy PIC+PWM and use some
> 555 + 4017

Never mind. Two weeks is not long to learn PIC

Another common PWM chip is the TL494. You'll often find them in
old switch-mode PSUs

More... (looser matching)
- Last day of these posts
- In 2007 , 2008 only
- Today
- New search...