View previous topic :: View next topic |
Author |
Message |
Xeus
Joined: 28 Jan 2005 Posts: 4
|
Posted: Fri Jan 28, 2005 3:53 pm Post subject: MAX7219 & 7 Seg Display |
|
|
Hi
The Problem:
I'd like to build an counter with an ATmega8, MAX 7219 and a 3 Digit 7 Segment Display.
The hardware is already running, and I m able to show a single-figure number.
for examle:
0 to 9
But how does it work, to show a two figure number like 10,11...
How does it work to jump in the next digit??
Thanks,
xeus
SORRY FOR MY POOR ENGLISH |
|
Back to top |
|
|
Duval JP
Joined: 22 Jun 2004 Posts: 1161 Location: France
|
Posted: Fri Jan 28, 2005 5:23 pm Post subject: |
|
|
Hi,
Well, how I do , maybe another method exists,
for a chrono, I created 2 arrays of data:
where the data was 0 to nine (values sent to the ports to light bar)
'--------[restaure data]----------------------------
'seconde
Restore Seconde
For J = 1 To 10
Read Tabseconde(j)
Next
'minute
Restore tenseconde
For J = 1 To 10
Read Tabtenseconde(j)
Next
'write at the end of program
'that is my data you must write ours !
----[data]--------------------------------------------------------
Seconde:
Data 72 , 115 , 107 , 108 , 47 , 62 , 73 , 127 , 109 , 95
tenseconde:
Data 34 , 155 , 186 , 106 , 248 , 233 , 50 , 251 , 122 , 243
then I compare my total of seconde against timer
and I increment my total of "10seconde"
if seconde =10 then
seconde=0
tenseconde=tenseconde+1
endif
Portb = Not Tabseconde(seconde)
Portd = Not Tabtenseconde(tenseconde)
For 3 you add one....
I hope you understand my frenchy english !
bon courage
JP _________________ pleasure to learn, to teach, to create |
|
Back to top |
|
|
Xeus
Joined: 28 Jan 2005 Posts: 4
|
Posted: Fri Jan 28, 2005 5:35 pm Post subject: |
|
|
does it already in the one wire mode work?
the communication between the mc and the max7219 needs just one port of the mc
thanks for your help
xeus |
|
Back to top |
|
|
Twenty
Joined: 30 Nov 2004 Posts: 50 Location: Sydney
|
Posted: Fri Jan 28, 2005 10:36 pm Post subject: |
|
|
Xeus,
I'm using the max7219 in one of my projects. The max7219 requires you to send a number 0-9 to a specific digit. You cannot send a number bigger than 9. What I do is to first convert the number (0-99) to bcd and then extract each didgit from it by using the AND operator.
Let NUMBER be the number to be displayed and
NUMBER_BCD the BCD version of it
Use var1=BCD_NUMBER AND &B00001111 for the first digit and
use var2=BCD_NUMBER AND &B11110000 for the second digit. Remember to shift var2 four places to the right before sending it to the max7219
Here is an extract of my code that works:
Dim Dis as integer
Dis = Makebcd(dis)
Dig_val1 = Dis And &B00001111 : W = Makeint(dig_val1 , 1) : Call Show(w) ' Data for digit 1 and send to max7219
Dig_val2 = Dis And &B11110000 : Shift Dig_val2 , Right , 4: W = Makeint(dig_val2 , 2): Call Show(w) ' Data for Digit 2 and send to nax7219
Sub Show(var As Word) ' send data to max7219
Data_out = Var
Reset Cs
For N = 1 To 16
Reset Clk
Y = Data_out And &H8000
Shift Data_out , Left , 1
If Y = &H8000 Then
Set Dout
Else
Reset Dout
End If
Set Clk
Next
Set Cs
End Sub
Good luck
Twenty |
|
Back to top |
|
|
Duval JP
Joined: 22 Jun 2004 Posts: 1161 Location: France
|
Posted: Sat Jan 29, 2005 10:43 am Post subject: |
|
|
sorry,
my program doesnt use 1 wire communication but the old but cheap 4511 drivers
JP _________________ pleasure to learn, to teach, to create |
|
Back to top |
|
|
Xeus
Joined: 28 Jan 2005 Posts: 4
|
Posted: Sun Jan 30, 2005 6:54 pm Post subject: |
|
|
Thank you
i'm will try it |
|
Back to top |
|
|
Xeus
Joined: 28 Jan 2005 Posts: 4
|
Posted: Sun Jan 30, 2005 6:55 pm Post subject: |
|
|
Sorry for the mistakes!!! |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|