Measurement-computing TempBook rev.3.0 Manual do Utilizador Página 46

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 166
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 45
6-14 Standard API Programming of the TempBook with C TempBook Users Manual
High-Level Thermocouple Measurement
***********************************************
File:
Description:
This example demonstrates the use of the TempBook's high level
thermocouple temperature data acquisition routines. These
functions have combined scan sequencer setup, ADC data
collection, and thermocouple linearization.
Functions Used:
tbkRdTemp(unsigned chan, unsigned tcType, int * temp)
tbkRdTempN( unsigned chan, unsigned tcType, unsigned count, int *
temp,
unsigned * buf, float freq, unsigned avg ) tbkRdTempScan(unsigned startChan,
unsigned endChan,unsigned tcType, int * temp) tbkRdTempScanN(unsigned
startChan,
unsigned endChan, unsigned tcType, unsigned count, int * temp, unsigned *
buf,
float freq, unsigned avg)
****************************************************/
int i, temp, temps[10];
unsigned buf[1200];
sprintf(response,"\r\nTempex1.c\r\n");
/* Set the default mode of operation to differential bipolar */
tbkSetMode(1, 1);
/* Get 1 ADC sample from a type J thermocouple on channel 0 and
convert the reading to a temperature. Print the result. */
tbkRdTemp(0, TbkTypeJ, &temp);
sprintf(tempstr,"\r\nResults of tbkRdTemp\r\n");
strcat(response,tempstr);
sprintf(tempstr,"Temperature: %4.1f \r\n", (float)temp/10.0);
strcat(response,tempstr);
/* Get 10 ADC samples from a type J thermocouple on channel 0 and
convert the readings to a single temperature using block averaging.
Print the results. */
tbkRdTempN(0, TbkTypeJ, 10, &temp, buf, 1000, 0);
sprintf(tempstr,"\r\nResults of tbkRdTempN\r\n");
strcat(response,tempstr);
sprintf(tempstr,"Temperature: %4.1f \r\n", (float)temp/10.0);
strcat(response,tempstr);
/* Get 1 ADC sample each from type J thermocouples on channels 0
through
7 and convert the readings to temperatures. Print the results */
tbkRdTempScan(0, 7, TbkTypeJ, temps);
sprintf(tempstr,"\r\nResults of tbkRdTempScan\r\n");
strcat(response,tempstr);
for (i=0 ; i<8 ; i++) {
sprintf(tempstr,"Channel %d Temperature: %4.1f \r\n", i,
(float)temps[i]/10.0);
strcat(response,tempstr);
}
Vista de página 45
1 2 ... 41 42 43 44 45 46 47 48 49 50 51 ... 165 166

Comentários a estes Manuais

Sem comentários