National Instruments PC-DIO-96 User Manual page 61

Digital i/o board for the ibm pc/xt/at
Table of Contents

Advertisement

Chapter 4
if (use_ctr1) {
outp(ctr1, ((unsigned char) (ctr1_data & 0x00ff)));
outp(ctr1, ((unsigned char) ((ctr1_data & 0xff00) >> 8)));
}
outp(ctr0, ((unsigned char) (ctr0_data & 0x00ff)));
outp(ctr0, ((unsigned char) ((ctr0_data & 0xff00) >> 8)));
/* As soon as the last byte is written to counter 0, the counter begins
counting, and the PC-DIO-96 starts to interrupt the host computer.
point, you can run other code.... */
/*
call_foreground_code(...);
/* When you are ready to exit your program, you should deactivate the counters
and interrupts as shown below. */
if (use_ctr1) outp(cnfg,0x70);
outp(cnfg,0x30);
outp(ireg2,0x00);
/* After you have deactivated interrupts, you must remove your interrupt
service routine before exiting your program--do this now. */
/*
remove_isr();
}
Sample code for the functions
sure to pass a 32-bit structure pointer to the
program's data will probably be stored in a different memory segment than the one where the
interrupt functions are located. In addition, if you call the installation function from a language
besides C, make sure the parameters are passed in the proper order. C pushes parameters on the
stack from right to left, but most other languages, most notably Pascal, push parameters from left
to right. Finally, be sure to make the calls to the functions using 32-bit addresses, because all of
the code assumes data is offset with respect to a 32-bit return address. The code can be modified
to use 16-bit addresses by changing
register,
, by two in
bp
.
isr_handler()
; assemble this file with the following command:
;
masm /MX filename;
;
/MX preserves case sensitivity
;
;
; function prototypes:
;
;
void
install_isr(int level, isr_block_type far * isr_block);
;
;
on input, level indicates the interrupt level that is to be modified
© National Instruments Corporation
/* Send the least significant byte of the
counter data for counter 1 */
/* Send the most significant byte of the
counter data for counter 1 */
/* Send the least significant byte of the
counter data for counter 0 */
/* Send the most significant byte of the
counter data for counter 0 */
/* Turn off counter 1 */
/* Turn off counter 0 */
/* Disable PC-DIO-96 interrupts */
*/
install_isr()
install_isr()
to
far
near
and
install_isr()
remove_isr()
*/
and
remove_isr()
function, because the main
and decrementing all references to the base page
only. Do not modify
4-23
Register-Level Programming
At this
is presented as follows. Be
PC-DIO-96 User Manual

Advertisement

Table of Contents
loading

Table of Contents