introduction
The dual-tone multi-frequency (DTMF) signal was invented by Bell Labs. It was originally used as a user signaling between telephones and switches in telephone systems, usually for sending called numbers. DTMF signals consist of a high-frequency group and a low-frequency group, each of which contains four frequencies. A high-frequency signal and a low-frequency signal are superimposed to form a combined signal, representing a number. DTMF signaling has 16 codes. The dual-tone multi-frequency dialing keyboard is a 4×4 matrix. Each time a key is pressed, a combination of high-frequency and low-frequency sinusoidal signals is sent. Because there is no harmonic interference between any two frequencies, it has a strong anti-interference ability and a low misjudgment rate after long-distance transmission.
The DTMF and decoding chip in the switch uses CM8870 to realize the decoding function of the dual-tone multi-frequency signal on the communication line. The chip converts the detected dual-tone multi-frequency signal into a binary four-bit code and sends it to the single-chip microcomputer to provide the single-chip microcomputer with the destination information of the data stream. The dual-tone multi-frequency signal is a combination signal composed of a high-frequency signal and a low-frequency signal. Dual-tone multi-frequency signal decoding is a very important component in the switch. Whether the dual-tone multi-frequency signal sent by the line can be accurately decoded is the key to establishing a communication link. Its working condition directly determines the reliability of remote data communication. The dual-audio decoding chip CM8870 used in this system integrates a band separation filter and a digital decoder, which can convert the received DTMF signal into 8421 code.
1CM8870 decoding function implementation
1.1 Introduction to CM8870 chip
CAMD's CM8870 dual-tone multi-frequency signal decoder is a single-chip 18-pin DIP package chip. The chip contains a filter and data decoding function, which can filter out non-audio signals outside 340-3400Hz, and convert the audio signal into a binary 4-bit digital signal. The internal CMOS process greatly reduces the chip power consumption, which is only 35mW. The CM8870 has a built-in differential input amplifier, a clock generator and a three-state latch interface bus, which reduces the chip's peripheral components and only needs to connect an ordinary crystal oscillator to work normally. Its features are as follows: It provides DTMF signal separation, filtering and decoding functions; power consumption is less than 35mW; it can work within the industrial temperature range; it can be connected to an external crystal oscillator, and contains an oscillator to generate a reference frequency signal; it uses 18-pin DIP, EIAJ, OIC, PLCC packaging.
The basic characteristics of the CM8870 circuit are to provide DTMF signal separation, filtering and decoding functions, and output 4-bit parallel binary codes of the corresponding 16 DTMF frequency combinations. The binary codes D1 to D4 output by the circuit are controlled by the data output enable segment TOE. When TOE is high, D1 to D4 output the binary code corresponding to the current input DTMF signal; when TOE is low, D1 to D4 terminals are in a high impedance state. The op amp and R1, R2, and C1 form an inverting amplifier to isolate and amplify the input DTMF signal, and its gain. K=-R2/R1, changing the value of R2 can change the size of the gain, VREF is the reference voltage output terminal, take VDD/2=2.5V; INH and PD are internal circuit connection points, which should be grounded; OSCl and OSC2 are oscillator input and output terminals, and the external 3.58MHz crystal oscillator and the internal oscillator generate reference frequency signals; STD is the delay control output terminal, which outputs "1" when a set of valid dual-audio signals is received, otherwise it outputs "0"; ESt is the initial control output terminal, if the circuit detects a recognizable single-tone pair, this terminal becomes high level, if there is no input signal or continuous distortion, ESt returns to low level; SI/GT is the control input terminal/time monitoring output terminal. The functional block diagram is shown in Figure 1.
Dual-tone multi-frequency signals use two different frequency signals to represent a character or number. One of the two frequencies is selected from the low frequency band and the other is selected from the high frequency band. Each frequency band contains four different frequencies, so a total of 16 options can be combined, and only 12 are commonly used, which are 0~9, # and *. CM8870 can decode DTMF signals into 4-bit binary codes.
1.2CM8870 number collection process
CM8870 forms a number receiving circuit, whose input is the dual-tone multi-frequency signal from the analog user interface, and the output is 4-bit binary data for the processor to read from the data bus port. The number receiving process is as follows: after the analog signal is introduced from the IN pin, the out-of-band interference signal is initially filtered out by the dual-tone filter. Subsequently, the high-frequency and low-frequency components of the filtered signal are filtered out by the high-group filter and the low-group filter respectively. These two components are sent to the digital detection calculation circuit after zero-crossing detection; this circuit further optimizes the audio signal, and can exclude the external noise from being encoded by the encoder due to accidental inclusion of certain specific frequencies, or affecting the encoding of the encoder, thereby causing subsequent number receiving errors. When the high-frequency and low-frequency group signals are detected by the encoder at the same time, the ESt pin will output a high level as a sign of effective detection of the DTMF signal, and when the DTMF signal disappears, the ESt pin will output a low level. In order to prevent the external noise from being mis-encoded by the CM8870, the encoder requires that the encoded audio signal can be maintained for a period of time, which is determined by an external RC circuit. As mentioned above, when the audio signal is detected, ESt outputs a high level 1, the capacitor discharges, and the voltage value on VC rises (assuming that the signal exists within the entire required time). When VC rises to a threshold value Vrst, the audio signal is encoded and becomes a digital signal, which will be latched. At this time, GT is high, causing the voltage at the VC point to rise from the threshold value to VDD. After that, as long as ESt remains high, GT is high, and the external RC circuit returns to the initial state. Subsequently, after a delay caused by a latching operation, the STD pin outputs a high level, indicating that the signal is latched. At this time, if you want to read the 4-bit code from Q1 to Q4, you should make TOE high, open the latch, and complete the DTMF number collection task.
2 Single chip microcomputer control CM8870 design
2.1 SM895l control block diagram
The peripheral circuit connection of SM8951 is shown in Figure 2. The single-chip microcomputer is connected to the analog off-hook and on-hook circuit through the P1.4 pin. When there is a device calling for communication, the single-chip microcomputer detects the off-hook action on the line through this pin, and then the single-chip microcomputer controls the ring current generator to send a dial tone to the caller. After receiving the number, the number is decoded by the DTMF decoder and sent to the single-chip microcomputer through the P2.7 pin. The single-chip microcomputer analyzes the number to determine the object called by the caller, and then the single-chip microcomputer picks up the phone to determine whether the terminal switch is idle. If it is idle, it sends the calling number. After receiving the response, it sends a ringing tone to the called party and a ringback tone to the calling party. Once the called party picks up the phone, the single-chip microcomputer immediately exits the operation and completes the call transfer.
The interface circuit between CM8870 and SM8951 microcontroller is shown in Figure 3. PO.O~PO.3 of SM8951 microcontroller reads the decoded data of CM8870. When CM8870 receives a valid DTMF signal, ESt terminal first becomes high level, and the control input terminal SI level is increased through the integration circuit. If the SI terminal level is higher than the threshold level, the 4-bit binary code inside CM8870 is updated, and the STD terminal becomes high level. After the SM8951 microcontroller detects this information through P2.7 port, it starts to receive. If there is no DTMF signal input to CM8870 or the DTMF signal is continuously distorted, the ESt terminal is low level, the SI terminal is low level, and the STD terminal outputs low level.
The dual audio decoding circuit is shown in Figure 4. The dual audio signal input point is connected to the collector V1 of a transistor. When V1 is turned on, the dual audio signal sent from the telephone line enters the CM8870. If the CM8870 receives a valid DTMF signal, it decodes the corresponding 8421 code and outputs it from the data output terminals Q1 to Q4. The data enters the MCU PO.0 to P0.3 ports to complete data collection, judgment and processing. In addition, the status signal from the 15th pin of the CM8870 enters the P2.7 port of the MCU to notify the MCU to read the data.
2.2 Single chip microcomputer control process
When the single-chip microcomputer controls the communication of the switch, it is necessary to constantly monitor whether there is any off-hook or on-hook action in the communication link. The off-hook and on-hook circuit is actually an electronic switch that controls the connection between the circuit board and the telephone line. Usually, this switch should be in the off state to avoid busy telephone lines; when remote control is required, if the ringing rings 5 times and no one answers, then the circuit board and the telephone line need to be connected, that is, the off-hook action is completed. V1 is an electronic switch, and the conduction of the switch is controlled by the P1.4 port of the single-chip microcomputer. If the off-hook and on-hook circuit is designed with a relay, the circuit is simpler, but it is found in practice that the power consumption is large, and the 5V relay pull-in current is as high as 30μA. In addition, the relay is also prone to spark interference. The use of transistor off-hook and on-hook circuits overcomes these problems.
The software design flow chart is shown in Figure 5.
When the single-chip microcomputer controls CM8870 as the calling party, the single-chip microcomputer must first initialize CM8870, then control the off-hook circuit to pick up the phone, and after receiving the dial tone of the called party, the single-chip microcomputer controls the ring current generator to generate a ring, as the calling party calls. After waiting for a period of time, see if the other party picks up the phone. If the other party picks up the phone, the communication begins, otherwise hang up and the communication ends.
When the relay is the called party, after starting the single-chip microcomputer, the program must first initialize the CM8870, and then detect whether there is a ringing tone at any time. If there is, the single-chip microcomputer controls the off-hook circuit to actively pick up the phone, wait for a period of time, and after ensuring that the phone has been picked up, the single-chip microcomputer controls the ring current generator to generate a ring, and the call is made as the calling party. After waiting for a period of time, the call transfer function is completed, the phone is hung up, and the communication ends.
3 Conclusion
This system realizes the function of a small industrial control switch based on the SM8951 single-chip microcomputer and the CM8870 dual-tone multi-frequency decoding chip. The small switch can be used for remote data transmission of industrial control networks using power lines or twisted pairs as transmission carriers. According to the PSTN public telephone exchange network protocol and signaling standards, the circuit switching principle is used to realize the switching function. The small switch can be placed in the repeater of network communication or in the data processor at the end. Usually, the switch is only responsible for forwarding data and establishing a transmission link for data communication. The transmission of data in the switch is bidirectional. The switch is not the final destination of the data, but just a "post station". Although with the development of digital communication technology, the switching technology is becoming more and more complex and the switching function is becoming more and more perfect, for industrial control networks, the circuit switching technology based on wired networks is still widely used for its low cost, easy implementation, high security and reliability.
Previous article:Design of low-cost and high-precision A/D and D/A conversion based on single-chip microcomputer
Next article:Interpretation of CRC verification principle
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- What are the wireless communication protocols?
- File transfer based on UART (zmodem protocol)
- Please help me look at this input 5V circuit design
- Live broadcast at 10 am today [Anshi's new generation of efficient gallium nitride (GaN) power supply design solution]
- Qorvo's 5th Anniversary: Share Your Story
- MSP430f5529——Dot Matrix LCD Test Applet
- MSP430 single chip microcomputer makes intelligent digital multimeter circuit diagram + program
- Design and implementation of a miniature real-time multi-eye stereo vision machine
- program
- [Today at 10:00 am] Keysight metrology experts talk about: Electronic instrument metrology calibration knowledge and calibration cycle