ENCYCLOPEDIA OF RADIO ELECTRONICS AND ELECTRICAL ENGINEERING Memory music call on PIC16F84. Encyclopedia of radio electronics and electrical engineering Encyclopedia of radio electronics and electrical engineering / Calls and audio simulators Sometimes you want to know: "Didn't they ring the doorbell when no one was at home?". This will help the proposed musical call, which has a special memory function. It was made on the microcontroller of the popular R/C family. The result was an extremely simple device that can play several dozen melodies and remember the last press of the bell button if the door was not opened on time. The principle of operation of this device is as follows: if the front door is not opened within three minutes from the moment the bell button is pressed, then the next time it is opened, one of the programmed melodies will be played. In other words, when you open the door and hear this melody, you will understand that someone called in your absence. Otherwise, his work does not differ from the usual musical call. In the described embodiment, the device plays 16 melodies, which are selected randomly. By changing the codes of the control program, you can replace ib melodies with any others, as well as change their number and sound time. Schematic diagram of the call is shown in fig. 1. Its basis is the DD1 microcontroller (PIC16F84-04I / P from Microchip). The clock frequency is set by the quartz resonator ZQ1. Signal 34 is taken from pin 7 (RB1) of the microcontroller, amplified by transistor VT1 and reproduced by dynamic head BA1. The bell button SB1 and the door open sensor SF1 are connected to the microcontroller outputs through current-limiting resistors R3, R5. Capacitors C5 and C6 exclude spontaneous operation of the call from interference caused by electrical appliances. The device is powered from the AC mains through a step-down transformer T1. The voltage of the secondary winding is rectified by the diode bridge VD1. DC voltage is stabilized by the integrated regulator DA 1. A drawing of a printed circuit board and the location of parts on it are shown in fig. 2. The board is designed to install MLT resistors. capacitors K50-35 (C1, C2) and KM (the rest). Diode bridge VD1 - KTS405 with any letter index. Quartz resonator ZQ1 - at a frequency of 4 MHz. Capacitors C3, C4 - any ceramic with a capacity of 15 ... 33 pF. Transistor VT1 - any of the KT815 series. The resistance of the resistor R1 should be no more than 40 kOhm. As T1, any transformer is suitable that provides a voltage of 9 ... 10 V on the secondary winding at a current of 0.3 A. In the author's version, a transformer TS-Sh-ZM1 is used. in which the number of turns of the secondary winding is reduced by 90. Button SB1 - usual for a doorbell, door opening sensor SF1 - reed switch. attached to the door frame. A magnet is placed on the door itself. When the door is closed, the reed switch closes under the action of the magnet, and when it is opened, it opens. The sensor can be of any design. Program listing: To replace melodies, let's get acquainted with the principle of placing them in the memory of the microcontroller. They are located in the program memory in the address range from 200H to 3FFH. One note occupies one machine word in memory. Each melody must end with the code 07H. M_RAND mask. located at addresses 0079H and 0085H. determines the number of melodies and. respectively, the maximum number of notes in a melody (Table 2). So, if the mask is F8H (32 melodies of 15 notes), then the first melody will take addresses 200H-20FH. the second -210H-21FH ..... 32nd - 3F0H-3FFH. Obviously, each of them occupies 16 machine words, and the maximum number of notes in a melody is 15 (one machine word is reserved for code 07H). It should be noted: if there is no code 07Н at the end of the melody. then the next one will be played without stopping, etc. until then. until this code is encountered. In this case (16 melodies of 31 notes), the first melody occupies addresses 200H-21FH. the second -220H-23FH, etc. The actual number of notes (from 1 to 31) depends on where the code 07H will be placed. Note codes, depending on their duration and belonging to a particular octave, are presented in Table. 3. You can use the music.exe program to preview melodies. At address 008BH is the Wait_D constant. determining the waiting time for the door to open. This time (in seconds) is approximately equal to Wait_D-2. In our case, the constant is 5AH (in decimal - 90) and the waiting time is 90 2 = 180 s = 3 min. To change the program, you need to load the ring.hex file into a hex editor (usually built into the programmer software) and edit it, taking into account that the machine word of the PIC16F84 microcontroller is 14 bits long and is represented by a four-digit hexadecimal number. Only the two least significant digits need to be replaced, since the most significant ones represent the instruction code. For example, in memory at address 208H is the number 3483H, and you need to write the code 07H. By changing only the lower digits, we get the number 3407Н. It is also possible to make changes directly to the source code of the program (file nng.asm). To do this, you need to create a Ring folder in the root directory of any disk, place the nng.asm, ring.pjt and ring.lkr files there. Then, in the MPLAB v4.12 environment, open the ring.pjt project and the ring.asm file. which needs to be edited. Next, start building the project and get a new ring.hex file. Author: M. Burov, Kostroma See other articles Section Calls and audio simulators. Read and write useful comments on this article. Latest news of science and technology, new electronics: Artificial leather for touch emulation
15.04.2024 Petgugu Global cat litter
15.04.2024 The attractiveness of caring men
14.04.2024
Other interesting news: ▪ The main problem of the colonization of Mars ▪ Magnetic portable charger Anker 622 Magnetic Battery News feed of science and technology, new electronics
Interesting materials of the Free Technical Library: ▪ section of the site Big encyclopedia for children and adults. Selection of articles ▪ article Razzut, shoulder! Wave your hand! Popular expression ▪ article How long does Goethe's Faust last? Detailed answer ▪ article Providing first aid for bleeding. Health care ▪ article Zigzag active UHF antennas. Encyclopedia of radio electronics and electrical engineering
Leave your comment on this article: Comments on the article: Sergei Instead of RTCC it is better to write TMR0 according to 16F84inc. On page 2, the PCLATH counter for some reason sends us past the list of melodies (maybe it was intended?) Just in case, at the end of the program, after IDLOCS, I put DT instead of DW. Let's return to TEMP1. In general, I haven’t fully figured out the program yet. And I don’t want to stupidly download the hix file indiscriminately. In general, the program is witty, it has all the interrupts. Although for some reason TOIE is not connected in the INTCON register. [up] All languages of this page Home page | Library | Articles | Website map | Site Reviews www.diagram.com.ua |