home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!usc!sdd.hp.com!hplabs!felix!fritz!scotth
- From: scotth@felix.filenet.com (Scott Hopson)
- Newsgroups: comp.lang.c
- Subject: Re: help REAL TIME CLOCK INTERRUPT
- Message-ID: <19687@fritz.filenet.com>
- Date: 21 Aug 92 05:58:47 GMT
- References: <1992Aug18.043938.20502@cs.uow.edu.au>
- Reply-To: scotth@fritz.filenet.com (Scott Hopson)
- Organization: FileNet Corp., Costa Mesa, CA
- Lines: 68
-
- In article <1992Aug18.043938.20502@cs.uow.edu.au> u8800914@cs.uow.edu.au (Mohammad Salim Olime) writes:
- >For simulation of an ATM link between to IBM-PC/AT I need to generate
- >packets(pay load) in real time using Turbo C under MS-DOS .
- >Interrupt 08h ie the clock tick with a frequency of 18.2 Hz is not
- >fast enough. In C User Journal Dec 1991 I found an article
- >by Paul A. Cornelius titled "Using 1KHz Interrupts on AT CLones"
- >He discusses a method for generating interrupts at a rate of 1KHz
- >using the Real Time clock interrupt (70h) which can be enabled
- >through BIOS INT 15h, function 83h.
-
- >> misc deleted <<
-
- To an interrupt on the PC running DOS you need to trap the interrupt,
- execute your own code, and resume the trapped interrupt or clean up
- like the interrupt would. In the case of the TIMER interrupt you can
- execute your own code and let the interrupt continue on. If you don't
- let the interrupt finish the processing things will get really messed
- up. Below is an example of how to VECTOR the INT 70 Real Time Clock
- interrupt.
-
- --------------------------------CUT HERE----------------------------------
-
- #include <dos.h>
-
- static int counter = 0;
-
- void interrupt (*old_int70)(); /* save addres of old INT 70 code */
-
- void interrupt int70(void)
- {
-
- /* perform your own code here */
-
- old_int70(); /* call the original handler */
-
- /* if you want to by pass the original handler you will need to perform */
- /* the following Magic Rituals inorder to satisfy the god of DOS. */
- /*
- outport(0x20,0x20); send EOI to PIC
- */
- /* this call sends an End Of Interrupt to the Programmable Interrupt
- Controler
- */
- }
-
-
- main()
- {
-
- old_int70 = getvect(0x70); /* get and save old handlers address */
- setvect(0x70,int70); /* set new address for int handler routine */
-
- /* perform work */
-
- setvect(0x70,old_int70); /* restore original int handler */
- exit(0); /* before you exit or you'll crash */
- } /* the system */
-
- --------------------------------CUT HERE----------------------------------
-
-
- This is basically what you need to do, you need to make sure your code
- executes within the 1K time slice or the system may begin to slow or
- do other strange things. Note that this is a very simple example. You
- will need to experiment on your own with your own code.
-
- --
- Scott Hopson (scotth@filenet.com)
-