Single chip microcomputer STM32L151CCU6
1206RGB (single)
Crystal oscillator
Mobile phone crystal 3.2*2.5mm 3225 26M (26.000MHZ) 7.5PF 10PPM 20PPM 30PPM

PIC16C74 MCU Display Program

/******************************************************************************
************PIC16C74 MCU Control**************
******************************************************************************/
#include <pic.h>
#include <stdio.h>
#include <math.h>
#define uchar unsigned char
#define uint unsigned int
//---------------------------------------
#define BIAS 0x50 // 1/2 bias, 4 back pole
#define RC 0x30 // System clock is selected as on-chip RC oscillator
#define WDTDIS 0x0A // Disable WDT overflow flag output
#define TIMERDIS 0x08 // Time base output disable
#define SYSEN 0x02 // Open the system clock
#define LCDON 0x06 // Open bias generator
#define SYSDIS 0x00 // Turn off the system clock and bias generator

#define KEY_UP RB7
#define KEY_DOWN RB6
#define KEY_SET RB5
//--------------------------------------
//static unsigned char KeyV, TempKeyV; // key value
unsigned char buf0, buf1, buf2, buf3, buff;
unsigned char buf[4];
unsigned char k, data, sreg, disppoint;
unsigned int i;
const unsigned char table[10] = {0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xd8, 0x80, 0x90};
//*********************************
/* delay function */
//*********************************
void delay_10ms()
{
uint j;
for(j=0; j<1000; j++)
{
;
}
}
//*********************************
void delay_1ms()
{
uint j;
for(j=0; j<100; j++)
{
;
}
}
//**********************************
void delay1s()
{
uchar i;
uint j;
for(i=0; i<10; i++)
for(j=0; j<1300; j++);
}
//**********************************
// button waiting program
//**********************************
void keywait()
{
while((PORTB & 0xF0) != 0xF0)
{
;
}
}
//********************************
void buf_initial()
{
buf0 = 0x00;
buf[0] = buf0;
buf1 = 0x00;
buf[1] = buf1;
buf2 = 0x00;
buf[2] = buf2;
buf3 = 0x00;
buf[3] = buf3;
sreg = 0x00;
}
//**********************************
void put_num(char c)
{
PORTC = table[c & 0x0f];
}
//**********************************
void display()
{
disppoint = 0;
put_num(buf[disppoint]);
RC0 = 0;
delay_1ms();
RC0 = 1;

disppoint++;
put_num(buf[disppoint]);
RC1 = 0;
delay_1ms();
RC1 = 1;

disppoint++;
put_num(buf[disppoint]);
RC2 = 0;
delay_1ms();
RC2 = 1;

disppoint++;
put_num(buf[disppoint]);
RC3 = 0;
delay_1ms();
RC3 = 1;
}

//**********************************
// AD conversion initialization subroutine
//*********************************
void ad_initial()
{
ADCON0 = 0B01001001; // fosc/8 RA1/AN1 ADON=1
ADCON1 = 0B00000010; // AN0-AN4 = AVREF = VDD
ADIE = 1; // ADC interrupt enable
PEIE = 1; // Peripheral interrupt enable
}
//**********************************
// Key processing subroutine
//**********************************
void keywork()
{
if ((PORTB & 0xFF) != 0xFF) // If P1.2-P1.4 is not all 1, there may be a key press
{
delay_10ms(); // delay for debouncing
if ((PORTB & 0xFF) != 0xFF) // Reread P1.2-P1.4 bit, if still not all 1, there is a key press
{
if ((PORTB & 0xF0) != 0xF0) // Check again to confirm key press
{
//-------------------------------------------
if (KEY_SET == 0) // Press the SET button, exit or enter accordingly
{
RC4 = !RC4;
keywait();
return;
}
else if (KEY_DOWN == 0) // Press the DOWN button
{
RC3 = !RC3;
keywait();
return;
}
else if (KEY_UP == 0) // Press the UP button
{
RC2 = !RC2;
keywait();
return;
}
}
}
}
}

//--------------------------------------



//--------------------------------------
// Timer0 interrupt program
void interrupt clkint(void)
{
TMR0 = 0x13;
T0IF = 0;
CLRWDT();
sreg = sreg + 1;
if (sreg == 40)
{
sreg = 0;
buf[3]++;
if (buf[3] > 9)
{
buf[3] = 0;
buf[2]++;
if (buf[2] > 9)
{
buf[2] = 0;
buf[1]++;
if (buf[1] > 9)
{
buf[1] = 0;
buf[0]++;
if (buf[0] > 9) buf[0] = 0;
}
}
}
}
}
/*******************************Main function ****************** **************/
main() // main function
{
OPTION = 0B00000000;
STATUS = 0X00;
ADCON1 = 0B00000000;
INTCON = 0X00;
PIE1 = 0B00000000;
PIR1 = 0X00;
T1CON = 0B00000000;

T0CS = 0;
PSA = 1;
T0IF = 0;
T0IE = 1;

TRISB = 0XFF;
TRISC = 0X00;
PORTB = 0XFF;
PORTC = 0X00;
buf_initial();
while(1)
{
keywork();
}
}

Electrolytic capacitor

The electrolyte material inside the electrolytic capacitor, which has charge storage, is divided into positive and negative polarity, similar to the battery, and cannot be connected backwards.A metal substrate having an oxide film attached to a positive electrode and a negative electrode connected to an electrolyte (solid and non-solid) through a metal plate.

Nonpolar (dual polarity) electrolytic capacitor adopts double oxide film structure, similar to the two polar electrolytic capacitor after two connected to the cathode, the two electrodes of two metal plates respectively (both with oxide film), two groups of oxide film as the electrolyte in the middle.Polar electrolytic capacitors usually play the role of power filter, decoupling (like u), signal coupling, time constant setting and dc isolation in power circuit, medium frequency and low frequency circuit.Non-polar electrolytic capacitors are usually used in audio frequency divider circuit, television S correction circuit and starting circuit of single-phase motor.

Electrolytic Capacitor,Aluminum Electrolytic Capacitor,High Voltage Electrolytic Capacitor,12V Electronic Components Capacitor

YANGZHOU POSITIONING TECH CO., LTD. , https://www.yzpst.com