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
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
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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
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
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