#include "ppilib.c" #define NP 500 double lastval[NP]; void main() { double t, v, timer=0.0; int k; char ss[20], old[20]; initTimer(); initialize(); setWorld(0, -5000, NP, 5000); drawGrid("Time","Voltage (mV)"); setwritemode(1); for(;;) { v = minus5000To5000(); if( (v < 0) || ( v > 1000) ) continue; /* trigger value */ markStart(); for(k=0 ; k < NP; ++k) /* do one round */ { drawPoint(k, lastval[k], BLACK); lastval[k] = v = minus5000To5000(); drawPoint(k, v, WHITE); /* wait(timer); */ } t = elapsedTime(); sprintf(ss,"%4.2f mS/div",t*100); setcolor(BLACK); drawText(0.10*NP, -5800.0, old); strcpy(old,ss); setcolor(RED); drawText(0.10 * NP, -5800.0, ss); if(kbhit()) { int c = getch(); if(!c) c = getch(); /* get extended key pressed */ if(c == 27) break; if(c == LEFT) if(timer < 10000) ++timer; if(c == RIGHT) if(timer > 1) --timer; } } closegraph(); /* Return the system to text mode */ }