/*********************************************** * * ************************************************/ #define BASE_ADDR 0x02000800 #define J1_ODD 48 #define J1_EVEN 0 #define J2_ODD 72 #define J2_EVEN 24 #define T1 60. #define T2 65. #define T3 70. char *ch_name[] = { "33", "41", "51", "61", "34", "42", "52", "62", "64", "66", "93", "95", "94", "96", "31", "21", "11", "81", "32", "22", "12", "82", "84", "86", "91", "97", "92", "98"}; int stato[] = { 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1 }; main(argc, argv) int argc; char **argv; { int gains_set[96], gains_read[96], data[96]; float datv[96]; unsigned base; int ndata, gain_mode, diff_mode, i; float vmin = 0.; /* give range of the A/D : settable only hardware ! */ float vmax = 10.; float nch = 4096; int cpu_nr, tcp_ip_nr; char *hv_config[3]; int sonda; base = (unsigned) BASE_ADDR; if (get_config( &tcp_ip_nr, &cpu_nr, hv_config) != 0){ printf (" error in get_config \n"); exit (0); } if (cpu_nr < 1 || cpu_nr > 2) { printf(" No termometer probes readable from this CPU \n"); printf(" Move to OS9B1 ( 131.169.32.121 ) or OS9B2 "); printf("( 131.169.32.122)\n"); exit(0); } diff_mode = 0; /* 1: 48 diff chan's; 0: 96 single ended chan's */ gain_mode = 1; /* 1: common amplification for all chan's 0: individual amplification */ gains_set[0] = gain_word(1); /* -> amplification = 1 */ anl_adc_init(base, &gain_mode, gains_set, &diff_mode); anl_adc_read(base, data, &ndata, &gain_mode, gains_read, &diff_mode); for ( i = 0; i < ndata; i++){ printf(" i = %2d, row_data %5d ", i ,data[i]); datv[i] = ((vmax - vmin)/(float) (nch-1)) * (float) data[i] + vmin; printf(" -> %5.2f V",datv[i]); datv[i] = datv[i] / 0.01026 - 273. ; printf(" -> %5.2f K",datv[i]); if (datv[i] < 0.) datv[i] = -1.; printf(" -> %5.2f K\n",datv[i]); } printf(" TEMPERATURE PROBES \n\n"); printf(" i Chamber Probe 1 Probe 2 \n"); printf(" Name T(C) T(C) \n\n"); for( i = 0; i < 14; i++) { printf(" %2d CH%2s ", 1 + i, ch_name[ sonda = (cpu_nr - 1) * 14 + i ]); /* if (stato [sonda * 2]) */ printf("%4.0f ", datv[J2_ODD + i]); /* else printf(" -- "); if (stato [sonda * 2 + 1]) */ printf("%4.0f ", datv[J2_EVEN + i]); /* else printf(" -- "); */ printf(" "); if ( datv[J2_ODD + i ] > T1 || datv[J2_EVEN + i] > T1 ) printf("! "); if ( datv[J2_ODD + i ] > T2 || datv[J2_EVEN + i] > T2 ) printf("! "); if ( datv[J2_ODD + i ] > T3 || datv[J2_EVEN + i] > T3 ) printf("! "); printf("\n"); } }