New to the whole pic thing. Got them blinking though. Here is my
question what is the best pic chip for the job.

1. Lowest power consumption pic
2. Run 6 to 12 Leds
3. Work on battery's - Like 4 double AA's
4. Can run some sort of clock program that is user programmable to turn
off and on at certain times. - Still trying to master the code on this
one, also I will take interface Ideas on this one. Could it be possible
to use jumper settings for this?

Well, for low power consuption, you might want to try some of the new
nanowatt PICs. I think the 16F87 and the 18F1320 both have this.

To run 6 to 12 LEDS, you will need 6 to 12 IO pins. Also, you will
probably want a few more inputs and outputs for buttons, or jumpers.
Most of the PICs with more than 18 pins should cover this.

As for using jumpers for configuration, You would need some sort of
system to connect the pin to either ground or 5V, depending on the
jumper status. I'm not sure if the pin reads high or low when just
disconnected.

I think nearly all of the PICs should cover all these requirements,
except the tiny 8 pin devices, and probably not the 18 pins (unless
you use strobing).

>
> New to the whole pic thing. Got them blinking though. Here is my
> question what is the best pic chip for the job.
>
> 1. Lowest power consumption pic
> 2. Run 6 to 12 Leds
> 3. Work on battery's - Like 4 double AA's
> 4. Can run some sort of clock program that is user programmable to turn
> off and on at certain times. - Still trying to master the code on this
> one, also I will take interface Ideas on this one. Could it be possible
> to use jumper settings for this?
>
> Thanks for the input - a humble new guy.
>
> James
>

> New to the whole pic thing. Got them blinking though. Here is my
> question what is the best pic chip for the job.
> 1. Lowest power consumption pic

The nanowatt series are supposed to use low power.. They come with internal
oscillators too... Also, look for the low power parts instead of the standard
parts..

> 2. Run 6 to 12 Leds

Any 18pin PIC has enough I/O lines to control 12 LEDs...

> 3. Work on battery's - Like 4 double AA's

Yeah, they can definitely work on batteries... and if you use the low power
parts, you may not even need 4x..

> 4. Can run some sort of clock program that is user programmable to turn
> off and on at certain times. - Still trying to master the code on this
> one, also I will take interface Ideas on this one. Could it be possible
> to use jumper settings for this?

Well... you could use the EEPROM to store user settings... You could use a
7seg display or LCD for the output.. but I'm not too sure what the jumpers
would be for... You could use pushbuttons and build a simple menu system...

Sounds a bit ambitious for a starter project though.. You might want to build
it bit by bit and learn things one at a time.. Good luck!!!

> To run 6 to 12 LEDS, you will need 6 to 12 IO pins. Also, you will
> probably want a few more inputs and outputs for buttons, or jumpers.
> Most of the PICs with more than 18 pins should cover this.

As it was specifed, 18 would do.

> As for using jumpers for configuration, You would need some sort of
> system to connect the pin to either ground or 5V, depending on the
> jumper status. I'm not sure if the pin reads high or low when just
> disconnected.

Internal pullup and jumpers to gnd.

With some clever technices you can get three "levels"
on each pin (high/low/open), or more using external
resistor networks.

> I think nearly all of the PICs should cover all these requirements,
> except the tiny 8 pin devices, and probably not the 18 pins (unless
> you use strobing).

> 1. Lowest power consumption pic
> 2. Run 6 to 12 Leds
> 3. Work on battery's - Like 4 double AA's
> 4. Can run some sort of clock program that is user programmable to turn
> off and on at certain times. - Still trying to master the code on this
> one, also I will take interface Ideas on this one. Could it be possible
> to use jumper settings for this?
> Thanks for the input - a humble new guy.

If you are running a clock, then you need to run all the time, or have a
pic that can take a second crystal for realtime clock at 32.768 KHz. Your
real power consumption, especially if you run the LEDs even occasionally,
is not going to be affected much by your choice of PIC.

