Pic digital tube dynamic scanning display program

Single chip microcomputer STM32L151CCU6
0201 package SLP0603 ESD electrostatic diode 5V one-way ESD
MOS tube spot ESD
>#include / / Contains the internal resources of the microcontroller predefined
__CONFIG(0x1832);
/ / Chip configuration word, watchdog off, power-on delay on, power-down detection off, low-voltage programming off, encryption, 4M crystal HS oscillation

Voiddelay();//delay function declaration
Voidinit();//I/O port initialization function declaration
constcharTABLE[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92};//Data table defining constant 0-5

Voidmain()//main function
{

While(1)//infinite loop, let the digital tube continue to light up
{
Init();//call initialization function
PORTD=TABLE[0];//D port output data table first data 0
PORTA=0X3E; / / light the first digital tube
Delay();//delay for a certain period of time to ensure the brightness of the digital tube

PORTD=TABLE[1];//Display data 1 (same data 0)
PORTA=0X3d;
Delay();

PORTD=TABLE[2];//Display data 2 (same data 0)
PORTA=0X3b;
Delay();

PORTD=TABLE[3];//Display data 3 (same data 0)
PORTA=0X37;
Delay();

PORTD=TABLE[4];//Display data 4 (same data 0)
PORTA=0X2f;
Delay();

PORTD=TABLE[5];//Display data 5 (same data 0)
PORTA=0X1f;
Delay();
}
}

Voidinit()//I/O port initialization function
{
TRISA=0X00; / / set A0 output, other input
TRISD=0X00; / / set D port output
ADCON1=0X07;//Set A port to normal I/O port
PORTA=0xff;
PORTD=0xff; / / first off all displays
}

Voiddelay()//delay program
{
Inti; / / define the shaping variable
For(i=0x100;i--;);//delay
}


Network Accessories

Network Accessories,Wifi Adapter,Fiber Optic Network Components,Splitter Fiber Optic

Cixi Dani Plastic Products Co.,Ltd , https://www.dani-fiber-optic.com