Detailed explanation of the test program of the microcontroller experimental development board

Publisher:TranquilBreezeLatest update time:2012-05-26 Source: 21ic Keywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Detailed explanation of the test program of the microcontroller experimental development board

Usually the test development board provided by our website is a finished board that has been welded and tested. If you are a netizen who purchases a kit, you can start a series of installation and experiments on the 51 single-chip microcomputer experimental board. The experimental board kit ordered by netizens contains the following component list. Please check the component list carefully after receiving the goods:

AT89C51 MCU Experiment Development Board Kit Component List:

A specially designed full-process circuit board

Power supply components:

1. A 9V DC plug-in small power supply with a plug (12V when no load)

2. One power socket

3. One 7805 voltage regulator chip

4. Two 470UF/16V power filter capacitors

5. Two 0.1UF monolithic capacitors

6. One green LED for power indication

7. LED current limiting resistor 560 ohm resistor

Components that are necessary for a microcontroller:

1. One AT89C51 microcontroller chip

2. One 40-pin zero-force ZIF socket

3. One 22UF/16V capacitor for reset

4. Reset resistor 1K

5. 2 30P small capacitors

6. One 12M crystal oscillator
Experimental components:

1. 8 small red rectangular LEDs

2. 8-bit 1K digital tube current limiting resistor

3. One common cathode two-digit integrated digital tube

4. A 5V electromagnetic buzzer

5. 1 8550 driver transistor (e/b/c)

6. Three 1K transistor base drive resistors

7. 4 micro touch switches

8. One 4-digit red dip switch

9. 2 12V JQC-3F relays (one set of normally open to normally closed)

10. 2 IN4148 anti-reverse peak diodes

11. 2 8050 driver transistors (e/b/c)

12. 2 relay status indication red LEDs

1. One piece of original imported MAX232 chip

2. Two 5.1K pull-up resistors

3. 4 10UF capacitors

4. One plastic-sealed integrated infrared receiver

5. One AT24C02 memory chip

6. One 220UF filter capacitor

7. One 0.1UF capacitor

8. One infrared remote control handle with 32 buttons

9. One serial communication cable

10. One 4.7K pull-up resistor for DS18B20

For those who buy finished boards, they get products that have been soldered and tested. Whether they buy kits or finished MCU experimental development boards, the MCU they get has a test program burned into it. The test program is mainly used to test the MCU and related peripheral components of the 51 test board. If this program can run smoothly, it means that all aspects of the experimental board are normal.

The test program may be complicated for beginners, but it is also composed of several small programs on the website. Beginners can master this program by studying the following tutorials.
[page]

The function of this test program is: after the power is turned on, the eight light-emitting diodes of the P0 port light up from bottom to top in turn, then the buzzer beeps, the two relays act in turn, the ones digit of the digital tube displays 8, then changes to the tens digit to display 8, and then continues to cycle. If the button of the infrared remote control is pressed at this time, the buzzer immediately emits a "beep beep" prompt sound, and the key value of this button is displayed on the computer screen through the serial port (serial port debugging software needs to be run). Through this program, it can be judged that the hardware and software of each part of the single-chip microcomputer experimental development board are intact. The specific source program is as follows:

ORG 0000H

AJMP MAIN; enter the main program

ORG 0003H; external interrupt P3.2 pin INT0 entry address

AJMP INT; transfer to external interrupt service subroutine (infrared remote control decoding program)

; The following is the CPU interrupt mode setting for the main program

MAIN:LCALL YS3; Wait for the hardware to be powered on and stable

SETB EA; Open the CPU general interrupt request

SETB IT0; Set the trigger mode of INT0 to pulse negative edge trigger

SETB EX0; Open INT0 interrupt request

MOV SCON, #50H; set to serial port 1 mode

MOV TMOD, #20H; Baud rate generator T1 works in mode 2

MOV PCON, #80H; baud rate doubled to 2400x2=4800BPS

MOV TH1, #0F3H; preset initial value (preset initial value according to baud rate 2400BPS)

MOV TL1, #0F3H; preset initial value (preset initial value according to baud rate 2400BPS)

SETB TR1; Start timer T1

;The above completes the initialization setting of serial communication

START:MOV P1, #01111111B

