🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Interrupt

Started by
7 comments, last by Mr.X 24 years, 5 months ago
I have to write a programm: a x-box(phone-box) send a signal to the pc and if it ok it send a signal to the x-box. the singnal comes about com/interrupt(irq) but i have no idea how i can make it (i programm in c++) is there a function or other how i can access the irq .....
Advertisement

Been a bit since I''ve messed around with lowlevel vectors, but here''s some ideas :

The first thing you''re going to have to is get the com port setup. You''ll need to hook the interrupt vector that is associated with your comport. In the interrupt service routine, you would read a byte at the comport and check for your info.

However, there are a few things that I can''t help you with.
1) The comport takes some setup before you can use it. Try searching the net for info..
2) I forget how the comport communicates the info. If its possible for your project, think about using the parallel port : it needs very little setup. I have a nice text file detailing how to access it if needed.

Another thing is you could forget servicing a data-event and just poll the port.
- Remnant- (Steve Schmitt)
There are functions to access the interrupt vectors, but I believe they are all compiler dependent. I don''t believe that most Windows compilers even bother listing the interrupt setting functions, though they do allow an interrupt generating function.

In old Borland the function to set the interrupt vector was setvect(). DJGPP might be more friendly, and I have no idea about the old Microsoft compilers.
i know how i have to write my programm but i have no idea which function i should use.
i have an old compiler and i know that you can access the interrupts but with what
Can you be a little more specific on what you''re asking?
In Borland Turbo C 2.0 this is how you would set an interrupt handler, if that''s what you''re asking.

void interrupt (*old_isr)();

void interrupt my_handler() {
/* handle the interrupt */
}

int main(int argc, char ** argv) {
/* blah is the interrupt number you want to replace */

old_isr = getvect(blah);

disable();
setvect(blah, my_handler);
enable();

/* .... whatever else you want to do .... */

disable();
setvect(blah, old_isr);
enable();
}
Have you a little programm where I can access the interrupts?

And I try to explain: it is the same how a printer you do it on and the printer send a signal to the pc and then you can send a singnal what he have to print......
it is difficult to explain....
I''m not quite sure what you''re getting at. Vielleicht du kannst auf Deutsch besser erklaren?

This web site contains detailed information about serial (RS-232) interfacing and also contains code fragments.
http://www.senet.com.au/~cpeacock/

Anyway, I lost any interrupt level programming examples I have two hard drive crashes ago, but the book Advanced C Programming from the Peter Norton library has some good examples in it. However, the book is *old*. It comes with a 5 1/4, so it might be hard to find.
Nun gut ich versuchs: ich soll also ein Programm schreiben
wo von einer Telefonanlage ein Signal(Zeichen) zum PC gesendet wird und der PC sendet ein Signal(Zeichen) zur Telefonanlage zurück. Die Telefonanlage ist an einen Comport angeschlossen. Und ich soll nun auf die IRQ (Interrupts)zugreifen /sie ansteuern oder wie auch immer...

Bitte schickt mir irgendwas womit ich was anfagen kann.

Achso falls das hilfreich ist es ist das gleiche wie mit einem Drucker ein Druckbefehl geht zum Drucker allerdings soll ich nicht den Comport sondern den IRQ ansteuern.

Dnake im vorraus Thanks Merci
Na ja, dann ich denke dass http://www.senet.com.au/~cpeacock/
kann besser als mich erklaren.

Es gibt auch ein "Serial-Programming HOWTO" fuer Linux.
Ich habe auch gefunden dass du kannst mit die WIN32 Comm API ein "overlapped i/o event" fuer einen Comport machen.

Viel glueck!

This topic is closed to new replies.

Advertisement