Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

89c2051 multiplexed display

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> Share your working BASCOM-8051 code here
View previous topic :: View next topic  
Author Message
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Wed Dec 17, 2014 4:37 pm    Post subject: 89c2051 multiplexed display Reply with quote

From CE Chinese Electronics Smile

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
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5922
Location: Holland

blank.gif
PostPosted: Thu Dec 18, 2014 5:16 pm    Post subject: Reply with quote

Thanks for sharing Ben.
Clear and simple.
Good old 2051 Very Happy

_________________
Mark
Back to top
View user's profile Visit poster's website
kimmi

Moderator



Joined: 24 Feb 2006
Posts: 1922
Location: Denmark

denmark.gif
PostPosted: Mon Jan 12, 2015 7:21 am    Post subject: Reply with quote

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
View user's profile Visit poster's website MSN Messenger
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Mon Jan 12, 2015 8:59 am    Post subject: 7 segment... Reply with quote

Kim

You are right. Thanks.

Have fun
Ben Zijlstra
Back to top
View user's profile Visit poster's website
AndersL

Bascom Member



Joined: 25 Jan 2010
Posts: 92
Location: Kragerø,Norway

norway.gif
PostPosted: Mon Jan 19, 2015 11:31 am    Post subject: Reply with quote

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 Very Happy

_________________
Anders
Back to top
View user's profile
haloway13

Bascom Member



Joined: 11 May 2015
Posts: 1

blank.gif
PostPosted: Mon May 11, 2015 5:52 pm    Post subject: Wonderful Reply with quote

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
View user's profile
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Mon May 11, 2015 9:23 pm    Post subject: MCS electronics programmer Reply with quote

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
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> Share your working BASCOM-8051 code here All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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