beautypg.com

Sample programs – Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual

Page 232

background image

II. SOFTWARE GUIDES - 10. Driver488/W31

10E. C Languages

Personal488 User’s Manual, Rev. 3.0

II-217

Now we process the buffer:

/* Print the received characters */
for (i=0;i<100;i++) {

sprintf(response, “%6d ”, hundred[i]);
strcat(textstr, response);
if ((i%8)==7) {

strcat(textstr,"\r\n");

}

}
strcat(textstr,"\r\n");
SetDlgItemText(hWndDlg, 201, (LPSTR)textstr);

The readings are stored in the local variable

textstr

in the above example. They could, however be

placed into a text-type control. Refer to the Driver488/W31 status display in the ADC488 Response
window, shown in the following figure:

The functions described so far in this Sub-Chapter provide enough functionality for a basic data
acquisition
program. The following program listing covers the examples used. Additional functions
provided by Driver488/W31 are described in the “Section III: Command References” of this manual.

Source Code (Example 2.c)

/* QuickCase:W KNB Version 1.00 */
#include “EXAMPLE2.h”
#include “iot_main.h”
#include “iotmc60w.h”
#include “stdio.h”

/* function prototypes */
void showstat(IeeeStatusT *substat, char *textstr);

int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance, LPSTR
lpszCmdLine, int nCmdShow)
{

/*******************************************************************/
/* HANDLE hInstance;

handle for this instance

*/

/* HANDLE hPrevInstance; handle for possible previous instances

*/

/* LPSTR lpszCmdLine;

long pointer to exec command line

*/

/* int nCmdShow;

Show code for main window display

*/

/*******************************************************************/

Driver488/W31 Status Display

Sample Programs

Data Acquisition Sample Programs

The following examples were developed using Quick C for Windows. Additional example programs
are included on the Driver488/W31 disk.