How about 2 or 3 AA batteries? Then you will not need a regulator(save
current that way too).

Since you are a beginner, do it as simply as possible, which means no
multiplexing of pins. Get a 40 pin PIC like the 16F877(A) or 18F452.

> Well, for low power consuption, you might want to try some of the new
> nanowatt PICs. I think the 16F87 and the 18F1320 both have this.

The 16LF87/88 will run down to 2 volts, so a 3 volt lithium cell could be
comfortable. They have an onboard oscillator freeing up two more pins as
I/O, and the oscillator is programmable so you can manage the power
consumption even further.

> I think nearly all of the PICs should cover all these requirements,
> except the tiny 8 pin devices, and probably not the 18 pins (unless
> you use strobing).

He is only talking 6-12 LEDs plus a button or two. An 18 pin part with an
onboard oscillator is going to have 15 or 16 pins available, depending on
whether you reuse !MCLR. If you want to do ICSP and have obnoxious
circuitry on all pins you might get down to 13 I/O. With two buttons,
that's still 11 LEDs. If you insist on a crystal you are down to 9 LEDs,
and that's worst case, still in the 6-12 range.

On 5/26/05, Dave Turner <dave.w.turnerKILLspamgmail.com> wrote:
> As for using jumpers for configuration, You would need some sort of
> system to connect the pin to either ground or 5V, depending on the
> jumper status. I'm not sure if the pin reads high or low when just
> disconnected.

For minimum parts cound, enable the "weak pull-up" option and use
jumpers shorting to ground. That costs an extra 50-400 uA per pin
grounded. To save current, you could turn on the weak pull up before
you read the jumpers and back off afterwards.

Regards,
Mark
markrages@gmail
--
You think that it is a secret, but it never has been one.
- fortune cookie

There are lots of techniques for multiplexing pins to
get more than 1 LED per pin. Numerous microchip app
and design notes on this topic. Look at how 7 seg
displays are done to get an idea (you may not need
drive transistors). There was also a microchip
newsletter (iirc) article from about a year ago that
got a goodly number of LEDs per pin by using output L,
H and high Z (input) plus a bit of mental gymnastics.

My favorite answer is a 12F509 + 2 74HC595s (to drive
up to 16 LEDs) but I suspect thats not what is being
looked for.

This is incompatible with the first two goals. Unless you are doing
intermittent blinking LEDs, the LEDs will consume several of orders of
magnitude more of your battery power than the PIC ever will.

BTW any PIC with 18 or more pins should be able to handle that job.

> 4. Can run some sort of clock program that is user programmable to turn
> off and on at certain times. - Still trying to master the code on this
> one, also I will take interface Ideas on this one. Could it be possible
> to use jumper settings for this?

Of course. But as a first crack I would suggest doing a 3 button
up/down/select interface. Then you only need to read (and debounce) three
buttons to get the interface.

Also you'll find clocks tougher than you think. Any timer that's not
temperature compensated will drift. So they'll get out of time pretty
quick.

I have a rather complex sunrise/sunset outdoor light controller that has
many of the functions you require. No schematic (sorry!) but the code
can be found here: http://www.finitesite.com/d3jsys/clock.asm
You will find code for managing an LCD display, tracking a time for a
clock/calendar, and other goodies.

On Thu, May 26, 2005 at 02:30:33PM -0700, phil B wrote:
> There are lots of techniques for multiplexing pins to
> get more than 1 LED per pin. Numerous microchip app
> and design notes on this topic. Look at how 7 seg
> displays are done to get an idea (you may not need
> drive transistors). There was also a microchip
> newsletter (iirc) article from about a year ago that
> got a goodly number of LEDs per pin by using output L,
> H and high Z (input) plus a bit of mental gymnastics.
>
>
> My favorite answer is a 12F509 + 2 74HC595s (to drive
> up to 16 LEDs) but I suspect thats not what is being
> looked for.

Phil,

It begs an interesting question. Why is that combo better than
a 28 or 40 pin PIC?

> 1. Lowest power consumption pic
> 2. Run 6 to 12 Leds
> 3. Work on battery's - Like 4 double AA's
> 4. Can run some sort of clock program that is user programmable to turn
> off and on at certain times. - Still trying to master the code on this
> one, also I will take interface Ideas on this one. Could it be possible
> to use jumper settings for this?
> Thanks for the input - a humble new guy.

If you are running a clock, then you need to run all the time, or have a
pic that can take a second crystal for realtime clock at 32.768 KHz. Your
real power consumption, especially if you run the LEDs even occasionally,
is not going to be affected much by your choice of PIC.

How about 2 or 3 AA batteries? Then you will not need a regulator(save
current that way too).

Since you are a beginner, do it as simply as possible, which means no
multiplexing of pins. Get a 40 pin PIC like the 16F877(A) or 18F452.

1) I can use a smaller packaged PIC (6 or 8 pins if the only thing is to
read a few switches and drive LEDs).

2) I can place the LED drivers near the LEDs and connect with only 2 or 3
lines plus power and ground. Handy if the PIC is located elsewhere.

3) I can drive the LEDs from an un-regulated supply and keep the PIC supply
nice and clean. (this is a trick answer: unreg supply is about anywhere
from 3.3 to 6V if using 74hc595 or just about anything at all if using
TPIC6595)

3b) Can drive reasonable sized relays instead of LEDs if using TPIC6595.

5) One of my boards has 40 status LEDs on it as well as 3- 7 segment
displays. Also has 16 or so digital inputs (both binary and trinary). All
driven with only 3 i/o lines from PIC.

No question: if this is a one-off hobbyist project that needs only 12 LEDs,
spend the extra dollars and go for a larger PIC.

But **I** would probably do it with a tiny PIC and shift registers simply
because that's what I'm used to doing for larger projects. And I just
happen to have several hundred (or more) little (1" x 3") single-sided PCBs
that hold an 8 pin PIC, simple 5V zener PSU (with JFET discharge circuit),
2- trimpots wired for RC time measurements, 3- digital inputs, 2- TPIC6595
shift registers. The PIC section can be snipped off, leaving the remainder
of the board with the 2- shift registers to connected to previous boards to
make a SR chain as long as needed. They get used for all kinds of simple
projects.

I would also add that the 595s allow you add more LEDs
(or what ever) in units of 8 by chaining them. No
real gymnastics needed, just pump the bits out via bit
bang SPI (which is only slightly more complex than
bsf/bcf). There is a practical limit but its pretty
high. I used them on an LED light stick design - I've
had as high as 128 working. The bike light project in
the current Nuts and Volts could have benefitted from
this approach.

Another issue is board space. A 40 pin PIC takes up a
lot more space than an 8 or 14 pin one. A 40 pin PIC
seems like over kill to light up 32 LEDs.

Doesn't the 74HC595 not have the current output capability of a PIC? IIRC it
was something like 5-6mA for the 74HC595, which IMO is not much for driving
LED's properly. But of course, it depends on the specific LEDs and
application of the OP.

On 5/26/05, James <spamBeGonegogomagicspamBeGonecomcast.net> wrote:
>
> New to the whole pic thing. Got them blinking though. Here is my
> question what is the best pic chip for the job.
>
> 1. Lowest power consumption pic
> 2. Run 6 to 12 Leds

> 3. Work on battery's - Like 4 double AA's
> 4. Can run some sort of clock program that is user programmable to turn
> off and on at certain times. - Still trying to master the code on this
> one, also I will take interface Ideas on this one. Could it be possible
> to use jumper settings for this?
>
> Thanks for the input - a humble new guy.
>
> James
>
> -

