SCM C language program design: timer control digital tube dynamic display

Single chip microcomputer STM32L151CCU6
1206RGB (single)
RF cable can be customized for other specifications
0201 package SLP0603 ESD electrostatic diode 5V one-way ESD

/* Name: Timer Control Digital Tube Dynamics

display

Description: 8 digital tubes are divided into two groups

State displays the year, month, day, hour, minute, and second, in this case

The bit display delay is implemented with a timer.

*/

#include

#include

#define uchar unsigned char

#define uint unsigned int

// segment code, the last digit is the segment number of "-"

Uchar code

DSY_CODE[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xbf};

//Data to be displayed: 09-12-25 and 23-59-58 (displayed in two groups)

Uchar code Table_of_Digits[][8]={{0,9,10,1,2,10,2,5},{2,3,10,5,9,10,5,8}};

Uchar i, j=0;

Uint t=0;

/ / Main program

Void main()

{

P3 = 0x80;

/ / bit code initial value

TMOD=0x00; //Counter T0 mode 0

TH0=(8192-4000)/32; //4ms timing

TL0=(8192-4000)%32;

IE=0x82;

TR0=1; //Start T0

While(1);


}

//T0 interrupt function controls the digital tube refresh display

Void DSY_Show() interrupt 1

{

TH0=(8192-4000)/32; //Restore the initial value

TL0=(8192-4000)%32;

P0=0xff; //output bit code and segment code

P0=DSY_CODE[Table_of_Digits[i][j]];

P3=_crol_(P3,1);

j=(j+1)%8; //The next byte index of the i-th row of the array

If(++t!=350) return; //Keep refreshed for a while

t=0;

i=(i+1)%2; //Display the year, month, and day when the array line i=0, and display the hour, minute, and second when i=1


}

单片机C语言程序设计:定时器控制数码管动态显示 0

Industrial Cable Assembly

Wire harnesses are commonly used in the electronics industry, the automotive industry, in the manufacture of construction machinery and industrial equipment, as well as in the manufacture of white goods such as washing machines and dryers, refrigerators, and other household appliances.A industrial wire harness is typically designed to simplify the manufacture of a larger component, and is designed based on the geometric and electrical requirements of the equipment it is to be installed in.

Industrial Cable Harness,Mechanical Cable Assembly,Industrial Cable Harness,Mechanical Cable Assembly,Accessories Service

ETOP WIREHARNESS LIMITED , https://www.wireharness-assembling.com

Posted on