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

📄 debug.ini

📁 ST10F269 ADC Example
💻 INI
字号:
/*-------------------------------------------------------------
This file set the analog inputs for the A/D to different
values depending on the button clicked
-------------------------------------------------------------*/

define float my_VREF;
my_VREF = 2.5


/*-------------------------------------------------------------
Create buttons -to set the analog inputs to 0.
               -to set the analog inputs to 2.5.
               -to set different analog inputs.
-------------------------------------------------------------*/

define button "Inputs = 0V" ,         "Set_Inputs(0.0)"
define button "Inputs = 2.5V" ,       "Set_inputs(my_VREF)"
define button "Different Inputs" ,    "Different_Inputs()"
define button "Sine Wave (AIN0)" ,    "AIN0_Sine(my_VREF)"
define button "Stop Sine Wave" ,      "signal kill AIN0_Sine;"
define button "Set AIN0 Voltage" ,     "AIN0 = GetDbl(\"Enter AIN0 Voltage\");"



/*-------------------------------------------------------------
The following functions will set the imputs of the analog
converter to 0, 2.5, or differnt values
-------------------------------------------------------------*/
func void Set_Inputs (float volt) {
  AIN0 = AIN1 = AIN2 = AIN3 = AIN4 = AIN5 = AIN6 = AIN7 =
  AIN8 = AIN9 = AIN10 = AIN11 = AIN12 = AIN13 = AIN14 = AIN15 = volt;
}


func void Different_Inputs () {
  AIN0 = 0.2;
  AIN1 = 0.4;
  AIN2 = 0.6;
  AIN3 = 0.8;
  AIN4 = 1;
  AIN5 = 1.3;
  AIN6 = 1.6;
  AIN7 = 1.9;
  AIN8 = 2;
  AIN9 = 2.4;
  AIN10 = 2.8;
  AIN11 = 3.2;
  AIN12 = 3.6;
  AIN13 = 4;
  AIN14 = 4.4;
  AIN15 = 4.8;
}

/*----------------------------------------------------------------------
The following function generates analog voltages in a sine wave pattern.
Use the built-in Logic analyzer to view the output as a sine wave.
----------------------------------------------------------------------*/
signal void AIN0_Sine ( float sn_limit )  {

  float frequency;    // output frequency in Hz
  float offset;       // voltage offset
  float val;

  offset    = sn_limit / 2;
  frequency = 1800;

  printf ("Sine Wave Signal on AIN Channel 0.\n");

  while (1) {
    val = __sin (frequency * (((float) STATES) / CLOCK) * 2 * 3.1415926);
    AIN0 = (val * (sn_limit / 2)) + offset;
    swatch (0.00001);                // in 10 uSec steps
  }
}



/*-------------------------------------------------------------
-------------------------------------------------------------*/

⌨️ 快捷键说明

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