The Fairchild 74HC595 datasheet specs a max current of
35mA per pin though I wouldn't get anywhere near that
with out a pretty gentle duty cycle. The dip package
has a 600 mW limit, and the SO's is 500 mW.

I've run a number of tests on it because I was
concerned. With all 8 outputs constantly driving LEDS
at 10 mA for 24 hrs there was very little heat
increase (a couple degrees F) so the 500 mW limit may
be conservative. This was with both Fairchild and ST
parts. Any kind of <100% duty cycle is going to help
here as well.

One thing to be carefull of is inrush current and
spikes on the clock and serial in pin. I use a 1K
limiter and 100K to ground on both RCLK and SERIN.

> On Thursday 26 May 2005 04:30 pm, phil B scribbled:
> > My favorite answer is a 12F509 + 2 74HC595s (to
> drive
> > up to 16 LEDs) but I suspect thats not what is
> being
> > looked for.
> >
> > Phil
>
>
> Doesn't the 74HC595 not have the current output
> capability of a PIC? IIRC it
> was something like 5-6mA for the 74HC595, which IMO
> is not much for driving
> LED's properly. But of course, it depends on the
> specific LEDs and
> application of the OP.
>
> Cheers,
> -Neil.
>
>

I just checked the TI & Fairchild datasheets -- interesting that you work with
the "absolute maximum rating" of 35mA. Though the Fairchild does not
specifically state a normal high and low output current, the TI datasheet
specs this as "+/- 6mA output drive", but also states an absolute max of
35mA.

I asking this because it's piqued my interest for future use. I usually have
a self-coded PWM routine to allow dimming of the LEDs from 1/9 to 9/9
duty-cycle, and on a newer experiment, I'm trying to see if I can easily dim
different LEDs to different intensities. If I can swing the current I need
when at 100% duty cycle, I'm trying to think of how intense the data output
(from the PIC to the shift register) could be to do software dimming. I also
see it has an output-enable pin, which could be used for global dimming (at
the cost of 1 extra pin), but not for multiple-level dimming. I'll have to
think about this some more...

> The Fairchild 74HC595 datasheet specs a max current of
> 35mA per pin though I wouldn't get anywhere near that
> with out a pretty gentle duty cycle. The dip package
> has a 600 mW limit, and the SO's is 500 mW.
>
> I've run a number of tests on it because I was
> concerned. With all 8 outputs constantly driving LEDS
> at 10 mA for 24 hrs there was very little heat
> increase (a couple degrees F) so the 500 mW limit may
> be conservative. This was with both Fairchild and ST
> parts. Any kind of <100% duty cycle is going to help
> here as well.
>
> One thing to be carefull of is inrush current and
> spikes on the clock and serial in pin. I use a 1K
> limiter and 100K to ground on both RCLK and SERIN.
>
> Phil
>
> --- PicDude <RemoveMEpicdude2TakeThisOuTnarwani.org> wrote:
> > On Thursday 26 May 2005 04:30 pm, phil B scribbled:
> > > My favorite answer is a 12F509 + 2 74HC595s (to
> >
> > drive
> >
> > > up to 16 LEDs) but I suspect thats not what is
> >
> > being
> >
> > > looked for.
> > >
> > > Phil
> >
> > Doesn't the 74HC595 not have the current output
> > capability of a PIC? IIRC it
> > was something like 5-6mA for the 74HC595, which IMO
> > is not much for driving
> > LED's properly. But of course, it depends on the
> > specific LEDs and
> > application of the OP.
> >
> > Cheers,
> > -Neil.
> >
> >
> > --

just one remark from my own experience: make sure that your programmer support whatever PIC you use. If you are using an old type programmer make sure it support the new chip. In my case I have to spend an extra 35 bocks

>> The OPs 'low-power' requirements are in significant conflict with
>> illuminating 6 to 12 LEDs.
>
>That was my first observation. The only way it could have been worse
>is specifying a 9V battery for the power source.

