Measurement-computing Personal488 rev.3.0 For DOS & Windows 3.Xi Uživatelský manuál Strana 95

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 400
  • Tabulka s obsahem
  • ŘEŠENÍ PROBLÉMŮ
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 94
8H. Turbo C II. SOFTWARE GUIDES - 8. Driver488/DRV
II-80 Personal488 Users Manual, Rev. 3.0
int cklpint(void)
int _false_(void)
int (*ieee_cki)(void) = _false_
void no_op(void)
void (*ieee_isr)(void) = no_op
Driver488/DRV signals interrupts, which are enabled with the
ARM
command, by causing the light
pen signal to appear true. The
CKLPINT
checks that Driver488/DRV is able to service an
interrupt (the response from
IOCTL_RD
is
0
) and then checks if an interrupt is pending by
checking the light pen status. The
IEEEWT
routine (described below) calls the function pointed to
by
IEEE_CKI
to determine if an
IEEE
interrupt needs to be serviced. The
IEEE_CKI
normally
points to the function
_false_
which always returns zero (
0
). To enable interrupt checking
IEEE_CKI
must be redirected to point to
CKLPINT
. Interrupt checking is disabled by pointing
IEEE_CKI
back to
_false_
. Once an interrupt has been detected,
IEEEWT
calls the interrupt
service routine pointed to by
IEEE_ISR
to service the interrupt. The
IEEE_ISR
initially points to
no_op
, a function that does nothing, but it may be redirected as needed to specify the appropriate
interrupt service routine for each part of a program.
_IEEEWT
and
_IEEERD
are very similar to the unbuffered _
WRITE
and _
READ
routines provided
in the C library.
int _ieeewt(int handle,char chars[])
int _ieeerd(int handle,char chars[],int size)
#define ieeewt(chars) _ieeewt(ieee,chars)
#define ieeerd(chars) _ieeerd(ieee,chars,sizeof(chars))
The
_IEEEWT
differs from _
WRITE
in that it checks for Driver488/DRV interrupts before writing,
determines the number of characters to write by using
STRLEN
, and prints an error message if an
error has occurred during writing. The
_IEEERD
differs from _
READ
only in that it prints an error
message if an error has occurred during reading.
IEEEWT
and
IEEERD
(without the leading
underscore) write and read to the file
IEEE
. Notice that
IEEERD
uses
SIZEOF
to determine the
number of characters to read. This only works if
SIZEOF
can determine the number of bytes in the
receive buffer,
chars
. This means
chars
must be an array of known size, for example,
char chars[256]
, not
char*chars
.
IEEEPRTF
and
IEEESCNF
are IEEE 488 versions of
PRINTF
and
SCANF
, respectively.
int ieeeprtf(char *format, ...)
int ieeescnf(char *format, ...)
The
IEEEPRTF
accepts a format string and a list of arguments. It formats its arguments according
to the specified format and sends the formatted string to Driver488/DRV. The
IEEESCNF
accepts
a format string and pointers (to the types specified in the format string). It reads a string of up to
256 bytes from Driver488/DRV, terminates it with a zero, converts it according to the format
string, and places the converted values into the variables pointed to by the specified pointers.
RAWMODE
sets the file specified by
handle
for raw mode I/O.
int rawmode(int handle);
In raw mode MS-DOS does not interpret the characters received from the file. In particular,
control-Z
is not taken as end-of-file. Raw mode is usually appropriate for IEEE 488
communications because it does not interfere with the transfer of binary data and because it is
much more efficient than non-raw mode I/O.
IEEEINIT
establishes communications with Driver488/DRV and configures it for use with C.
int ieeeinit(void);
It first opens the file
IEEE
for both reading and writing and puts the file descriptor into
IEEE
. It
then puts the file into raw mode. Driver488/DRV is then initialized by sending the
IOCTL
BREAK
and
RESET
commands. Normal output from C is terminated by a new-line (line feed)
character, and returned strings should be terminated by a null, so
EOL OUT LF
and
EOL IN $0
commands are then issued. Finally a
FILL ERROR
command is issued to enable
SEQUENCE - NO
DATA AVAILABLE
error detection. If an error is detected during any of these commands,
IEEEINIT
returns a
-1
, otherwise it returns a zero (
0
).
Zobrazit stránku 94
1 2 ... 90 91 92 93 94 95 96 97 98 99 100 ... 399 400

Komentáře k této Příručce

Žádné komentáře