Contents 1 *************************************************************Function usage and familiarity**************** ********************************************/ 4 Example 3: Use the MCU to control the first light to light up 4 Example 4: Use the MCU to control a light to flash: Understand the working frequency of the MCU 4 Example 5: Send the state of port P1 to ports P0, P2, and P3 respectively: Understand the pin functions of the I/O port 5 Example 6: Use port P3 to light up an 8-bit LED 5 Example 7: Light up an 8-bit LED by operating the address of port P3 6 Example 8: Use different data types to control the flashing time of the light 7 Example 9: Use ports P0 and P1 to display the results of addition and subtraction operations respectively 8 Example 10: Use ports P0 and P1 to display the results of multiplication operations 9 Example 11: Use ports P1 and P0 to display the results of division operations 9 Example 12: Use the self-increment operation to control the 8-bit LED pattern of port P0 10 Example 13: Use P0 port to display the result of logical \\\"AND\\\" operation 10 Example 14: Use P0 port to display the result of conditional operation 11 Example 15: Use P0 port to display the result of bitwise \\\"XOR\\\" operation 11 Example 16: Use P0 to display the result of left shift operation 11 Example 17: \\\"Universal logic circuit\\\" experiment 11 Example 18: Use right shift operation to light up the 8-bit LED of P1 port 12 Example 19: Use if statement to control the flow direction of the 8-bit LED of P0 port 13 Example 20: Use switch statement to control the lighting state of the 8-bit LED of P0 port 13 Example 21: Use for statement to control the number of times the buzzer sounds 14 Example 22: Use while statement to control LED 16 Example 23: Use do-while statement to control the lighting of 8-bit LED of P0 port 16 Example 24: Use character array to control the lighting of 8-bit LED of P0 port 17 Example 25: Example 26: Displaying the result of pointer operation at port P0 19 Example 27: Using pointer array to control the 8-bit LED at port P0 19 Example 28: Using the pointer of array to control the 8-bit LED at port P0 20 Example 29: Using ports P0 and P1 to display the return value of integer function 21 Example 30: Using parameter function to control the speed of 8-bit LED at port P0 22 Example 31: Using array as function parameter to control the pattern of LED flow 23 Example 32: Using pointer as function parameter to control the 8-bit LED at port P0 23 Example 33: Using function pointer to control the pattern of LED at port P1 25 Example 34: Using pointer array as function parameter to display multiple strings 26 Example 35: Application example of character function ctype.h 27 Example 36: Application example of intrinsic function intrinsics.h 27 Example 37: Application example of standard function stdlib.h 28 Example 38: string function string.h Application Examples 29 Example 39: Macro definition application example 2 29 Example 40: Macro definition application example 2 30 Example 41: Macro definition application example 3 30 ****************************************************************** **Interrupt, timer******** interrupt, timer************ ****************************************************/ 31 Example 42: Use timer T0 query mode P2 port 8-bit control LED flashing 31 Example 43: Use timer T1 query mode to control the microcontroller to send 1KHz audio 31 Example 44: Send the result of counter T0 counting to P1 port 8-bit LED display 32 Example 45: Use timer T0 interrupt to control 1-bit LED flashing 33 Example 46: Use timer T0 interrupt to achieve long-term timing 34 Example 47: Use timer T1 interrupt to control two LEDs to flash in different periods 34 Example 48: Use the interrupt of counter T1 to control the buzzer to emit 1KHz audio 36 Example 49: Use the interrupt of timer T0 to play the theme song of \"Desire\" 36 Example 50-1: Output 50 rectangular pulses 39 Example 50-2: Counter T0 counts the number of external pulses 40 Example 51-2: Mode 2 of timer T0 measures the positive pulse width 40 Example 52: Use timer T0 to control the output of rectangular waves with different high and low widths 41 Example 53: Use the interrupt mode of external interrupt 0 for data acquisition 42 Example 54-1: Output a square wave with a negative pulse width of 200 microseconds 43 Example 54-2: Measure the negative pulse width 43 Example 55: Mode 0 controls the cyclic lighting of the running lights 44 Example 56-1: Data sending program 45 Example 56-2: Data receiving program 47 Example 57-1: Data sending program 47 Example 57-2: Data receiving program 49 Example 58: The MCU sends data to the PC 50 Example 59: The MCU receives data sent by the PC 51 ******************************************************************Digital tube display*****Digital tube display******************** Digital tube display******************** Digital tube display********************************************/ 52 Example 60: Use LED digital to display the number 5 52 Example 61: Use LED digital display to display the numbers 0~9 in a loop 52 Example 62: Use digital tube to display the number \\\"1234\\\" with slow dynamic scanning 53 Example 63: Use LED digital display to pseudo-statically display the number 1234 54 Example 64: Use digital tube to display dynamic detection results 54 Example 65: Design of digital stopwatch 56 Example 66: Design of digital clock 58 Example 67: Use LED digital tube to display the count value of counter T0 62 Example 68: Static display of the number \"59\" 63 ******************************************************************** **Keyboard control*********Keyboard control*************** ***************Keyboard control**** *****Keyboard control**** *****************************************************/ 63 Example 69: Independent keyboard input experiment without software debounce 64 Example 70: Independent keyboard input experiment with software debounce 64 Example 71: Independent keyboard scanning experiment controlled by CPU 65 Example 72: Independent keyboard scanning experiment controlled by timer interrupt 68 Example 73: 4-level variable speed running water light controlled by independent keyboard 71 Example 74: Key function expansion of independent keyboard: \\\"one for four\\\" 73 Example 75: Digital clock experiment with independent keyboard time adjustment 75 Example 76: Experiment of controlling stepping motor with independent keyboard 79 Example 77: Digital tube display experiment of matrix keyboard key value 82 // Example 78: Matrix keyboard key tone 85 Example 79: Simple electronic piano 86 Example 80: Electronic password lock realized by matrix keyboard 92 **************************************************************************** **Liquid crystal display LCD*********Liquid crystal display LCD *****Liquid crystal display LCD ************* *******Liquid crystal display LCD************Liquid crystal display LCD *****Liquid crystal display LCD **** ***********************************************************/ 95 Example 81: Use LCD to display the character \\\'A\\\' 96 Example 82: Use LCD to circularly shift right to display \\\"Welcome to China\\\" 99 Example 83: Use LCD to display timely test results 102 Example 84: LCD clock design 106 ***********************************************************************The use of some chips****24c02 DS18B20 X5045 ADC0832 DAC0832 DS1302 Infrared remote control**************************************************/ 112 Example 85: Write data \"0x0f\" to AT24C02 and read it out to display on port P1 112 Example 86: Write the number of key presses to AT24C02, read it out and display it on 1602 LCD 117 Example 87: Read and write operations on multiple AT24C02s connected to the I2C bus 124 Example 88: Multi-machine communication reading program based on AT24C02 129 Example 88: Multi-machine communication writing program based on AT24C02 133 Example 90: DS18B20 temperature detection and LCD display 144 Example 91: Write data \"0xaa\" to X5045 and read it out to display on port P1 153 Example 92: Write the running light control code to X5045 and read it out to display on port P1 157 Example 93: Read and write operations on multiple X5045s connected to the SPI bus 161 Example 94: Digital voltmeter based on ADC0832 165 Example 95: Generate sawtooth voltage with DAC0832 171 Example 96: Display the key value of infrared remote control with P1 port 171 Example 97: Control relay with infrared remote control 174 Example 98: Calendar clock based on DS1302 177 Example 99: Microcontroller data transmission program 185 Example 100: Design of motor tachometer 186 Simulate Hall pulse 192ADC0832 DAC0832 DS1302 infrared remote control ****************************************************/ 112 Example 85: Write data \\\"0x0f\\\" to AT24C02 and then read it out and display it on P1 port 112 Example 86: Write the number of key presses to AT24C02, then read it out and display it on 1602LCD 117 Example 87: Read and write operations on multiple AT24C02s connected to the I2C bus 124 Example 88: Multi-machine communication reading program based on AT24C02 129 Example 88: Multi-machine communication writing program based on AT24C02 133 Example 90: DS18B20 temperature detection and LCD display 144 Example 91: Write data \\\"0xaa\\\" to X5045 and then read it out and display it on P1 port 153 Example 92: Write the running light control code to X5045 and read it out to P1 port for display 157 Example 93: Read and write multiple X5045s connected to the SPI bus 161 Example 94: Digital voltmeter based on ADC0832 165 Example 95: Generate sawtooth voltage with DAC0832 171 Example 96: Use P1 port to display the key value of infrared remote control 171 Example 97: Use infrared remote control to control relay 174 Example 98: Calendar clock based on DS1302 177 Example 99: Microcontroller data transmission program 185 Example 100: Motor tachometer design 186 Simulate Hall pulse 192ADC0832 DAC0832 DS1302 infrared remote control ****************************************************/ 112 Example 85: Write data \\\"0x0f\\\" to AT24C02 and then read it out and display it on P1 port 112 Example 86: Write the number of key presses to AT24C02, then read it out and display it on 1602LCD 117 Example 87: Read and write operations on multiple AT24C02s connected to the I2C bus 124 Example 88: Multi-machine communication reading program based on AT24C02 129 Example 88: Multi-machine communication writing program based on AT24C02 133 Example 90: DS18B20 temperature detection and LCD display 144 Example 91: Write data \\\"0xaa\\\" to X5045 and then read it out and display it on P1 port 153 Example 92: Write the running light control code to X5045 and read it out to P1 port for display 157 Example 93: Read and write multiple X5045s connected to the SPI bus 161 Example 94: Digital voltmeter based on ADC0832 165 Example 95: Generate sawtooth voltage with DAC0832 171 Example 96: Use P1 port to display the key value of infrared remote control 171 Example 97: Use infrared remote control to control relay 174 Example 98: Calendar clock based on DS1302 177 Example 99: Microcontroller data transmission program 185 Example 100: Motor tachometer design 186 Simulate Hall pulse 192
You Might Like
Recommended ContentMore
Open source project More
Popular Components
Searched by Users
Just Take a LookMore
Trending Downloads
Trending ArticlesMore