CT107D Blue Bridge Cup dynamic digital tube example (4)

Publisher:郑大大Latest update time:2019-09-26 Source: eefocusKeywords:CT107D Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Today I will tell you about the display of CT107D Blue Bridge Cup digital tube.


I won't go into detail about the specific principles of digital tubes, because I'm afraid you'll get dizzy if I say too much. If you want to understand the principles, you can do some BD yourself.


Let's find the circuit:


As you can see, we directly control the Y7C port and send data to the P0 port.


We control the Y6C port to select which digital tube to use, one is 8


We just need to find Y6C and Y7C

This is very familiar, okay, let's use the method


P2=(P2&0x1f)|0xc0; Open Y6


P0=0x01; select the first      


P2&=0x1f; Close Y6


P2=(P2&0x1f)|0xe0; Open Y7


P0=0xf9; Give data      


P2&=0x1f; Close Y7


Here is the basic usage. Now I will write a complete program


#include "reg52.h"

unsigned char code tab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff,0xbf}; //data encoding

unsigned char dsbuff[]={10,10,10,10,10,10,10,10}; Displayed data

unsigned char dscom = 0;

void init_smg()

{

TMOD|= x01; Timer 0 working mode 2

TH0=(65536-2000)/256; interrupt once every 2m seconds

TL0=(65536-2000)%256;

ET0=1; Enable timer interrupt

TR0=1; start timer 0

EA=1; Enable general interrupt

}

void dsPlay()

P2=(P2&0x1f)|0xe0;

P0=0xff;

P2&=0x1f;

P2=(P2&0x1f)|0xc0;

P0=1<P2&=0x1f

P2=(P2&0x1f)|0xe0;

P0=tab[dsbuff[dscom]];

P2&=0x1f;

if(++dscom==8)dscom=0;

}

void smg_time0()interrupt 1

{

TH0=(65536-2000)/256; interrupt once every 2m seconds

TL0=(65536-2000)%256;

dsplay();

}

void main()

{

init_smg();

dsbuff[0]=8; The first digital tube displays 8

while(1);

}


Keywords:CT107D Reference address:CT107D Blue Bridge Cup dynamic digital tube example (4)

Previous article:CT107D Blue Bridge Cup independent keyboard application (5)
Next article:CT107D Blue Bridge Cup Serial Port Example (3)

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号