LCALL DELAY

MOV P1, #10111111B

LCALL DELAY

MOV P1, #11011111B

LCALL DELAY

MOV P1, #11101111B

LCALL DELAY

MOV P1, #11110111B

LCALL DELAY

MOV P1, #11111011B

LCALL DELAY

MOV P1, #11111101B

LCALL DELAY

MOV P1, #11111110B; The LED of P1 port lights up from bottom to top once in a cycle, with a delay of about 250 milliseconds

LCALL DELAY

MOV P2, #11011111B; the buzzer sounds once

LCALL DELAY

MOV P2, #11101111B; relay J1 is energized once

LCALL DELAY

MOV P2, #11110111B; relay J2 is energized once

LCALL DELAY

MOV P0, #0FFH

MOV P2, #01111111B; the digital tube displays 8

LCALL DELAY

MOV P0, #0FFH

MOV P2, #10111111B; Digital tube shows 8 in ten digits

LCALL DELAY

AJMP START; Repeated loop

; The following is the subroutine to enter the P3.2 pin external interrupt, which is the decoding program

INT: CLR EA; Temporarily disable all CPU interrupt requests
MOV R6, #10

SB: ACALL YS1; call 882 microsecond delay subroutine

JB P3.2, EXIT; after a delay of 882 microseconds, determine whether the P3.2 pin has a high level. If so, exit the decoding program.

DJNZ R6, SB; repeat 10 times, the purpose is to detect if a high level appears within 8820 microseconds and exit the decoding program

;The above completes the recognition of the 9000 microsecond initial low-level signal of the remote control signal.

JNB P3.2, $; Wait for high level to avoid 9ms low level boot pulse

ACALL YS2; delay 4.74 milliseconds to avoid the 4.5 millisecond result code

MOV R7, #26; Ignore the first 26 bits of the system identification code

JJJJA: JNB P3.2, $; Waiting for the high level signal of the first bit of the address code

LCALL YS1; After the high level starts, use the 882 microsecond time ruler to determine the high and low level status of the signal at this time

MOV C, P3.2; store the current level of P3.2 pin 0 or 1 into C

JNC UUUA; if it is 0, jump to UUUA

LCALL YS3; if high level 1 is detected, delay 1 millisecond to wait for the pulse high level to end

UUUA: DJNZ R7, JJJJA

MOV R1, #1AH; Set 1AH as the starting RAM area

MOV R2, #2; Receive 2 memories from 1AH to 1BH, used to store the operation code and the inverse operation code

PP: MOV R3, #8; each group of data is 8 bits

JJJJ: JNB P3.2, $; wait for the high level signal of the first bit of the address code

LCALL YS1; After the high level starts, use the 882 microsecond time ruler to determine the high and low level status of the signal at this time

MOV C, P3.2; store the current level of P3.2 pin 0 or 1 into C

JNC UUU; if it is 0, jump to UUU

LCALL YS3; if high level 1 is detected, delay 1 millisecond to wait for the pulse high level to end

UUU: MOV A, @R1; move the address in R1 to A

RRC A; shift the value 0 or 1 in C into the lowest bit in A

MOV @R1, A; temporarily store the number in A in the memory of R1 value

DJNZ R3, JJJJ; receive full 8 bits and change a memory

INC R1; add 1 to the value in R1 and replace the next RAM

DJNZ R2, PP; After receiving the 8-bit data code and the 8-bit data inverse code, store them in 1AH/1BH

MOV A, 1AH

CPL A; invert 1AH and compare it with 1BH

CJNE A, 1BH, EXIT; if not equal, it means an error occurred in receiving data, and give up

MOV P1, 1AH; display the key value through the 8 LEDs of P1 port!

MOV A, 1AH; send the key value of the specific button of the infrared remote control to the serial port

MOV SBUF, A; displayed on the computer screen through the serial port

CLR P2.5; The buzzer beeps, indicating that the decoding is successful

LCALL YS2

LCALL YS2

LCALL YS2

SETB P2.5;Buzzer stop

EXIT: SETB EA; Enable interrupt

RETI ; Exit the decoding subroutine

YS1: MOV R4, #20; (occupying R4/R5) Delay subroutine 1, accurate delay 882 microseconds

