home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 September / pcwk_09_96.iso / demo / wgelectr / pk51demo / files.2 / EXAMPLES / MEASURE / DSCOPE.INI next >
Text File  |  1995-09-27  |  2KB  |  75 lines

  1. load 80517.dll
  2. load measure
  3. PA main
  4. PA timer0
  5. PA clear_records
  6. PA measure_display
  7. PA save_current_measurements
  8. PA read_index
  9. PA set_time
  10. PA set_interval
  11.  
  12. WS current,10
  13.  
  14. RESET PA       /* Initialize Performance analyzer */
  15.  
  16. /*--------------------------------------------*/
  17. /* MyStatus shows analog and other values ... */
  18. /*--------------------------------------------*/
  19.  
  20. FUNC void MyStatus (void)  {
  21.   printf ("=============================\n");
  22.   printf (" Analog-Input-0:  %f\n", ain0);
  23.   printf (" Analog-Input-1:  %f\n", ain1);
  24.   printf (" Analog-Input-2:  %f\n", ain2);
  25.   printf (" Analog-Input-3:  %f\n", ain3);
  26.   printf (" Register-Bank:   %d\n", (psw & 0x18) >> 3);
  27.   printf (" Program Counter: %06lXH\n", $);
  28.   printf ("=============================\n");
  29. }
  30.  
  31.  
  32. /*-------------------------------------------*/
  33. /* Function MyRegs() shows Registers R0...R7 */
  34. /*-------------------------------------------*/
  35.  
  36. FUNC void MyRegs (void)  {
  37.   printf ("-------- MyRegs() --------\n");
  38.   printf (" R0 R1 R2 R3 R4 R5 R6 R7\n");
  39.   printf (" %02X %02X %02X %02X %02X %02X %02X %02X\n",
  40.             R0,  R1,  R2,  R3,  R4,  R5,  R6,  R7);
  41.   printf ("--------------------------\n");
  42. }
  43.  
  44.  
  45. /*-----------------------------------------------*/
  46. /* Analog0() simulates analog input values given */
  47. /*  to channel-0 (AIN0) of the 80C517            */
  48. /*-----------------------------------------------*/
  49.  
  50. SIGNAL void analog0 (float limit)  {
  51.   float volts;
  52.  
  53.   printf ("ANALOG0 (%f) ENTERED\n", limit);
  54.   while (1)  {          /* forever */
  55.     volts = 0;
  56.     while (volts <= limit)  {
  57.       ain0 = volts;     /* analog input-0 */
  58.       twatch (30000);    /* 30000 Cycles Time-Break */
  59.       volts += 0.5;     /* increase voltage */
  60.     }
  61.     volts = limit - 0.5;
  62.     while (volts >= 0.5)  {
  63.       ain0 = volts;
  64.       twatch (30000);   /* 30000 Cycles Time-Break */
  65.       volts -= 0.5;     /* decrease voltage */
  66.     }
  67.   }
  68. }
  69.  
  70. define button "Go til main", "g, main"
  71. define button "Analog0..5Volts", "analog0 (5.0)"
  72. define button "Kill Analog0", "signal kill analog0"
  73. define button "My Registers", "MyRegs ()"
  74.  
  75.