Thursday, October 23, 2008

Controlling the devices in Hard Real Time through PC's Parallel port

Parallel port is the most commonly used port for interfacing the devices such as printers, scanners and modems. Parallel port has easy implementation and has fast data transmission. Nowadays most machines come with advanced modes like ECP and EPP along with SPP. Here you can get clear idea about Parallel ports and their modes.
Devices, which are connected through the parallel port can be monitored by a kernel module in hard Real-time. When devices make interrupts according to their status,we can serve them in Real

Time Scheduling
To get hard Real time performance in Linux the RTAI flavor can be used. When connecting multiple devices through a single port, there a need arises, to schedule those tasks. For this, real time kernels have timing algorithms,which can be used to schedule multiple tasks.

Interrupt Service Routine(ISR)
It is simply a function that takes no arguments & returns no value, and mediates the interaction of a hardware device with the real time application. Most Parallel ports use irq 7 which we can find from BIOS setup.
When the real time task needs to inform the user process that an event has taken place, it puts a message into a real time FIFO. Each FIFO can transfer data in one direction;either from the real time task to a user process or the reverse. Thus we need to use two FIFOs for duplex communications. From the application side, the FIFO behaves like a regular file.
From Linux user space, device nodes must be created for the FIFOs before making use of the
RT-FIFO driver. This needs to be done only once.

RTAI Modules
To run any application four RTAI key modules are needed. These modules should be
loaded before running any program.
  • insmod rtai_hal.o
  • insmod rtai_ksched.o
  • insmod rtai_fifos.o
  • insmod rtai_sem.o
Note:However, when we connect devices with parallel port we need to take much care about the connections. For easiness, there is an application(parapin) available to set pins and their modes, from user application.

No comments:

Post a Comment