weinbrgr@milton.u.washington.edu (Keith Weinberger) (03/29/91)
A little while ago I sent an appeal into the net for help in writing data aquisition software in Windows. After some investigation, some very good help from net people, some fumbling around, and having experience on the DOS side of things, I was able to collect and display data in a window. The following brief account gives the overview. To cut down on net traffic, if anyone wishes the nitty gritty details (and maybe some code), they can email me at: weinbrgr@u.washington.edu. There are two major issues in writing A/D or D/A software for Windows: - How do you program the DMA controller on the motherboard? - How do you set up the interrupt vector for your ISR? Programming the DMA controller in Windows: When programming the DMA controller it is necessary to have the absolute address of a buffer into which (or from which) transfers will take place. (Please note that this discussion is not about device drivers. Device drivers will also have the problem of programming the DMA chip.) The problem with Windows is that you're not supposed to know absolute addresses and Windows wants the ability to move things around. And, DMA transfers assume memory blocks to be physically contiguous. Windows provides DMA services to help. Through software interrupt 4Bh Windows will allocate a buffer into (or out of) which the DMA chip can move data. You just tell it the size of the buffer and Windows returns the physical address, which you send to the DMA chip. Windows mothers the buffer until the time it is released by another call to 4Bh. 4Bh also provides functions to move data into and out of the buffer and into your program. You provide it with the selector:offset of an array, the buffer id, and Windows does the transfer. It is an extra stage than for DOS, but you get the graphical environment for your patience. Setting up an Interrupt Vector in Windows: It's not as hard as it seems. MSC for DOS has the functions dos_getvect and dos_setvect for manipulating the interrupt vector table. They rely on DOS INT 21h. Windows, according to the development notes from Microsoft, supports some of the functions of 21h, two of which are get and set interrupt vector. So the code is just a few lines of assembly. Caution is suggested, though, because there are minor differences depending on which mode Windows is in (for the most part they can be ignored - but don't quote me). The development notes (~$25) have all the details. Thanks very much to all who replied. Keith Weinberger weinbrgr@u.washington.edu -- /---------------------------------------------------------------------------/ / / / Keith Weinberger weinbrgr@u.washington.edu / / University of Washinton /