Click here to Skip to main content
15,891,567 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to map the IRQ 7 of parallel port to its interrupt routine.I am doing this in C#.Can any body suggest how do i define the ISR in this language?

eg. in C we use

#pragma interrupt before the ISR.

what do we do in C#?
Posted
Comments
[no name] 13-Jan-15 1:55am    
In answer to your comment "polling also is not possible in our case". How can that be true? You need a background thread to poll the port. Your whole system lacks design if you planned on using ISRs in C#.
Sergey Alexandrovich Kryukov 13-Jan-15 2:21am    
You are right, but...

We all should understand that polling is bad, and general situation with computing is really bad these days. Commodity devices are all perfectly fine, but also there is such thing as non-standard hardware and industrial-grade hardware. Here is what happened: stupid (non-educated) software developers majorly filling the segment of industry, nearly totally lost the skills of developing interrupt-based driver operation since protected mode use was implemented. I face it all the time. Narrow-specialized people are not ready for that.

—SA
[no name] 13-Jan-15 2:35am    
Agreed.
Member 11362771 13-Jan-15 2:13am    
@pwasser
I am new to C#..want to use the interrupt capability of parallel port of the laptop.How can i do this in C#?

It raises an interrupt wen ACK pin(pin 10) is given a rising edge if IRQ bit of control port is set to 1.

Can u pls suggest any idea?
Sergey Alexandrovich Kryukov 13-Jan-15 2:23am    
Yes, this is the idea: just forget it, for now. Then learn WDK (Windows Driver Kit) and protected-mode programming, and then you will be able to solve such problems.
—SA

You cannot. The OS which are capable of running CLR do not allow setting ISR on the application level. Moreover, ISR is the concept of real mode. In protected mode, you would have to set up a separate descriptor segment for interrupt processing.
Please see:
http://en.wikipedia.org/wiki/Protection_ring[^],
http://en.wikipedia.org/wiki/Protected_mode[^].

[EDIT]

Please see my comments to the question. To solve such problems, you need to learn WDK and protected-mode programming. Please see:
http://en.wikipedia.org/wiki/Windows_Driver_Kit[^],
http://www.microsoft.com/whdc/devtools/wdk/default.mspx[^],
http://msdn.microsoft.com/en-us/library/windows/hardware/hh852365.aspx[^].

No, you cannot do it in C#. Not for present-day Windows system. Not only this is native programming only, this is also kernel-mode programming. These days, some Assembly Language will be required, in addition to the native code targeted high-level programming language.

—SA
 
Share this answer
 
v4
Comments
Member 11362771 13-Jan-15 2:02am    
R u sure about this?..because once i enable the interrupt on the parallel port i want to handle it in the ISR..and polling also is not possible in our case..Can u pls suggest any other work around for this?
Sergey Alexandrovich Kryukov 13-Jan-15 2:27am    
Yes, I'm sure. No, you cannot handle it. Chances are, you can use polling, even though this is quite a lame. Please see also my comments to the question.
—SA
Check this article, might handy for you!

LED Controlled by Parallel Port Using C#[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900