Zentill.now
Zentill.now
Branch Unspecified
18 Feb 2008

parallel port communication in matlab through simulink

Code for parallel port communication with matlab,.......

dio = digitalio('parallel','LPT1')
--> create an object

data1 = addline(dio,0:7,0,'out') %Pin 2-9
data2 = addline(dio,0,2,'out') %Pin 1
data3 = addline(dio,1,2,'out') %Pin 14



If i have to embed this code into the simulink block set and then run to communicate with the parallel port

what should i do....

expecting a reply to solve my problem


thanks in advance --- zentill
xheavenlyx

xheavenlyx

Electronics and Communication
18 Feb 2008
In simulink try to select the block for "Run MATLAB function" or something similar. Check help file on how to run matlab code from simulink.

OR OR OR

You could directly use the "Digital Output" Block under Data Aqussition Blockset to control the Parallel Port directly!!!! 😀 Its a better option if your project is completely in Simulink.
Zentill.now

Zentill.now

Branch Unspecified
29 Feb 2008
thank u

the information that you shared was of great help
now iam workin on the DAQ block set as you said
xheavenlyx

xheavenlyx

Electronics and Communication
29 Feb 2008
Its good to hear that. Welcome. 😀
sorell13

sorell13

Branch Unspecified
26 Jul 2008
I have used that code to generate an output frequyency in matlab. I realised that with that commands the LPT port is not sufficiently fast. What should I do to increase the speed of the LPT port (i want to create a frequency greater than 50Hz to control a laser diode). thank you very much
xheavenlyx

xheavenlyx

Electronics and Communication
26 Jul 2008
Well, I think you should use some analog device for the final frequency generator. Something like the 555 connected to the parallel port, and when you give the signal it shoots out a 50Hz(or greater) pulse whenever you want.

OR OR

The other good method, is use your headphone output! Most commercial sound cards can produce audio range till about 90kHz (human hearing 20Hz to 20kHz). So connect the headphone out to the base of an NPN amp. So the laser turns on at the same frequency you giving to your speakers (use a frequency generator or square wave generator in matlab) And follow through from there, hope you get the idea. 😀
sorell13

sorell13

Branch Unspecified
27 Jul 2008
Thank you very much!
ned_student

ned_student

Branch Unspecified
08 Jul 2010
need to know simultaneous data sending to parallel port using matlab???

Share this content on your social channels -

Only logged in users can reply.