Anda di halaman 1dari 7

Controling LED-Matrix

From "Adrian Jansen" <adrianjansen@internode.on.net> Date Sun, 18 Jan 2004


09:38:43 +1000
Use a timer, and do all the low level scanning in the timer interupt.
Time
to learn assembler !
Regards,
Adrian Jansen
adrianjansen@internode.on.net
J & K MicroSystems
Microcomputer solutions for industrial control
----- Original Message ----From: "Jan Wrage" <jan.wrage@gmx.net>
To: <bascom@grote.net>
Sent: Sunday, January 18, 2004 5:39 AM
Subject: [bascom] Controling LED-Matrix
Hi all!
Ive build a matrix of 8x8 leds.
The columns are connected to a shiftregister and the rows connected to a
3-8
demuxer.
To get a stable picture i had to switch the 8 rows fast enough while
shifting the data to the register.
Now my question is, how do i go to the next picture, or define a time of
n
seconds between the pictures.
I tried to do this with counting X up to a defined value and then goto
next
character. But this method is very bad and the display time varies
depending
on how long the code is
Does anybody know a better method of doing this? Maybe demux in the
background Or use timers???
Below is some code (for better understanding)
Thanks for help!
Jan

For X = 0 To 5
Portd = &H0
Test1 = &B00000000
Call Shiftem1

demux row0

Portd = &H1
Test1 = &B00000000
Call Shiftem1

demux row1

Portd = &H2
Test1 = &B00111100
Call Shiftem1

demux row2

Portd = &H3
Test1 = &B00100100
Call Shiftem1

demux row3

Portd = &H4
Test1 = &B00100100
Call Shiftem1

demux row4

Portd = &H5
Test1 = &B00111100
Call Shiftem1

demux row5

Portd = &H6
Test1 = &B00000000
Call Shiftem1

demux row6

Portd = &H7
Test1 = &B00000000
Call Shiftem1

demux row7

Next

For X = 0 To 15
Portd = &H0
Test1 = &B11101111
Call Shiftem1

demux row0

Portd = &H1
Test1 = &B00000011
Call Shiftem1

demux row1

Portd = &H2
Test1 = &B00111101
Call Shiftem1

demux row2

Portd = &H3
Test1 = &B00100110
Call Shiftem1

demux row3

Portd = &H4
Test1 = &B00100100
Call Shiftem1

demux row4

Portd = &H5
Test1 = &B00111100
Call Shiftem1

demux row5

Portd = &H6
Test1 = &B00001110
Call Shiftem1

demux row6

Portd = &H7
Test1 = &B00111000
Call Shiftem1

demux row7

Next

Sub Shiftem1
If Y = 1 Then
If Y = 2 Then
If Y = 3 Then
If Y = 4 Then

Shift Test1 , Left , W


Shift Test1 , Right , W
Rotate Test1 , Left , W
Rotate Test1 , Right , W

Portb = &B00001000
disable,
Strobe disable
Shiftout Portb.1 , Portb.2 , Test1 , 2
Portb = &B00000001
enable,
Strobe enable

'Output

'Output

