Keil Logo

インパルスパターン

以下のシグナル関数は、多くの組み込みシステムで一般的なシグナルインパルスパターンを生成します。この例は、電子通信アプリケーションで一般的な DTMF レシーバの入力です。

このコードを初期化ファイル <filename>.ini に追加します。

/*------------------------------------------------------------------*/
/* 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)  {
  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.12);
}

define button "DTMF Signal", "SendSig()"

上のシグナル関数では、次の出力が生成されます。

[ロジックアナライザ](Logic Analyzer)ウィンドウのインパルスパターン表示

  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.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.