![]()
Single chip microcomputer STM32L151CCU6
![]()
1206RGB (single)
![]()
0201 package SLP0603 ESD electrostatic diode 5V one-way ESD
![]()
Supply SMD LED Light Emitting Diode SMD LED LED Beads 0603, 080
// Select RAO as the analog input channel;
// Continuous conversion 4 times and then averaged as a conversion result
// The final structure only takes the lower 8 bits
// The result is sent to the lower 3 digits of the digital tube display
#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
const char TABLE[] = {0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x90};
// Define a constant 0-9 data table
void DELAY(); // Delay function declaration
void init(); // I/O port initialization function declaration
void display(int x); // Display function declaration
//------------------------------------------------
// The main program starts
void main()
{
int result = 0x00; // Define conversion result register
while(1) // Infinite loop
{
int i; // Define the loop number control register
result = 0x00; // The conversion result is cleared to 0
for(i = 5; i > 0; i--) // To find the average of 5 conversion results
{
init(); // Call initialization function
ADGO = 0x1; // Turn on the conversion process
while(ADGO); // Waiting for conversion to complete
result = result + ADRESL; // Accumulated conversion result
}
result = result / 5; // To find the average of 5 results
display(result); // Call display function
}
}
//-----------------------------------------------
// Initialization function
void init()
{
PORTA = 0xFF;
PORTD = 0xFF; // Extinguish all displays
TRISA = 0x1; // Set RA0 as input, the other is output
TRISD = 0x00; // Set D port is all output
ADCON1 = 0x8E; // Conversion results are left aligned, RA0 is the analog input port, others do ordinary I/O
ADCON0 = 0x41; // System clock Fosc / 8, select RA0 channel, allow ADC to work
DELAY(); // Guaranteed sampling delay
}
//-----------------------------------------------
// Display function
void display(int x)
{
int bai, shi, ge, temp; // Define 4 temporary variables
temp = x; // Scratch AD conversion results
bai = temp / 0x64; // Seeking the hundredth place displayed
shi = (temp % 0x64) / 0xA; // Seeking the ten digits displayed
ge = (temp % 0x64) % 0xA; // Seeking the displayed ones
PORTD = TABLE[bai]; // Check the table to display the code of hundreds of digits
PORTA = 0x37; // RA3 output low level, lighting hundreds of digits display
DELAY(); // Delay for a certain time to ensure display brightness
PORTD = TABLE[shi]; // Check the table to display the code of ten digits
PORTA = 0x2F; // RA4 output low level, light up ten display
DELAY(); // Delay for a certain time, to ensure brightness
PORTD = TABLE[ge]; // Seeking the code displayed in one place
PORTA = 0x1F; // RA5 output low level, light up one bit display
DELAY(); // Delay for a certain time, to ensure brightness
}
//----------------------------------------------
// Delay program
void DELAY() // Delay program
{
int i; // Define the shaping variable
for(i = 0x100; i--;); // Delay
}
Laser Scanner
Laser radar contains LSPD safety laser scanner and LS laser radar. LSPD safety laser scanner is type 3 with CE certificate. It can be used for agv safety and industrial area protection. LS laser radar is for agv guide. Many famous agv manufacturers has installed LS laser radar to guide their agvs. Feedback from customers are quite posotive.
Laser Radar,Auto Guided Vehicle Guide Radar, Laser Radar,Safety Scanner,Safety Laser Scanner, Laser Radar
Jining Keli Photoelectronic Industrial Co.,Ltd , https://www.sdkelien.com