#include//Includes the predefined internal resources of the microcontroller
__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
constcharTABLE[]={0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92};//Define the data table of constants 0-5
voidmain()//Main function
{
while (1) // infinite loop, let the digital tube continue to light
{
init();//Call the initialization function
PORTD=TABLE[0];//The first data 0 of the D port output data table
PORTA=0X3E;//Light up the first digital tube
delay();//Delay for a certain time to ensure the brightness of the digital tube
PORTD=TABLE[1];//Display data 1 (same as data 0)
PORTA=0X3d;
delay();
PORTD=TABLE[2];//Display data 2 (same as data 0)
PORTA=0X3b;
delay();
PORTD=TABLE[3];//Display data 3 (same as data 0)
PORTA=0X37;
delay();
PORTD=TABLE[4];//Display data 4 (same as data 0)
PORTA=0X2f;
delay();
PORTD=TABLE[5];//Display data 5 (same as 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 port A as normal I/O port
PORTA=0xff;
PORTD=0xff;//Turn off all displays first
}
voiddelay()//Delay program
{
inTI;//Define the integer variable
for(i=0x100;i--;);//Delay
}
System Integration,Monitoring System Battery,Anti-Theft System Battery,Hybrid Power System Battery
Wolong Electric Group Zhejiang Dengta Power Source Co.,Ltd , https://www.wldtbattery.com