Waitms 2
End Sub
--Ausgehende Mail ist zertifiziert virenfrei. Toll, was ... :-)
berprft durch AVG Antivirus System (http://www.grisoft.com/de).
Version: 6.0.562 / Virendatenbank: 354 - Erstellungsdatum: 16.01.2004

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Re: [bascom] Controling LED-Matrix


From "trbrenke" <trbrenke@educationexplorations.com>
Date Sun, 18 Jan 2004 10:00:54 -0800

clock = your crystal freq


devisor = the number of clocks before a count. (1,8,64,256,1024)
1/ clock = time per clock cycle
time per clock cycle / devisor = time per tick.
time of interrupt interval wanted
interrupt

time per tick = timer count for

example:
1/ 16000000 = 6.25E-08
(.0625mS)
6.25E-8 / 64 = 9.76563E-10 ( .000000976563mS)
50ms / 9.76563E-10 = 51200 counts = 50mS
load that in the compare

----- Original Message ----From: "Jan Wrage" <jan.wrage@gmx.net>


To: <bascom@grote.net>
Sent: Sunday, January 18, 2004 1:03 AM
Subject: AW: [bascom] Controling LED-Matrix
Hi!
Tried to use a timer for the multiplexing, but it doesnt work as
expected. I
dont know how to calculate the time the timer had to interrupt. Then i
dont
know how to tell the micro that the next data is for the first row and
so
on...
Maybe anybody could give me an example.
And i don't want to learn asm :-) Must be a way to do it with plain
bascom.
Cheers,
Jan
-----Ursprngliche Nachricht----Von: owner-bascom@grote.net [mailto:owner-bascom@grote.net] Im Auftrag
von
Adrian Jansen
Gesendet: Sonntag, 18. Januar 2004 00:39
An: bascom@grote.net
Betreff: Re: [bascom] Controling LED-Matrix
Use a timer, and do all the low level scanning in the timer interupt.
Time
to learn assembler !

Regards,
Adrian Jansen
adrianjansen@internode.on.net
J & K MicroSystems
Microcomputer solutions for industrial control
----- Original Message ----From: "Jan Wrage" <jan.wrage@gmx.net>
To: <bascom@grote.net>
Sent: Sunday, January 18, 2004 5:39 AM
Subject: [bascom] Controling LED-Matrix
Hi all!
Ive build a matrix of 8x8 leds.
The columns are connected to a shiftregister and the rows connected to a
3-8
demuxer.
To get a stable picture i had to switch the 8 rows fast enough while
shifting the data to the register.
Now my question is, how do i go to the next picture, or define a time of
n
seconds between the pictures.
I tried to do this with counting X up to a defined value and then goto
next
character. But this method is very bad and the display time varies
depending
on how long the code is
Does anybody know a better method of doing this? Maybe demux in the
background Or use timers???
Below is some code (for better understanding)
Thanks for help!
Jan

For X = 0 To 5
Portd = &H0
Test1 = &B00000000
Call Shiftem1

demux row0

Portd = &H1
Test1 = &B00000000
Call Shiftem1

demux row1

Portd = &H2
Test1 = &B00111100
Call Shiftem1

demux row2

Portd = &H3
Test1 = &B00100100
Call Shiftem1

demux row3

Portd = &H4
Test1 = &B00100100
Call Shiftem1

demux row4

Portd = &H5
Test1 = &B00111100
Call Shiftem1

demux row5

Portd = &H6
Test1 = &B00000000
Call Shiftem1

demux row6

Portd = &H7
Test1 = &B00000000
Call Shiftem1

demux row7

Next

For X = 0 To 15
Portd = &H0
Test1 = &B11101111
Call Shiftem1

demux row0

Portd = &H1
Test1 = &B00000011
Call Shiftem1

demux row1

Portd = &H2
Test1 = &B00111101
Call Shiftem1

demux row2

Portd = &H3
Test1 = &B00100110
Call Shiftem1

demux row3

Portd = &H4
Test1 = &B00100100
Call Shiftem1

demux row4

Portd = &H5
Test1 = &B00111100
Call Shiftem1

demux row5

Portd = &H6
Test1 = &B00001110

demux row6

Call Shiftem1
Portd = &H7
Test1 = &B00111000
Call Shiftem1

demux row7

Next

Sub Shiftem1
If Y = 1 Then
If Y = 2 Then
If Y = 3 Then
If Y = 4 Then

Shift Test1 , Left , W


Shift Test1 , Right , W
Rotate Test1 , Left , W
Rotate Test1 , Right , W

Portb = &B00001000
disable,
Strobe disable
Shiftout Portb.1 , Portb.2 , Test1 , 2
Portb = &B00000001
enable,
Strobe enable

'Output

'Output

Waitms 2
End Sub
--Ausgehende Mail ist zertifiziert virenfrei. Toll, was ... :-)
berprft durch AVG Antivirus System (http://www.grisoft.com/de).
Version: 6.0.562 / Virendatenbank: 354 - Erstellungsdatum: 16.01.2004

--Eingehende Mail ist zertifiziert virenfrei. Toll, was ... :-)


berprft durch AVG Antivirus System (http://www.grisoft.com/de).
Version: 6.0.562 / Virendatenbank: 354 - Erstellungsdatum: 16.01.2004
--Ausgehende Mail ist zertifiziert virenfrei. Toll, was ... :-)
berprft durch AVG Antivirus System (http://www.grisoft.com/de).
Version: 6.0.562 / Virendatenbank: 354 - Erstellungsdatum: 16.01.2004

Anda mungkin juga menyukai