<VBG> so the OP could add some switching regulator experience as well - but
then I am not sure if a 9V battery has a better watts/cubic cm than AA
cells.

>One aside on my other post: my sunrise/sunset light controller
>drifts too. I usually have to reset it at least once a month.

Sounds like time to add a radio clock - or have a photo cell that detects
the daylight time and sets midnight to the midpoint between sunrise and
sunset each night. Don't know if that would be accurate enough - maybe in
very low rainfall/cloud cover areas.

> The Fairchild 74HC595 datasheet specs a max current of
> 35mA per pin though I wouldn't get anywhere near that
> with out a pretty gentle duty cycle. The dip package
> has a 600 mW limit, and the SO's is 500 mW.
>
> I've run a number of tests on it because I was
> concerned. With all 8 outputs constantly driving LEDS
> at 10 mA for 24 hrs there was very little heat
> increase (a couple degrees F) so the 500 mW limit may
> be conservative. This was with both Fairchild and ST
> parts. Any kind of <100% duty cycle is going to help
> here as well.
>
> One thing to be carefull of is inrush current and
> spikes on the clock and serial in pin. I use a 1K
> limiter and 100K to ground on both RCLK and SERIN.
>
> Phil

At 10ma the Vol (low output voltage) of the 74HC is probably quite a bit
less than 1 volt. So, assuming worst case:

>> >Internal pullup and jumpers to gnd.
>>
>> However this technique does not usually result in a "low
>> power processor because of the way the internal pullups
>> work.
>
>Only turn on wpu while checking the pin ?

On Fri, May 27, 2005 at 11:45:26AM +0100, Alan B. Pearce wrote:
> >> >Internal pullup and jumpers to gnd.
> >>
> >> However this technique does not usually result in a "low
> >> power processor because of the way the internal pullups
> >> work.
> >
> >Only turn on wpu while checking the pin ?
>
> Yeah, someone else pointed that out too.

But then don't you have a floating input if the jumper's not in place?
That'll probably eat up more current than the weak pullup.

If you tie the LED high and light it by driving the
output low don't you get the higher differential
voltage (and thus the higher wattage)? I chose to tie
low and drive high (no personal comments, please!).
the outputs were at around 4.5 V (iirc) so it was a
bit higher. I use 5 for a conservative (and easier to
do in my head) number. That works out to be a bit
less than 400 mW.

Something that I wanted to look at but never got to
was to run the 595s at a lower Vcc to get output high
to be the LED voltage drop (lets say 2V for arguments
sake). Then the max dissipation would be 2*8*10
(160mW) and eat less battery.

You will see more voltage drop with a higher current.
It wasn't too bad at 10mA as I recall. I still don't
think drawing < 1/3 the max spec is abusive and my
experience reinforces that.

>Something that I wanted to look at but never got to
>was to run the 595s at a lower Vcc to get output high
>to be the LED voltage drop (lets say 2V for arguments
>sake). Then the max dissipation would be 2*8*10
>(160mW) and eat less battery.

I do something similar with that 40- LED board I described earlier. All
the logic runs from a simple zener-regulated 5V supply but the LEDs anodes
are all connected to a Nat-Semi simple switcher set at 3.3V. The LEDs
illuminate when driven LO by the hc595 and are reverse-biased with somewhat
less than 2 volts while off. Well within the LED specs.

This display card is mounted to a piece of Lexan fitted to a cut opening in
an industrial control panel. It makes for a completely water-tight and
fairly good-looking display but total dissipation was a concern. Running
the LEDs at that low voltage kept the temperature rise very low. Not using
a switcher would have resulted in considerable heat, given that the whole
thing is running from a 24Vac supply.

Note that the hc595s are running from the same 5V supply as the PIC - only
the LEDs are run at 3.3V. Another advantage of doing it this way is that
the mosfets in the output stages of the hc595 are fully enhanced. Running
the hc595 at 3.3V results in much higher RDSon and hotter chips.