Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual
Page 228
![background image](https://www.manualsdir.com/files/797818/content/doc228.png)
II. SOFTWARE GUIDES - 10. Driver488/W31
10E. C Languages
Personal488 User’s Manual, Rev. 3.0
II-213
/* open Driver488/W31 */
if ((ieee=OpenName(“IEEE”))) {
MessageBox(hWndDlg, (LPSTR)"Cannot initialize IEEE system",
NULL, MB_OK);
EndDialog(hWndDlg, TRUE);
return TRUE;
}
/* open device named ADC */
Error(ieee, OFF);
switch (adc=OpenName(“ADC”)) {
case -2:
MessageBox(hWndDlg, (LPSTR)"ADC device already open", NULL,
MB_OK);
EndDialog(hWndDlg, TRUE);
return TRUE;
case -1:
/* Create the device ADC by copying the default device WAVE*/
switch (devhandle=OpenName(“WAVE”)) {
case -2:
MessageBox(hWndDlg, (LPSTR)"WAVE device already
open", NULL, MB_OK);
EndDialog(hWndDlg, TRUE);
return TRUE;
case -1:
MessageBox(hWndDlg, (LPSTR)"Cannot open WAVE
device",NULL, MB_OK);
EndDialog(hWndDlg, TRUE);
return TRUE;
default:
break;
}
if ((adc=MakeDevice(devhandle, “ADC”))) {
MessageBox(hWndDlg, (LPSTR)"Cannot create ADC device", NULL,
MB_OK);
EndDialog(hWndDlg, TRUE);
return TRUE;
}
Close(devhandle);
break;
default:
break;
}
GetError(ieee, response);
Error(ieee, ON);
BusAddress(adc, 14, -1);
When the IEEE 488 Event Message has been passed to the application, the following service routine is
executed. The particular subroutine is invoked when the ADC generates an
SRQ
on “acquisition
complete.”
default:
if (Message==WM_IEEE488EVENT) {
strcpy(textstr,"SRQ event detected\r\n");
SetDlgItemText(hWndDlg, 201, (LPSTR)textstr);
}
/* Clear the SRQ condition */
SPoll(adc);
/* Reset the buffer pointer of the ADC488 */
Output(adc, “B0X”);
/* Get 100 readings from the ADC488 */
for (i=0;id;i++) {
Enter(adc,response);
strcat(textstr, response);
strcat(textstr, “\r\n”);
}
SetDlgItemText(hWndDlg, 201, (LPSTR)textstr);
}
return FALSE;