Keil Logo

のこぎり波シグナル

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

/*---------------------------------------------------*/
/* Generate Sawtooth Signal on AD Channel 0         */
/*---------------------------------------------------*/
//
signal void AIN1_Saw (void)  {
  float volts;        // peak-to-peak volatage
  float frequency;    // output frequency in Hz
  float offset;       // volatge offset
  float duration;     // duration in Seconds
  float val;
  long  i, end, steps;

  volts     = 2.0;
  offset    = 0.2;
  frequency = 1400;
  duration  = 0.2;

  printf ("Sawtooth Signal on AD Channel 1.\n");

  steps = (100000 * (1/frequency));
  end = (duration * 100000);
  for (i = 0 ; i < end; i++)  {
    val = (i % steps) / ((float) steps);
    AIN1 = (val * volts) + offset;
    swatch (0.00001);                // in 10 uSec increments
  }
}

define button "AIN1 Saw","AIN1_Saw()"

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

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