Keil Logo Arm Logo

µVision4 User's Guide

Impulse Patterns

The following signal function generates a signal impulse pattern as it is typical in many embedded systems. In this case it is the input of a DTMF receiver as they are common in telecom applications.

/*------------------------------------------------------------------
 Generate Input Signal Pattern from a DTMF Receiver
------------------------------------------------------------------*/
SIGNAL void SendDtmf (unsigned char digit)  {
  if (digit == 0)  digit = 10;
  printf ("DMFT Signal = %d\n", digit);
  PORT0 = (PORT0 & 0x07) | (digit << 4);
  swatch (0.06);
  PORT0 |= 0x8;
}

/*------------------------------------------------------------------
 Caller Function for DTMF Receiver
------------------------------------------------------------------*/
SIGNAL void SendSig (void)  {
int i;

  i=3;
  while (i--)  {
    SendDtmf (12);    // send digit 12 = '*'
    swatch (0.12);
    SendDtmf (7);     // send digit 7
    swatch (0.12);
    SendDtmf (2);     // send digit 2
    swatch (0.12);
    SendDtmf (11);    // send digit 11 = '#'
    swatch (0.36);
  }
}

DEFINE BUTTON "DTMF Signal", "SendSig()"

Start debugging in simulation mode and drag the port into the Logic Analyzer. Open the Toolbox and click the button DTMF Signal to view the signal output:

Logic Analyzer Impulse Pattern Display

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.