Reading driver status – Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual
Page 229
10E. C Languages
II. SOFTWARE GUIDES - 10. Driver488/W31
II-214
Personal488 User’s Manual, Rev. 3.0
To enable the
WM_IEEE488EVENT
message, Driver488/W31 must be told to which window to send the
message using the
OnEvent
command. It must also enable the message on an
SRQ
with the
Arm
command.
/* Setup event handling for trapping the SRQ */
OnEvent(ieee, hWndDlg, (OpaqueP)0L);
Arm(ieee, acSRQ);
Note that upon closing the handle, all event handling associated with this control is disabled. You must
keep the device open during the time in which its events are of interest. That is, with an ADC488, you
would open the device, assign the device handle, configure the
adc
with
Output
commands, and then
wait for the
SRQ
event to be triggered. The
SRQ
event handler would read data from the ADC488 and
then close the device, allowing other tasks access, and eliminating the event notification. The data read
from the ADC488, is displayed in the ADC488 Response window, as shown in the figure.
Finally, the ADC488 is setup to complete an acquisition and assert
SRQ
.
/* Clear the ADC488 */
Clear(adc);
/* Setup the ADC488 to SRQ on acquisition complete */
Output(adc, “M128X”);
/* Setup the ADC488:
100 uSec scan interval (I3)
No pre-trigger scans, 100 post-trigger scans (N100)
Continuous trigger on GET (T1)
*/
Output(adc, “I3N100T1X”);
/* Wait for the ready bit of the ADC488 to be asserted */
while ((SPoll(adc) & 32) == 0);
/* Trigger the ADC488 */
Trigger(adc);
Reading Driver Status
Your application may interrogate Driver488/W31 at any time to determine its status and other
information.
Status
information is returned in a structure provided by the application and can be
displayed by the
showstat
function shown below.
Status(ieee, &substat);
showstat(&substat, textstr);
Another function to display the information contained in the
Status
structure could be:
void showstat(IeeeStatusT *substat, char *textstr) {
char response[64];
sprintf(response, “SC :%d\r\n”, substat->SC);
strcat(textstr, response);
sprintf(response, “CA :%d\r\n”, substat->CA);
strcat(textstr, response);
Data read from the ADC488