beautypg.com

Measurement Computing TempBook rev.3.0 User Manual

Page 48

background image

6-16 Standard API Programming of the TempBook with C

TempBook User’s Manual

/* Set the pacer clock for a 1 msec period */
tbkSetFreq(1000);

/* Configure for pacer clock trigger, continuous mode. */
tbkSetTrig(TtsPacerClock, 0, 0, 0);

/* Tell tbkTC.. functions to use zero correction */
tbkTCAutoZero(1);

/* Read 100 scans of ADC data */
tbkRdNFore(data, 100);

/* Reset the trigger to prevent a buffer overrun */
tbkSetTrig(TtsSoftware, 1, 0, 0);

/* Configure and Perform Thermocouple Linearization with block
averaging */
tbkTCSetup(11, 2, 8, TbkTypeJ, 1, 0);
tbkTCConvert(data, 100, temp, 8);

/* The converted temperatures can now be printed to the screen */
sprintf(tempstr,"\r\nThermocouple temperatures: Channels 0 through
7\r\n\r\n"); strcat(response,tempstr);

for (i=0 ; i<8 ; i++) {
sprintf(tempstr,"%8.1f ", (float)temp[i] / 10.0);
strcat(response,tempstr);
}
sprintf(tempstr,"\r\n");
strcat(response,tempstr);

SendDlgItemMessage(myDlg, 101, WM_SETTEXT, 0, (LONG)(LPSTR)response);
EmptyMessageQueue(myDlg);
}