measure.ini

来自「keilc pic的版本 才搞到的 希望对大家有帮助」· INI 代码 · 共 54 行

INI
54
字号

/*--------------------------------------------*/
/* MyStatus shows analog and other values ... */
/*--------------------------------------------*/

FUNC void MyStatus (void)  {
  printf ("=============================\n");
  printf (" Analog-Input-0:  %f\n", ain0);
  printf (" Analog-Input-1:  %f\n", ain1);
  printf (" Analog-Input-2:  %f\n", ain2);
  printf (" Analog-Input-3:  %f\n", ain3);
  printf (" Registers (CP):  %04X\n", CP);
  printf (" Program Counter: %06lXH\n", $);
  printf ("=============================\n");
}

/*-------------------------------------------*/
/* Function MyRegs() shows Registers R0...R7 */
/*-------------------------------------------*/

FUNC void MyRegs (void)  {
  printf ("---------- MyRegs() ----------\n");
  printf (" R4   R8   R9   R10  R11  R12\n");
  printf (" %04X %04X %04X %04X %04X %04X\n",
            R4,  R8,  R9,  R10, R11, R12);
  printf ("------------------------------\n");
}

/*-----------------------------------------------*/
/* Analog0() simulates analog input values given */
/*  to channel-0 (AIN0) of the C166 derivative   */
/*-----------------------------------------------*/
Signal void analog0 (float limit)  {
  float volts;

  printf ("Analog0 (%f) entered.\n", limit);
  while (1)  {          /* forever */
    volts = 0;
    while (volts <= limit)  {
      ain0 = volts;     /* analog input-0 */
      twatch (200000);  /* 200000 Cycles Time-Break */
      volts += 0.1;     /* increase voltage */
    }
    volts = limit;
    while (volts >= 0.0)  {
      ain0 = volts;
      twatch (200000);  /* 200000 Cycles Time-Break */
      volts -= 0.1;     /* decrease voltage */
    }
  }
}


⌨️ 快捷键说明

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