April 2012
Intermediate to advanced
352 pages
8h
English
Once interrupts are enabled, the parallel port generates an interrupt whenever the electrical signal at pin 10, dubbed the ACK bit, changes from low to high (Corbet et al., 2005).
To toggle the electrical signal at pin 10, I connected pin 10 to pin 9 (using a resistor) and then I executed the program shown in Example 8-2.
Example 8-2. tint.c
#include <sys/types.h> #include <machine/cpufunc.h> #include <err.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h>#define BASE_ADDRESS 0x378 int main(int argc, char *argv[]) { int fd; fd = open("/dev/io", O_RDWR); if (fd < 0) err(1, "open(/dev/io)"); ...