PDA

View Full Version : Multiplex Led Array



george
- 13th December 2003, 11:41
hi,

I am building a project moving led array im using pic16f84a as my controller it is connected to 74ls164 shift registers. I can display characters but i cant make them shift ( move the character from right to left). anyone can help me sure would appreciate it.

This is the program in PBP that i've written (displays character that is in the label cnvrt but can't move them)

trisb=%00000000
trisa=%00000101

x var byte
z var byte

clock var porta.4
my_data var porta.1
reset var porta.3

portb=%11111111
porta=%00000000

pause 500

begin:

high reset
high my_data
low clock
for x=0 to 14
gosub cnvrt
portb = z
high clock
low my_data
low clock
pauseus 150

next
low reset
goto begin

cnvrt:
lookup x,[$3c,$5e,$6e,$76,$38,$ff,$89,$76,$76,$89,$ff,$81,$7 6,$76,$8f],z

return

Melanie
- 13th December 2003, 15:20
It would be easier to explain if we could have referred to your hardware arrangement, however...

The thing to remember here is the display of your character (which you're probably already doing) RELATIVE to your display "window" at any instant in time...

There are many ways of doing this... here's one explained as a generalisation...

Say you have an 8 x 5 LED matrix. That's 8 LED's vertical, and 5 LED's horizontal. This is your display "window". You wish to scroll thru the letter 'A' horizontally. Now the letter 'A' is made up of the following (vertical) lines where each byte represents one vertical column of LED's, and where the five bytes together make up the character 'A'...

$7C - 01111100
$12 - 00010010
$11 - 00010001
$12 - 00010010
$7C - 01111100

Might be a little difficult to visualise until you draw it out (use a blank for zero and a blob for '1' and you find the 'A' is lying on it's R/H side)...

Now... to scroll thru the character, the element has to pass thru the display window like so...

$00,$00,$00,$00,$00 - Step 1 - nothing is displayed
$00,$00,$00,$00,$7C - Step 2 - L/H edge appears
$00,$00,$00,$7C,$12
$00,$00,$7C,$12,$11
$00,$7C,$12,$11,$12
$7C,$12,$11,$12,$7C - Step 6 - entire character displayed
$12,$11,$12,$7C,$00 - Step 7 - character starts to scroll thru
$11,$12,$7C,$00,$00
$12,$7C,$00,$00,$00
$7C,$00,$00,$00,$00 - Step 10 - almost gone just R/H edge...
... then go repeat all over from Step 1...

Now, to reitterate... our display consists of five bytes of eight bits, where each bit of that byte represents one column of eight vertical LED's, and the five bytes together make up our five columns. You have to pause displaying one whole set of bytes, before progressing onto the next step (next line of bytes). This pause becomes our scroll speed control. As you progress from Step 1 thru to Step 10 your character 'scrolls' across your display 'window'.

Probaly clear as mud...

If you're using serial latches, depending on your method of interconnecting them, you might be able to feed a byte into one end and the byte at the far end falls into oblivion which automatically causes a scroll. This seriously reduces processor overhead as you're only outputting one byte per scroll step (rather than as in our above example five)... but this is another story for another time...

Melanie

george
- 24th December 2003, 15:32
Thank you very much Melanie.

My project is working now. I now intend to improve my project by connecting it to a pc via serial port. Can I edit the message using a pc's serial port and software like VB? What pic micro will I use? What pbp command will do such that I can save all the characters in the alphabet and retrieve it (say each character represents five bytes) so that i don't have to change the the values in the lookup table every time I want to display a new message.

Sorry if i have so many questions, I'm just eager to learn pic and pbp.

Merry Christmas and A happy New Year!

Thanks.

George

electronicsuk
- 26th December 2003, 10:37
It would be a good idea to use a chip with a hardware serial port, for example the 16F627. If you only want to display standard characters, you could use some form of lookup to match ASCII values received through serial to their corresponding character.

Matthew

george
- 27th December 2003, 00:33
Thanks Matthew.

I will try to start my project as you have suggested.

Happy new year.

Melanie
- 3rd January 2004, 10:58
>Can I edit the message using a pc's serial port and software like VB?

Yes you can.

>What pic micro will I use?

16F628, 16F876 etc...

>What pbp command will do such that I can save all the characters in the alphabet and retrieve it (say each character represents five bytes) so that i don't have to change the the values in the lookup table every time I want to display a new message.

Well, if I was approaching this task, I would save my display message in the PIC's internal EEPROM, but I would use an external EEPROM (eg 24LC16, 24LC32 etc) to hold my character font - because if you were to replicate the ASCII character set between say $20 and $7F that would be 95 characters*5=475 bytes. Also changing character fonts for different applications or languages then becomes as easy as plugging-in a new EEPROM. As for PBP command... Read, Write and Data would be used for internal EEPROM, I2CREAD and I2CWRITE for the external EEPROM.

Melanie

mcglacy
- 3rd February 2004, 10:04
melanie

i'm interested....


Can you please post it here the sample source code...

thanks