circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

October 2004, Issue 171

Telephone Message Watchdog
An Intelligent Call-Forwarding System


by Jingxi Zhang, Yang Zhang, & Huifang Ni


MCU OPERATION

We mixed H8S/2600 assembly and C languages. Figure 3 is the program flow chart. When the device is powered on, the MCU starts a reset process and sets up the on-chip peripheral I/O modules, including 16-bit timer units, an ADC, a DMA controller, D/A converters, and I/O pins. The MCU then enters Sleep mode.

(Click here to enlarge)

Figure 3—The MCU is in Sleeping mode after initialization. The line loop current sensor wakes it up and it starts to detect the DTMF signal. After the loop current drops, the MCU starts dialing the pager number and delivers the message.

A loop current sensor interrupt (IRQ7) wakes up the MCU when the answering machine loop current increases in case an incoming call has arrived. The ring signal pattern is on for 2 s and pauses for 4 s. To check if the answering machine is turned on, the IRQ is disabled temporarily, and the loop-current condition is continuously monitored. Only when a loop current stays on after the ring on-off period does the MCU enter DTMF Tone Detection mode.

In DTMF Tone Detection mode, the ADC continuously samples the line signal, and the DMA control feeds the converted data into one of the DTMF detection buffers. For each 14-ms frame, all eight Goertzel filters—four for the low-frequency group and four for the high-frequency group—are executed. If any of these filters detects a significant tone, a validation test is performed. The validation test includes the process of verifying that both the high- and low-frequency tones are simultaneously present. It also verifies that only one tone is present in the low-frequency group and only one tone is present in the high-frequency group. Finally, the test verifies that the dual-tone duration lasts at least three 14-ms frames (greater than 40 ms, as required by the FCC). The pause between the DTMF tones also should be verified in order to recognize two separate DTMF numbers with the same value. If the validation test passes, the number is captured and stored in a memory location.

When the caller terminates the call, the loop current sensor generates another interrupt at IRQ7. The MCU stops DTMF Detection mode and starts Message Forwarding mode, during which the line condition is checked first. If the line is free, the MCU sets the output pin (PC0) to logic high. This action engages the telephone line. Then the DTMF tone generator sends your pager number through the DAC to the telephone interface. Then the MCU listens to the incoming audio signal for the pager’s beep. A few seconds after the beep, the captured phone number is sent to the output by the DTMF tone generator. Finally, the MCU frees the phone line and returns to Sleep mode and waits for the next calling process.