[comp.lang.pascal] connecting Win30

mcdonald@aries.scs.uiuc.edu (Doug McDonald) (04/20/91)

I want to use Windows 3.0 (386 enhanced mode) to talk to a device
(an ADC convertor) that requires interrupts. I got this to work
just fine by writing a DOS character device driver .sys file, and
sending commands to it with ordinary DOS writes and getting data
with ordinary DOS reads. But this appears to only transfer ONE byte at 
a time. Its inefficient.


So I tried using the DOS IOCTL calls - which can transfer several bytes per
call. I used the MSC 5.1 intdos call. Works fine in real mode -
bombs in standard and 386 mode.


How does one do this? Tools I have: MSC5.1, the Windows 2.11 SDK, 
and assembler. I also run Qemm386.


Doug McDonald (mcdonald@aries.scs.uiuc.edu)

mcdonald@aries.scs.uiuc.edu (Doug McDonald) (04/25/91)

In article <1991Apr19.195538.23441@ux1.cso.uiuc.edu> mcdonald@aries.scs.uiuc.edu (Doug McDonald) writes:
>I want to use Windows 3.0 (386 enhanced mode) to talk to a device
>(an ADC convertor) that requires interrupts. I got this to work
>just fine by writing a DOS character device driver .sys file, and
>sending commands to it with ordinary DOS writes and getting data
>with ordinary DOS reads. But this appears to only transfer ONE byte at 
>a time. Its inefficient.
>
>
>So I tried using the DOS IOCTL calls - which can transfer several bytes per
>call. I used the MSC 5.1 intdos call. Works fine in real mode -
>bombs in standard and 386 mode.
>
>
>How does one do this? Tools I have: MSC5.1, the Windows 2.11 SDK, 
>and assembler. I also run Qemm386.
>
>
>Doug McDonald (mcdonald@aries.scs.uiuc.edu)


Thanks for the help, folks. Yes, it can be done. You just have to do it right:
open the file with the MSC "open" call, do the IOCTL with the MSC "intdos"
call, then close with MSC close. The handle generated by "open" works
with the direct DOS call. 

Some combination of using "int86" instead of "intdos" and trying to use
"intdos" to call in 44h to do the open caused the bomb. Sigh.

This method of writing your own character mode driver and communicating
this way appears to work fine and be efficient. (Even so-called
character mode devices can happily pass data blocks using this method.) 
A near panacea for connecting Windows 3.0 to things like data collection
devices.


Doug McDonald