Intelligent answering machine circuit control board program development
As an electronic product, the answering machine is well known and widely used in various intellectual competitions. Through means such as indicator light display, nixie tube display and warning loudspeaker of the responder, the priority responder can be judged accurately, fairly and intuitively. However, most of the currently used answering machines are designed with discrete components, and the cost is relatively high. With the development and popularization of science and technology, single-chip microcomputers are also going to every corner of society. This paper adopts single-chip microcomputer technology to design a multi- road answering machine.
1. The overall scheme design of the intelligent answering machine
This intelligent answering machine takes AT89C51 single-chip microcomputer as the control core, and is composed of reset circuit, clock circuit, moderator button circuit, player answering button circuit, LED display circuit, alarm circuit and so on. The answering machine can be used for 16 players or 16 representative teams to compete at the same time, and the 16 buttons K1~K16 are used for quick answering. When the moderator activates the "start rush answer button", the timer will count down, and when the countdown is 0, the rush answer is prohibited. During the last 5S countdown of the answering time, the system will give an alarm every 1S. It is valid for the contestants to rush to answer within the set time, and the number of the contestants will be displayed and the countdown to answer the questions will start at the same time. During the countdown to answer the question, if the contestant answers correctly, the host will give the contestant extra points through the "additional point button". If there is a contestant rushing to answer when the host does not activate the "start answering button", the host will deduct points from the contestant through the "minus point button". In addition, the circuit also has latch and display functions. That is, a certain player presses the button to lock the corresponding player's entry number and display it on the LED digital tube, and at the same time the speaker emits an alarm sound to prompt. Other key presses will not respond. During the countdown of answering, if the host wants to stop the countdown, he can press the "stop button for answering", and the system will enter the ready state and enter the countdown to answer the question.
2. Hardware circuit design of intelligent answering machine
The hardware circuit of the system is composed of AT89C51 microcontroller, 8 in-phase 3-state buffers/line drivers 74HC244, common anode LED digital tubes, 74HC14 inverters, buttons, speakers and so on. The P1 port of the single-chip microcomputer is the input port of 16 groups of rush-answer buttons, the P0 port is the segment selection port of the digital tube, and the P2 port is the bit selection port of the digital tube. P3 port is used for moderator button setting and speaker connection.
2.1 Chip selection: The core of the responder circuit is the MCS-51 series AT89C51 single-chip microcomputer. AT89C51 is a low-voltage, high-performance CMOS 8-bit single-chip microcomputer produced by the American ATMEL company. It is fully compatible with the MCS-51 product instruction system and has 128×8 bytes. Internal RAM, 32 programmable I/O port lines?, 2 16-bit timers/counters and 6 interrupt sources, also has low-power idle and power-down modes. The AT89C51 single-chip microcomputer is powerful and can be flexibly used in various control fields.
2.2 Reset circuit: The reset circuit adopts the button level reset method, when the reset button is pressed, a high-level reset signal is sent to pin 9. The electrolytic capacitor is charged and discharged so that the reset high level signal lasts for more than 2 machine cycles. When the button is released, the pin 9 slowly reaches the low level and then exits the reset. The program is executed from scratch.
2.3 Clock circuit: The internal clock mode is adopted in this design. Its input terminals are XTAL1 and XTAL2. Through these two pins, a quartz crystal oscillator and two capacitors are connected in parallel (internal clock mode). The quartz crystal and capacitors form an oscillating circuit, and the generated clock is sent to the internal components of the microcontroller.
2.4 Moderator button circuit: The intelligent answering machine has four moderator buttons, among which S1 and S2 are "answering start button" and "answering stop button" respectively, and the corresponding I/O ports are P3.0 and P3. 1; S3 and S4 are respectively the "Correct answer bonus key" and "Foul deduction key", and the corresponding I/O ports are P3.2 and P3.3. The circuit adopts an independent keyboard. The independent keyboard means that each button is connected to an input IO port. For example, when the host wants to press the "answering start button" S1, if the button is not pressed, the corresponding port P3 of the CPU. 0 Because there is a pull-up resistor, its input is high level "1"; when the button is pressed, the corresponding P3.0 port becomes low level "0", so that P3.0 port changes from high level to low level. So as long as you judge the state of the IO port in the program, you can know which button is in the closed state.
2.5 Answer key circuit: Because the intelligent answering machine needs 16 keys, and the P1 port only has 8 IOs, the circuit selects determinant keys, and the keys are set at the intersection of the determinants. The row lines are connected to P1.0~P1.3, and the column and row lines are connected to P1.4~P1.7. Set all row lines (P1.0, P1.1, P1.2 and P1.3) to low level "0", set all column lines to high level "1" and then detect the state of the column lines. If only one column has a low level, it means that a key is pressed on the keyboard. If it is detected that all the column lines are at high level, then no key is pressed on the keyboard. After judging that a key is pressed, call the delay subroutine to debounce, and then judge again. When a key is pressed, turn to progressive scanning to identify the key number. For example, when the button K1 is pressed, the first row (P1.0 port) is scanned, that is, the first output low level "0" (that is, P1.0=0), and then the column value is read, that is, P1.4, P1.5, For the values of P1.6 and P1.7 ports, which column has a low level "0", it means that the key crossing the column and the first row is pressed, when the MCU scans that the P1.4 pin is low level " 0", it can be judged that the K1 key is pressed.
2.6 Display circuit: In this circuit, six common anode LED digital tubes are used. This circuit is a dynamic display mode. The dynamic display can save the resources of the IO port, which is beneficial to reduce the cost. Segment control adopts P0 port. In the circuit, P0 port is connected to the digital tube segment selection signal port through 74HC244. 74HC244 is an 8-in-phase 3-state buffer line driver. It is a high-speed CMOS device, and its pins are compatible with low-power TTL series; The control adopts P2 port, and P2.0~P2.5 in the circuit are connected to the position selection signal port of the digital tube through 74HC14. 74HC14 is a high-speed CMOS device compatible with TTL device pins, and its logic function is 6-way Schmitt trigger. It uses low power, is fast, and converts slowly changing input signals into clear, jitter-free output signals. The left two digits of the digital tube (P2.0 port, P2.1 port) are used to display the number of the answering contestants, the middle two digits (P2.2 port, P2.3 port) display the countdown time, and the rightmost two digits (P2.4 mouth, P2.5 mouth) to display the contestant's score.
2.7 Alarm circuit: The function of the alarm circuit in the intelligent responder circuit is to attract people's attention. For example, when the host does not press the "start answer button", if a contestant presses the "answer button", the alarm circuit will alarm to remind the host that there are contestants rushing to answer; and the countdown of the answering time and answering time of each question In the last 5 seconds, an alarm will be issued every 1 second to remind the contestants that the countdown time is about to run out.
The alarm circuit selects P3.6 port and P3.7 port. The P3.7 port is first connected to a resistor and then to the base of a PNP triode, the collector of the triode is grounded, and the emitter is connected to the other end of the speaker. The P3.7 port of the microcontroller is responsible for the sounding circuit. When the P3.7 port is at low level, that is, the base of the triode is at a low level, the triode is turned on, and the speaker works, thus completing the sounding circuit. The P3.6 port is connected to one end of the speaker through a light-emitting diode, and the +5v power supply is connected between the speaker and the light-emitting diode. When the P3.6 port is low level, the light-emitting diode is turned on, and the diode is bright.
3. Program design of intelligent answering machine system
3.1 Main program: In the main program, the control system must first be initialized, and then the "start answering button" button should be scanned to determine whether the host has pressed the "start answering button" button. If the button is pressed, the timer will be triggered Interrupt T0, scan the answering button every 0.5ms, if any answering player presses the button, execute the countdown subroutine and display program, and call the normal answering subroutine, display the remaining answering time, and display the locked answering player number, And accompanied by a sound. In addition, the circuit must be blocked at the same time to prohibit other players from rushing to answer. If there is no contestant to answer, when the countdown is 5s left, the alarm program will be triggered, that is, the timer will be interrupted by 1, and it will beep every 1s. If the host does not press the "Start answering key" button, if there is a contestant to answer, the illegal answering query subroutine will be performed to determine the number of the illegal answering player, and the illegal answering subroutine will be called at the same time, and finally return; if there is no contestant to answer, it will return .
3.2 Initialization program: The control system needs to be initialized when it starts to work normally. The initialization of the intelligent responder is mainly two timers and two external interrupts. The two timing interrupts are the 0.5ms scan and the 1s timing interrupt for the answer button respectively. The timer interrupt T0 adopts the programming of 0.5ms timing in working mode 1, so that it generates an interrupt of 05ms. The CPU responds to the interrupt, executes the interrupt program, and makes the keyboard scan once every 0.5ms, thus realizing the regular scan of the keyboard. The timer interrupt T1 adopts working mode 2 to set a timing of 0.2ms, and runs 5000 times to set a timing of 1s. The two external interrupts are respectively connected to the "answering start button" and "answering stop button".
3.3 Countdown subroutine: The "countdown of answering time" of the intelligent answering machine is set to 15s, and the "counting down of answering time" is set to 30s. Use the timer to interrupt T1 timing for 1s. If the 1s timing time is up, the countdown will be automatically decremented by 1 and displayed on the digital tube. Then judge whether the countdown reaches 0 at the end of the countdown. If not, the 1s countdown will be decremented by 1 until the countdown counts down, and then exit.
3.4 Normal answering subroutine: After the host presses the "Start answering button", the system will automatically count down for 15 seconds, and the middle two digits of the digital tube will display the countdown time. The answering player's number, and the lower two digits of the nixie tube display the player's current score. After the answering is successful, the host presses the "stop answering button", and the high digit of the digital tube will automatically display the 30s countdown of the answer time. The final score of the answering contestant; if the answer is wrong, no points will be added.
3.5 Illegal answering subroutine: When the host has not pressed the "start answering button", the six-digit digital tube will display "000000". If there is a quick answer, the upper two digits of the nixie tube will display the number of the quick answerer, the lower two digits will display the score of the quick answerer, and the middle two digits will display "FF", which is constantly flashing, indicating that there is a foul phenomenon. At this time, the host presses "Score reduction button", the offending player will be deducted points, and the lower two digits of the nixie tube display the remaining points of the offending player.
Summarize
The intelligent answering machine based on 51 single-chip microcomputer has the characteristics of simple structure, powerful function, high intelligence and low failure rate. After system debugging and operation, it can be widely used in various knowledge contests and answering occasions.
The above is the development example of the intelligent answering machine introduced by Shenzhen Zuchuang Microelectronics Co., Ltd. for you. If you have bluetooth headset solution development needs, you can trust us. We represent a variety of single-chip microcomputers, voice chips, dual-mode Bluetooth ICs, and wifi chips. Brands include Songhan MCU, Yingguang MCU, Jerry Bluetooth, Ankai Bluetooth, Allwinner, and Realtek. Our technical services include: PCB design, MCU development, Bluetooth solution, software and hardware custom development, APP development, small program development, WeChat official account development, etc. It can also undertake the design of intelligent electronic products, the development of living appliances, the research and development of beauty equipment, the application of Internet of things platform, the smart home control system, the development of TWS earphones, Bluetooth earphone speakers, the development of children's educational toys, the design of electronic education products, etc.
Proposal recommendation
- TOP