156 C. AUGER-Meßprogrammcode err = set_counter (vdcg_pulsewidth, clock); ErrorRoutine ("Error while setting counters", err); err = set_digital (); ErrorRoutine ("Error while setting DIO", err); err = set_bg (); ini_digital (outbits); printf ("\n\n!!! Hardware and Software setup finished !!!\n\n\n"); printf ("\n\nStarting spectrum!\n\n"); delay (1000); detectgraph (&graphdriver, &graphmode); initgraph (&graphdriver, &graphmode, "c:\\sprachen\\tcpp30\\bgi"); ini_graph (min, max); getdate (&d); _dos_gettime (&t); setcolor (WHITE); settextjustify (LEFT_TEXT, CENTER_TEXT); outtextxy (50, 25, title); setcolor (LIGHTBLUE); settextjustify (LEFT_TEXT, CENTER_TEXT); outtextxy (50, 40, "Minimale Energie:"); outtextxy (50, 50, "Maximale Energie:"); outtextxy (50, 60, "Strahl-Energie:"); outtextxy (50, 70, "Einfallswinkel:"); outtextxy (50, 80, "Targetstrom:"); outtextxy (50, 90, "Druck:"); outtextxy (50, 100, "Datei Nr.:"); setcolor (LIGHTMAGENTA); settextjustify (RIGHT_TEXT, CENTER_TEXT); sprintf (string, "%3.0feV", min); outtextxy (245, 40, string); sprintf (string, "%3.0feV", max); outtextxy (245, 50, string); sprintf (string, "%.2fkV", egun); outtextxy (245, 60, string); sprintf (string, "%3.0f o ", angle); outtextxy (245, 70, string); sprintf (string, "%sA", current); outtextxy (245, 80, string); sprintf (string, "%smbar", pressure); outtextxy (245, 90, string); sprintf (string, "%02d", num); outtextxy (245, 100, string); setcolor (RED); rectangle (50, 130, 200, 185); setcolor (WHITE); settextjustify (LEFT_TEXT, CENTER_TEXT); outtextxy (60, 138, "Hotkeys:"); setcolor (YELLOW); settextjustify (LEFT_TEXT, CENTER_TEXT); outtextxy (60, 150, "q"); outtextxy (60, 160, "+"); outtextxy (60, 170, "-"); outtextxy (60, 180, "x"); setcolor (LIGHTRED); settextjustify (RIGHT_TEXT, CENTER_TEXT); outtextxy (195, 150, "letzte Wdh"); outtextxy (195, 160, "plus 1 Wdh"); outtextxy (195, 170, "minus 1 Wdh"); outtextxy (195, 180, "Abbruch"); setcolor (BROWN); rectangle (45, 34, 250, 105); setcolor (LIGHTGREEN); settextjustify (LEFT_TEXT, CENTER_TEXT); outtextxy (50, 120, comment); err = CTREnable (SLOTISA_0, ONBOARD, CHANNEL_0); /* CTRE */ ErrorRoutine ("Error enabling CTRE !!!", err); err = CTREnable (SLOTISA_1, ONBOARD, CHANNEL_0); /* VDCG */ ErrorRoutine ("Error enabling VDCG !!!", err); err = CTRRead (SLOTISA_0, ONBOARD, CHANNEL_0, RESET, &counts, &status); /* reset CTRE */ ErrorRoutine ("Error reading/resetting CTRE !!!", err);
flushall (); /* clearing all input streams */ for (rep = 1; rep 1) cmaxx = cmax; setcolor (rep % 14 + 1); /* changing g_color for each repetition */ moveto (xpix (min, min, max), ypix (0, cmaxx)); /* initial g_cursor */ for (x = min - NUM_DUMMY_RUNS * step; x > 8) & 127) | (e_times_2 cmax) && (point > NUM_DUMMY_RUNS)) cmax = (unsigned long) counts; if (status == CTR_OVERFLOW) /* checking for CTRE OVERFLOW */ printf ("!!! Warning: overflow while measuring at %.2f eV !!!\n", x); if (point > NUM_DUMMY_RUNS) lineto (xpix (x, min, max), ypix ((unsigned long) floor (ctre[point] / ((double) rep)), cmaxx)); if (kbhit ()) /* check if keyboard hit occured */ { key = getch (); /* getting hold of inserted key */ rtextx = 0.5 * getmaxx (); rtexty = 0.8 * getmaxy (); color = getcolor (); /* saving old pixel color */ settextjustify (LEFT_TEXT, CENTER_TEXT); setcolor (getbkcolor ()); outtextxy (rtextx, rtexty, "00000000000000000000000000000000000"); setcolor (LIGHTRED); switch (key) { case ’q’: reps = rep; 157