D1: MOV R5, #20

DJNZ R5, $

DJNZ R4, D1

RET

YS2: MOV R4, #10; (occupying R4/R5) Delay subroutine 2, accurate delay of 4740 microseconds

D2: MOV R5, #235

DJNZ R5, $

DJNZ R4, D2

RET

YS3: MOV R4, #2; (occupying R4/R5) delay program 3, accurate delay 1000 microseconds

D3:MOV R5, #248

DJNZ R5, $

DJNZ R4, D3

RET

DELAY:MOV R1, #08H; (occupying R1/R2/R3) delay subroutine, 12M crystal oscillator delay is about 250 milliseconds

L3: MOV R2, #0FAH

L1: MOV R3, #0FAH

L2: DJNZ R3, L2

DJNZ R2, L1

DJNZ R1, L3

RET

END

[page]

Installation and debugging of microcontroller power supply and basic parts

1.5V power supply installation and debugging

First of all, we will complete the most basic and necessary installation and debugging of the power supply part. Any circuit cannot be separated from the power supply part, and the single-chip microcomputer system is no exception. Moreover, we should attach great importance to the power supply part. We should not ignore it because the power supply circuit is relatively simple. In fact, nearly half of the faults or production failures are related to the power supply. Only when the power supply part is done well can the normal operation of the circuit be guaranteed.

The AT89C51 experimental development board provides a 9V 400mA external AC power supply, which can output a 12V DC voltage at no load. If some netizens do not need the voltage-stabilized power supply we provide and need to equip themselves, they can choose a power supply with an output DC voltage between 10 and 15V, and the plug polarity is positive inside and negative outside. Remember! The DC voltage output by the voltage-stabilized power supply is introduced into the experimental development board through a special power socket. The two on the left are 12V power filter capacitors. Generally, a small capacitor is connected in parallel next to a large capacitor to reduce the high-frequency internal resistance. Because large electrolytic capacitors are generally manufactured using a winding process, the equivalent inductance is relatively large. Small capacitors can provide a high-frequency channel with a small internal resistance, reducing the full-band internal resistance of the power supply. This is very common in actual circuits~

First, we find the components to be used from the kit, as shown below:

The power supply part is divided into two parts. One part directly provides 12V DC power supply, which is mainly used for relays. The other part is stabilized into 5V DC power supply by three-terminal voltage regulator chip 7805 and provided to the microcontroller system. The two capacitors on the right are filter capacitors of 5V power supply. The resistor and green LED form the working indication circuit of 5V power supply. As long as the power supply part is normal, the green LED1 will light up. We can judge whether the whole power supply part is working properly based on this LED. The power supply part is the component that needs to be installed in the image below.

Note:

1. Do not reverse the positive and negative poles of polarized electrolytic capacitors. The one with the longer pin is the positive pole.

2. Do not install the three-terminal voltage regulator 7805 upside down. You can refer to the position in the picture and follow the instructions.

3. Do not reverse the polarity of the LED, the one with the longer pin is the positive pole

Finally, please use a multimeter to measure whether the +12V and +5V outputs are normal.

2. AT89C51 MCU Minimized System Installation Test

We find the components we need from the kit, as shown below:

The minimized system of the microcontroller refers to the peripheral components necessary for the microcontroller to work properly. It can be mainly divided into the clock circuit and the reset circuit. We use the AT89C51 chip, which has a 4K FLASH program memory inside. Generally, this 4K storage space is enough for us to use, so we fix the 31st pin of the AT89C51 chip to a high level (it has been connected when the PCB is drawn), so we only use the 4K program memory inside the chip. The clock circuit of the microcontroller consists of a 12M crystal oscillator and two 30P small capacitors, which determine the working time accuracy of the microcontroller to 1 microsecond. The reset circuit consists of a 22UF capacitor, a 1K resistor and an IN4148 diode. In the past, textbooks often recommended using a 10UF capacitor and a 10K resistor to form a reset circuit. Here we choose a 22UF capacitor and a 1K resistor based on actual experience. The advantage is that the reset pin's impedance to ground is reduced under the premise of meeting the reliable reset of the microcontroller, which can significantly enhance the anti-interference ability of the microcontroller reset circuit. The function of the diode is to quickly discharge the charge of the capacitor, so that multiple resets can be successful in a short period of time.

