How to use interrupts in parallel port

Hello, I would like to know how to use interrupts in parallel port. I know there is a bit in the control register that is bit4 of 37AH. It is used to trigger an interrupt. What next? How do I use this interrupt for my convenience. How can I program it to suit my needs? I know it detects low to high transition of nACK. Can I use any other pin like online and interrupt when it transits from 0 to 1? Is this implemented by shorting ONLINE and nACK? Above all how do I implement the interrupt service routine? What should I do to this? What initialisations should I make? How do I write the Interrupt service routine? I heard something about IRQ5 and IRQ7 in parallel port. What are they? Is it related to what I said earlier? If yes how do I know which IRQ should I use it and how? Any more info required please reply. Thank you, Have a nice time.

Reply to
Sam
Loading thread data ...

There are three basic things you need to work through.

1) Making an electrical signal on the port pin drive the correct IRQ line. I'm not sure if this is actually hooked up on all parallel ports. Assuming you have one where it is, you have to find the correct signal polarity or edge direction. 2) Making the IRQ line cause a processor interrupt, by performing or verifying appropriate programming of the interrupt controller. This requires some knowledge of the operating system to be used. 3) Installing and connecting a service routine for the interrupt. Again, this is highly dependent on the operating system.
Reply to
cs_posting

formatting link

Reply to
Chris

I forgot to mention a point. I am using assembly level programming and Operating system is DOS. I am using Macro Assembler (MASM) and 8086 programming. I am using Centronics parallel port and its polarity is from 0 to 1. I would set IRQ that is bit 4 of 37AH high to enable interrupt. Now at what location should I use the interrupt service routine? What is the Interrupt number?

Reply to
Sam

We can't tell you.... I depends on the hardware in _your_ computer. The standard is for the first port to use IRQ7, and the second IRQ5, but on most modern PC's, this can be reprogrammed in the CMOS setup. Also on most modern machines, the hardware available in the port, though 'reverse compatible' with the original sytem, will include extra abilities. to find out just what your system can do, you should look at the data sheet for the chipset used, or 'play safe', if this code it to be used on multiple machines, and just use the original abilities. There is also a technical 'difference', depending on how old the hardware is. The original PC, had 'level sensitive' interrupts. Latter this switched to 'edge sensitive' triggering. The port _should interrupt on a low to high transition of the ACK line, but this ability may be disabled in hardware/software (the PC, basically does not use parallel port interrupts, on standard ports, and the shortage of interrupts often led to this being disabled). I'd suggest looking at:

formatting link
Which has a basic routine to test the interrupt.

Best Wishes

Reply to
Roger Hamlett

The book you want is "Parallel Port Complete" by Jan Axelson. Also, older books about DOS assembly language programming. I did all of this... 15 to

20 years ago... it's more or less hidden from us in Windows. But DOS PCs make great controllers, and you can get them in miniature size.
Reply to
mc

I have used that interrupt in C, so you have to do some translating,but it did work up tp 30000 ints/second. Used to measure the speed of a car from the ABS signal captured at a rear wheel. Anyway , a stripped down extract below:

----------------------------------------------- static int *dosblockptr=(int *)0x400008L; static int LPTDATA,LPTSTATUS,LPTCONTROL;

static void interrupt far (*LPIRQ_oldvector)(void);

#define LPIRQ_int (5)

#define LPIRQ_vec (LPIRQ_int+8) static int LPIRQ_mask; static int SPEED_running=0;

void interrupt far LPIRQ_newvector(void){ /* do what you have to do at interrupt, maybe read /store system clock,or just increment a count and dont forget the next line when you are ready */ outp(0x20,0x20); }

void close_SPEED(void){ if(!SPEED_running)return; SPEED_running=0; outp(0x21,LPIRQ_mask | (1

Reply to
Sjouke Burry

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.