HELP PLZ!!!

liv&let dive

New Member
Hi to everyone – loving the site!!
Am in need of a bit of help for a small project. In my design I need sequential LED’s to flash at 1.5sec intervals.
There are three sets.
The first set has 5 LED’s
The second has 7 LED’s
The third 5 LED’s

Then before moving from the first set to the second I need a 5 second interval and then from the second set again 5sec interval before the third.

Im really keen to use pic’s technology.I have a really basic understanding but am not sure what size chip to use and how to actually programme it.

PLEASE CAN ANYONE HELP??!!
 

hippy

Ex-Staff (retired)
The first thing to do is download the PICAXE Programming Editor, skim through the help files ( accessed from the Prog Editor menu Bar ) and get a feel for what the PICAXE is. The Basic Commands manual shows all the commands which the PICAXE can execute including those which can give delays and pauses and can set and clear I/O lines. The Interfacing manual shows how to control things such as LED's.

For your own application, and trying to decide what size PICAXE to use; how many LED's in total - is it 17, and each must be controllable individually ? Are these normal LED's or super-bright LED's ?

What sort of electronics experience do you have, and how familiar are you with designing circuits ?

If you can give some hint as to what it is you are building ( "Knight Rider" LED display, etc ) it always helps people envisage what you are trying to actually do and fill in any missing gaps there may be.
 

liv&let dive

New Member
im designing a kids learning game/aid thingy to help with writing. its comprises of A B C which are the 1,2 and 3 sets. the LED's follow a pattern around each letter which allows the kid to follow the LED as it lights up. hope that makes sense. have got the pic's software.
 

thelabwiz

Senior Member
Are you describing a "chaser" style light pattern, where light #1 turns on, then #2 turns on and #1 turns off, then #3 on and #2 off, etc?

If so, this will require one output pin from the PICAXE (and possibly a driver transistor, depending on the current in the LED) for the maximum number of LEDs used in any character, plus one output pin and a driver transistor for each character (because of PICAXE current limits). The #1 LED on all characters can be tied together on one side, as can the #2 LED, etc. The other side of all the LEDs of a character would be tied together and connected to the character driver transistor.

The character pin on the PICAXE would go active to select the character, then the per-LED pins would be activated in sequence to make the lights "move".

As you described this, you would need 7 outputs to drive the numbered LEDs, plus 3 outputs to select the characters.
To get 10 output pins on one chip, I think you'll need a 28X. If you use an external 3-to-8 decoder chip, you only need 6 output pins on the PICAXE and an 18-series chip will work (probably the 18X, depending on the size of your program).

John
 

liv&let dive

New Member
thats pretty much what i need. with what you described.

really not the best at pic's though, so when you are describing pins you mean one leg of the pic chip?? also not sure about character?? any chance of basic basic explanation please. also with programming the pic - any ideas??
 

Fowkc

Senior Member
The way I understand what you're trying to do is this:

You have sets of LEDs labelled A,B,C:

A --> OOOOO (5 LEDs)
B --> OOOOOOO (7 LEDs)
C --> OOOOO (5 LEDs)

And you want to turn on set A one LED at a time, followed by set B one LED at a time followed by set C, one LED at a time.

I'll try and describe the method that thelabwiz described in a bit more detail.

Let's label the LEDs in each "character" (A, B or C). So the LEDs for letter "A" will be A1 to A5, the B1 to B7 and C1 to C5.

Now, A1, B1 and C1 are never on at the same time. So you can connect them all to the same PICAXE output and <i>select </i> which one actually comes on by choosing which character (A, B or C) has power.

Explanations are a right pain, and a picture is worth a thousand words, so here's a picture (resistors omitted for clarity):

<A href='http://www.fowkc.com/elec/pics/LEDABC.JPG' Target=_Blank>External Web Link</a>

Here you can see that if the output labelled A was HIGH and outputs 1, 2 and 3 were LOW, LEDs A1, A2 and A3 would be on. The LEDs for &quot;B&quot; and &quot;C&quot; would be tied LOW as well, but they don't have power.

That's the basic principle of the thing. You're new to PICs, so I'd start with just a basic LED flasher circuit (see the datasheets) to learn how the PICAXE system operates and to learn some of the code syntax and commands.

One final thing: you shouldn't need a single transistor for this. A high-efficiency red LED will be plenty bright enough at 2mA. So even running seven of them through a PICAXE will be OK.
 

thelabwiz

Senior Member
Yes, output pin is exactly that - one &quot;leg&quot; of the chip.

The code would be along the lines of this
&lt;air code - typed in directly - not tested&gt;
'define some variables

counter1 = b0
max_chars = b1
counter2 = b2
max_leds = b3
next_pin = b4

max_chars = 3 'your initial design

'assume leds are on outputs 1-7
'for all controls on one chip, assume 28X
'character A-C control pins are on portc 1-3

start:
low portc 1
low portc 2
low portc 3

for counter1 = 1 to max_chars
'note that &quot;branch&quot; is a better choice but
'this may be easier to follow
if counter1 = 1 then charA
if counter1 = 2 then charB
charC:
low portc 1
low portc 2
high portc 3
max_leds = 5
gosub chase
charA:
low portc 2 'char B control
low portc 3 'char C control
high portc 1 'char A control
max_leds = 5
gosub chase
charB:
low portc 1
low portc 3
high portc 2
max_leds = 7
gosub chase
sleep 5 '5 second wait
next counter1

chase:
for counter2 = 1 to max_leds
high counter2 'turn on LED
pause 500 'wait 1/2 sec
next_pin = counter2 + 1
if next_pin &gt; max_leds goto skip
high next_pin 'turn on next LED
skip:
low counter2
next counter2
return

John
 

Rickharris

Senior Member
You really do need to read through the getting started and basic commands PDF files - even though this may be a drag.

Try starting with simple programmes like the examples given in the basic commands manual then you will be able to understand and build up your own programme.

For example in general each output of the picaxe will only drive a single LED. Once an output is turned on it will stay on until you turn it off. so:

<code><pre><font size=2 face='Courier'>
Start:
High 0
pause 500
High 1
pause 500
High 2

wait 1

low 0
pause 500
low 1
pause 500
low 2

wait 1
goto start

</font></pre></code>
will turn on 3 outputs and any LEDs connected to them (with a suitable resistor) one at a time and then turn them off one at a time.

Start small and build up.


Edited by - rickharris on 23/09/2006 08:44:08

Edited by - rickharris on 23/09/2006 08:45:21
 
Top