Measurement-computing Personal488 rev.3.0 Instrukcja Użytkownika Strona 103

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
Przeglądanie stron 102
Personal488 for Windows 95/98/Me/NT/2000
04-10-01
API Reference 6-35
OnEventVDM
Windows9x and Windows2000 Only !
Syntax
INT WINAPI OnEventVDM(DevHandleT devHandle, EventFuncT func);
devHandle
refers to either an interface or an external device.
func
is a user-specified interrupt-handler function that is to perform some user-defined
function, when one of the
Arm
ed conditions occur.
Returns
-1
if error
Bus States
None
Example
Arm(ieee0, acSRQ);
OnEventVDM(ieee0, srqHandler);
Arms
SRQ
detection and sets up
SRQ
function handler
See Also
OnEvent, Arm, Disarm
This function is new in Driver488/W95. The
OnEventVDM
allows a call back to a user-specified function
in an application. The following is a full example of a console mode program using the
OnEventVDM
function:
#include <windows.h>
#include <stdio.h>
#include iotieee.h
// For debugging
#define qsk(v,x) (v=x, printf(#x returned %d\n, v))
void srqHandler(DevHandleT devHandle, UINT mask)
{
LONG xfered;
printf(\007\n\nEVENT-FUNCTION on %d mask 0x%04x\n, devHandle, mask);
qsk(xfered, Spoll(devHandle));
printf(\n\n);
}
void main(void)
{
LONG result, xfered;
int ioStatus, x;
DevHandleT ieee0, wave14, wave16;
TermT myTerm;
UCHAR buffer[500];
printf(\n\nSRQTEST program PID %d\n,GetCurrentProcessId ());
qsk(ieee0, OpenName(ieee0));
qsk(wave14, OpenName(Wave14));
qsk(wave16, OpenName(Wave16));
qsk(result, Abort(wave14));
qsk(result, Abort(wave16));
qsk(x, Hello(ieee0, buffer));
printf(\n%s\n\n, buffer);
myTerm.EOI = 1;
myTerm.nChar = 0;
myTerm.termChar[0] = \r’;
myTerm.termChar[1] = \n’;
// Arm SRQ detection and set up SRQ function handler
qsk(x, Arm(ieee0, acSRQ));
qsk(x, OnEventVDM(ieee0, srqHandler));
// Tell the Wave to assert SRQ in 3 seconds
qsk(xfered,Output(wave16,t3000x,6L,1,0,&myTerm,0,&ioStatus));
printf(Completion code: 0x%04x\n, ioStatus);
// Normally, your program would be off doing other work, for
// this example we will just hold here for a short time.
For(result = 0; result 30000; result++) {
printf(Result is %06d\r, result);
Przeglądanie stron 102
1 2 ... 98 99 100 101 102 103 104 105 106 107 108 ... 149 150

Komentarze do niniejszej Instrukcji

Brak uwag