⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simulator.ini

📁 keil c51 UV3 最新版编译器的例子程序4。
💻 INI
字号:
//
// Generate Sine Wave Signal on AD Channel 6
//
signal void ADC6_Sine (void)  {
  float volts;        // peak-to-peak voltage
  float frequency;    // output frequency in Hz
  float offset;       // voltage offset
  float duration;     // duration in Seconds
  float val;
  long  i, end;  

  volts     = 1.4;
  offset    = 1.6;
  frequency = 180;
  duration  = 1.0;

  printf ("Sine Wave Signal on AD Channel 6.\n");

  end = (duration * 100000);
  for (i = 0 ; i < end; i++)  {
    val = __sin (frequency * (((float) STATES) / CLOCK) * 2 * 3.1415926);
    AIN6 = (val * volts) + offset;
    swatch (0.00001);                // in 10 uSec steps
  }
}

define button "Sine Wave", "ADC6_Sine ()"

//
// Generate Saw Tooth Signal on AD Channel 6
//
signal void ADC6_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 ("Saw Tooth Signal on AD Channel 6.\n");

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

define button "Saw Tooth", "ADC6_Saw ()"

//
// Generates an Square Wave Signal on AD Channel 6 
//
signal void ADC6_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)  {
    AIN6 = volts + offset;
    swatch (0.5 / frequency);
    AIN6 = offset;
    swatch (0.5 / frequency);
    duration -= 1.0 / frequency;
  }
}

define button "Square Wave", "ADC6_Square ()"

//
// Combine the Signals
//
signal void Startup (void)  {
  swatch (0.2);    // wait 0.2 seconds
  ADC6_Saw ();
  swatch (0.3);    // wait 0.3 seconds
  ADC6_Square ();
  swatch (0.6);    // wait 0.6 seconds
  ADC6_Sine ();
}

Startup ()

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -