hardware interrupt handling in Windows


Thread Starter

Neelima Iyer

My group is engaged in the development of embedded controller instrumentation and PC based instrumentation. We have developed DOS based programs for interrupt driven serial interface using IRQ3 in "C" language. We are facing some problem in upgrading the same to a Windows environment. The software is Real Time Operating System (RTOS). We know BC++ and VC++. Specifically we require information about parallel Windows functions for DOS utilities like SETVECT and GETVECT. Thanks.
This will be rather problematic, especially given that you haven't mentioned which windows versions... The best way to do it is to use the VXD and or/ Com Objects...
VXD's are virtualized under windows, so getting to them using dos functions is either not appropriate or impossible.
Get MSDN or search the web for driver toolkits.
Lots of them can generate reasonable clean code...

Walt Njuh

Chimalkar, Sumeet

Please beware that windows isn't really the best platform for developing a RTOS. To be more precise, The PC platform was never developed for Real Time applications but was for the Hobbyist.
In this case, IRQ3 is normally at a lower priority to just about everything else. Windows normally isolates all sw from the actual hardware ports. When you think you are writing data to or reading to any i/o port, you are actually talking to windows. This said, I am not sure right now if you will be able to directly hook a VC++ laguage routine reliably to an IRQ. You probably need to refer to an API reference book for your version of Windows.


Sumeet Chimalkar
Design Engineer- Instruments
Jacobs H&G - Mumbai
(9122) 8208075

rajesh mathew

for writing application for this hardware ..u need to write a driver for that device in windows or any other os ..in win98 or 95 u need to write a virtual device driver or vxd ..but windows is not appropriate for real time application.. anyway u can experiment with this ..for writing device driver u need device driver kits for the appropriate widows versions ..it will get on microsoft site..
for writing driver, u need to control serial chip ..for that u should write ur own inport and outport function in assembly and also u should handle irq of that hardware.. and u should write ur isr for that irq ..i think u can doo that with less effort becas u did that already in dos ..after that u should write an application for that device (previous one is driver) that application will communicate to the driver ..u can doo that by application to vxd or vxd to application deviceiocontrol mechanism .. and one thing u should disable serial.vxd from the system ..becas it will capture the serial interrupt so ..u can't test ur driver from windows


Getvect in DOS is used to get the original address of an interrupt stored in IVT Interrupt Vector Table, which is needed for chaining your interrupt to the original interrupt in order not to crash the system. Setvect is used to set interrupt address of your handler in IVT so tha you can work with your interrupt. You have to use Setvect again to set to the original system interrupt once you finish your work. If you don't set and reset the interrupt handler addresses properly, system may hang. Since DOS is not reentrant, you should not use dos interrupts in your interrupt handler because it crashes the system because memory will be eaten up every time the interrupt is called. You have to consider all these in writing your own interrupt handler.




HHOOK SetWindowsHookEx(
int idHook, // hook type
HOOKPROC lpfn, // hook procedure
HINSTANCE hMod, // handle to application instance
DWORD dwThreadId // thread identifier
BOOL UnhookWindowsHookEx(
HHOOK hhk // handle to hook procedure