State Diagram for dial( )
The state machine starts generating tone once the dial mode enables it (en_DTMF =1). Timer 1 compare match interrupt is, then enabled. Variable dial_key denotes which dial tone to be generated corresponding to each digit of the phone number (variable phonekey). Function DTMF() generates the sine waves as described before. During each pause, timer 1 compare match interrupts is disabled. The state machine runs at a time base of 1 sec. Length of dial tone and pauses are counted by variable tcnt. Once the end of the phone number is reached (null character in the phone array), timer 1 compare match is again disabled.