Parallel-Port Controller Using MATLAB

By Devanand T.


Running the program

Install Matlab 7.0.1 software in your computer system. Copy ‘LPT port’ folder from to ‘work’ folder. (It can be found in the files to be download from the link at the bottom of the article.) Click the Matlab icon. Navigate to ‘LPT port’ folder from ‘Current Directory’ section, which is just on top of ‘Command’ window. To run the program, type ‘data_port_controller’ in ‘Command’ window.

The control of LED has been explained earlier. To control the stepper motor, click ‘Stepper Controller’ button in the program output shown in the circuit. You will get the program output as shown below. Here, you can control the stepper motor in three modes: single-step, high-torque and half-step. Also, the motor can be controlled either in forward or reverse direction. By default, the program is designed to rotate the stepper motor in reverse direction with 100ms delay. You can change these parameters as per your requirement.

Fig.7: Screenshot of the program output of stepper motor controller
Screenshot of the program output of stepper motor controller

Generating standalone program

To run the program without Matlab, create a standalone ‘.exe’ file from ‘M-file’ and port it to other computers using MCR (Matlab component runtime). For that, configure the Matlab compiler as follows: Type ‘mbuild –setup’ against the prompt. Matlab will ask for a few compiler options. Select the default Matlab compiler. Then type ‘mcc–m mfilename.m–o exefilename’. Here ‘mfilename’ must be of function ‘m-file’ and ‘exefilename’ is the filename of the standalone executable file that will be generated. This command generates a few other files along with standalone ‘.exe’ file. Now, you can run the executable file on a PC without Matlab by copying the generated files to that computer.


Assemble this project on any general purpose PCB or on the PCB shown here in Fig.8 (View as PDF). Component layout for the same is shown in Fig.9 (View as PDF). After mounting all the components on the PCB, fix the 25-pin male connector (CON1) on the PCB as shown in the layout. Use a 9-wire, 50cm FRC cable with 25-pin female connector at one end and male connector at the other end to connect between the board and the PC. Identify the stepper-motor wires and connect the common wire to 12V and the rest of the coils in sequence as shown in the schematic diagram.

Download PCB and component layout PDFs (Fig. 8,9): click here

EFY note

All the relevant files of this project have been included in the link: click here

The project was first published in May 2009 and has recently been updated.


Please enter your comment!
Please enter your name here