diff --git a/daq b/daq index 4bfcfbb..2a71f08 100755 Binary files a/daq and b/daq differ diff --git a/daq.c b/daq.c index dfc49aa..a1a79d8 100644 --- a/daq.c +++ b/daq.c @@ -147,7 +147,7 @@ int DAQ(int t_hrs, int tm_s) o2_ppm[10]="", o2_xcent[10]="", co2_temp[10]="", o2_temp[10]="", co2_press[10]="", o2_press[10]="", - co2_relH[10]=""; + co2_relH[10]="", DATA[100]=""; clock_t start_t, end_t; @@ -165,6 +165,8 @@ int DAQ(int t_hrs, int tm_s) ctime(&curtime), '%'); // send the value to the file fclose(dfp); // close the file using the file pointer + + //ciclo t0 = time(NULL) + tm_s; new_time = t0; @@ -188,14 +190,6 @@ int DAQ(int t_hrs, int tm_s) uartReceive(CM31911); co2 = read_measure(GC0017, 10, 0); - //co = read_measure(CM31911, 1, 0); - //uartTransmit(CM31911, Temperature); - //o2 = read_measure(OX0052, 1, 0); - //temp = read_measure(CM31911, 1, 1000); - - //printf("unfil co: %s\n",gmeasures(receive[CM31911], 'H', 5)); - //printf("unfil co: %s\n",gmeasures(receive[CM31911], 'Z', 5)); - memcpy(co_uf, gmeasures(receive[CM31911], 'z', 5), 5); memcpy(co_f, gmeasures(receive[CM31911], 'Z', 5), 5); memcpy(o2_ppm, gmeasures(receive[OX0052], 'O', 6), 6); @@ -206,20 +200,17 @@ int DAQ(int t_hrs, int tm_s) memcpy(o2_press, gmeasures(receive[OX0052], 'P', 4), 4); memcpy(co2_relH, gmeasures(receive[CM31911], 'H', 5), 5); - - //printf("pressure: %s\n",gmeasures(receive[OX0052], 'P', 4)); - //printf("oxigen xcent: %s\n",gmeasures(receive[OX0052], '%', 6)); - //printf("Temperature: %s\n",gmeasures(receive[OX0052], 'T', 5)); - - dfp = fopen(data_file_path, "a"); // open file for writing - fprintf(dfp, "%d\t%d\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", + sprintf(DATA, "%d\t%d\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s", (int)(new_time-t0), co2, co_uf, co_f, o2_ppm, o2_xcent, co2_temp, o2_temp, co2_press, o2_press, co2_relH); - /* gmeasures(receive[CM31911], 'Z', 5), gmeasures(receive[OX0052], 'O', 6), - gmeasures(receive[OX0052], '%', 6), gmeasures(receive[CM31911], 'T', 5), - gmeasures(receive[OX0052], 'T', 5), gmeasures(receive[CM31911], 'P', 5), - gmeasures(receive[OX0052], 'P', 4), gmeasures(receive[CM31911], 'H', 5)); // send the value to the file - */ + + printf("time(s)\tCO2(ppm)\tCO unfil(ppm)\tCO fil(ppm)"\ + "\tO2(ppm)\tO2(%c)\tTemperaure C02(ºC*10)\tTemperaure 02(ºC)"\ + "\tPressure C02(.mBar)\tPresure 02(mBar)\tRelative Humidity(.)\n", '%'); + printf("%s\n", DATA); + + dfp = fopen(data_file_path, "a"); // open file for writing + fprintf(dfp, "%s\n", DATA); fclose(dfp); // close the file using the file pointer new_time += tm_s; end_t = clock();