There is a simple way to judge whether the microcontroller chip and clock system are working properly, that is, to use a multimeter to measure the voltage of the microcontroller crystal oscillator pins (pins 18 and 19) to ground. Take the measurement of a normally working microcontroller with a digital multimeter as an example: pin 18 is about 2.24V to ground, and pin 19 is about 2.09V to ground. For microcontrollers that are suspected to be unable to work properly due to a reset circuit failure, the analog reset method can also be used to judge. When the microcontroller is working normally, the voltage of pin 9 to ground is zero. You can use a wire to connect it to +5V for a short time to simulate a power-on reset. If the microcontroller can work normally, it means that there is a problem with the reset circuit.

Keywords:MCU Reference address:Detailed explanation of the test program of the microcontroller experimental development board

Previous article:Design of water level control system based on single chip microcomputer
Next article:GPS/electronic compass attitude measurement and positioning system based on single chip microcomputer

Recommended ReadingLatest update time:2024-11-16 21:51

Interface circuit between USB interface chip CH375 and single chip microcomputer
  The USB interface uses the USB interface chip CH 375 developed by Nanjing Qinheng Electronics Co., Ltd., which adopts a passive parallel interface. CH375 works in the host mode, mainly realizing the single-chip microcomputer reading USB disk function and the mobile control of light data, which enhances the scalabili
[Microcontroller]
Interface circuit between USB interface chip CH375 and single chip microcomputer
Design of Universal Programmer for Freescale HCS12 Series MCU
Introduction     With the widespread application of Flash technology in microprocessors, there have been revolutionary changes in the development and application methods of single-chip microcomputers, from traditional emulators (ICE) to the currently popular JTAG. Designers are still constantly looking for a developm
[Microcontroller]
Design of Universal Programmer for Freescale HCS12 Series MCU
Design of stepper motor control system using 89C51 microcontroller
This article brings you the stepper motor control system design of two 89C51 microcontrollers. Design of stepper motor control system for 89C51 microcontroller The overall system diagram is shown in Figure 1. This system uses external interrupt mode. Port p0 is used as the signal input part, port p1 is the light-emi
[Microcontroller]
Design of stepper motor control system using 89C51 microcontroller
Stm8L series microcontrollers have low power consumption
The Stm8L series microcontroller has five low power modes: Wait mode Low power run mode Low power wait mode Active-halt with full RTC mode Halt Mode The lowest power consumption is the halt mode. Here we will mainly summarize how to enter the halt mode, how to wake up after entering, and how to automatical
[Microcontroller]
MCU industry big names joined Lingdong Microelectronics
Lingdong Microelectronics recently announced that Geoff Lees, a world-renowned expert in the semiconductor MCU field, has officially joined Lingdong as senior vice president of strategy and innovation. Geoff Lees was formerly the senior vice president and general manager of the edge processing business un
[Mobile phone portable]
Design of ICSP Interface Circuit for PIC Microcontroller
ICSP interface circuit In-circuit serial programming (ICSP) is one of the features of PIC microcontrollers. It can burn programs directly into the microcontroller and perform in-circuit serial programming and debugging on the microcontroller. The ICSP interface circuit has only five wires, which are: VPP, VDD, VSS,
[Microcontroller]
Design of ICSP Interface Circuit for PIC Microcontroller
Freescale MCU DZ60---TPM1\TPM2 overflow interrupt
#include hidef.h /* for EnableInterrupts macro */ #include "derivative.h" /* include peripheral declarations */   //TPM interruption experiment, LED1 flashes once every second? //1: Select CLKS in TPM1SC as the clock source //2: Programmable clock divider by setting the PS bit in TPM1SC. //3: Enable interrupt. TOIE b
[Microcontroller]
Interface Design of Single Chip Microcomputer Queuing System Based on IIC Bus
  0 Introduction   This paper takes the existing queueing system of the bank as an example and proposes the interface design of the single-chip microcomputer queueing system based on the IIC bus. Through the simulation test of the system, it not only simplifies the design circuit, reduces the circuit board area, sav
[Microcontroller]
Interface Design of Single Chip Microcomputer Queuing System Based on IIC Bus
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号