Keil Logo

方形波シグナル

次のシグナル関数テンプレートを使用して、方形波シグナルを生成できます。入力シグナルは、VTREG ADC0 に提供されています。変数ボルト、周波数、オフセット、および期間を使用して、方形波シグナルを調整できます。

必要に応じて、新しい *2.ini ファイルを作成できます。このファイルは、以下のように別の *1.ini ファイルに含めることができます。

INCLUDE *2.ini
/*---------------------------------------------------*/
/* Generates an Square Wave Signal on AD Channel 0   */
/*---------------------------------------------------*/
//
signal void AIN0_Square (void)  {
  float volts;        // peak-to-peak volatage
  float frequency;    // output frequency in Hz
  float offset;       // volatge offset
  float duration;     // duration in Seconds

  volts     = 0.5;
  offset    = 1.6;
  frequency = 2400;
  duration  = 0.5;

  printf ("Square Wave Signal on AD Channel 0.\n");

  while (duration > 0.0)  {
    AIN0 = volts + offset;
    swatch (0.5 / frequency);
    AIN0 = offset;
    swatch (0.5 / frequency);
    duration -= 1.0 / frequency;
  }
}


define button "AIN0 Sqr","AIN0_Square()"

上の設定では、次の出力が生成されます。

[ロジックアナライザ](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.