View previous topic :: View next topic |
Author |
Message |
bzijlstra
Joined: 30 Dec 2004 Posts: 1179 Location: Tilburg - Netherlands
|
Posted: Wed Dec 17, 2014 4:37 pm Post subject: 89c2051 multiplexed display |
|
|
From CE Chinese Electronics
A DIY clock with PCB, 89c2051, display, two switches, a beeper. If you buy 5 of them they are just 2 euros a piece. Don't know how they do it...
Got to get it working in Bascom-8051...
Here a multiplex routine for the display, in Getal(4) the value that should be displayed on the screen.
It is just the routine to get something on the display, you can enhance the code to have it work as a counter, up/down counter, timer, clock etc.
Code: | ' 89c2051 display - CE Chinese Electronics...
$regfile = "89c2051.DAT" 'Dat-file with 89c2051-registers
$crystal = 12000000 'Crystal frequency
$baud = 9600 'Baud-rate
Dim X As Byte
Dim Y As Byte
Dim Getal(4) As Byte 'array with values for the 4 digits
Dim Value(10) As Byte
Cathode_digit4 Alias P3.0
Cathode_digit3 Alias P3.1
Cathode_digit2 Alias P3.2
Cathode_digit1 Alias P3.7
Set Cathode_digit4
Set Cathode_digit3
Set Cathode_digit2
Set Cathode_digit1
P1 = 0
' AFBEDCG dp
Value(1) = &B1111110_0
Value(2) = &B0010010_0
Value(3) = &B1011101_0
Value(4) = &B1010111_0
Value(5) = &B0110011_0
Value(6) = &B1100111_0
Value(7) = &B1101111_0
Value(8) = &B1010110_0
Value(9) = &B1111111_0
Value(10) = &B1110111_0
Getal(1) = 1
Getal(2) = 2
Getal(3) = 3
Getal(4) = 4
Do
X = 4
Set Cathode_digit1
Y = Getal(x) + 1
P1 = Value(y)
Reset Cathode_digit4
Waitms 4
X = 3
Set Cathode_digit4
Y = Getal(x) + 1
P1 = Value(y)
Reset Cathode_digit3
Waitms 4
X = 2
Set Cathode_digit3
Y = Getal(x) + 1
P1 = Value(y)
Reset Cathode_digit2
Waitms 4
X = 1
Set Cathode_digit2
Y = Getal(x) + 1
P1 = Value(y)
Reset Cathode_digit1
Waitms 4
Loop
End
|
X-mas project 2014
Have fun
Ben Zijlstra |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Thu Dec 18, 2014 5:16 pm Post subject: |
|
|
Thanks for sharing Ben.
Clear and simple.
Good old 2051 _________________ Mark |
|
Back to top |
|
|
kimmi
Joined: 24 Feb 2006 Posts: 1922 Location: Denmark
|
Posted: Mon Jan 12, 2015 7:21 am Post subject: |
|
|
Hi Ben
Think you have a typeO in number 7
Value(8) = &B1010110_0 seg D is set
Value(8) = &B1010010_0
else its a nice & simple code 7-seg _________________ / Kim |
|
Back to top |
|
|
bzijlstra
Joined: 30 Dec 2004 Posts: 1179 Location: Tilburg - Netherlands
|
Posted: Mon Jan 12, 2015 8:59 am Post subject: 7 segment... |
|
|
Kim
You are right. Thanks.
Have fun
Ben Zijlstra |
|
Back to top |
|
|
AndersL
Joined: 25 Jan 2010 Posts: 92 Location: Kragerø,Norway
|
Posted: Mon Jan 19, 2015 11:31 am Post subject: |
|
|
Thanks Ben! I've just ordered a couple.
At least I need to check if my programmer is still working.
Back in 2003 I made a 89c4051 replacement for my garage door controller.
At a 24/7 duty it still goes on ticking _________________ Anders |
|
Back to top |
|
|
haloway13
Joined: 11 May 2015 Posts: 1
|
Posted: Mon May 11, 2015 5:52 pm Post subject: Wonderful |
|
|
I have been wanting to convert the same exact Chinese manufactured board into a board that could activate a relay instead of a buzzer.
This will certainly get me started in the right direction.
What programmer are you using? |
|
Back to top |
|
|
bzijlstra
Joined: 30 Dec 2004 Posts: 1179 Location: Tilburg - Netherlands
|
Posted: Mon May 11, 2015 9:23 pm Post subject: MCS electronics programmer |
|
|
I use the MCS Electronics programmer for 89c1051, 89c2051 and 89c4051.
If you need help just let us know.
Have fun
Ben Zijlstra |
|
Back to top |
|
|
|