Friday, August 5, 2011

CrazyEngineers Forum - Electrical & Electronics Engineering

CrazyEngineers Forum - Electrical & Electronics Engineering


writing a program in MATLAB using interfacing of parallel port

Posted: 04 Aug 2011 07:41 PM PDT

hello guys it's my first topic in this amazing SITE ..
i want to ask about learning how to make a programs in matlab and interfacing using PARALLEL PORT .

i have an example
Write a program to light a number of LEDS
corresponding to an input variable in the
MATLAB.
􀂃 Variable = 0 (no LED on)
􀂃 Variable = 1 (1 LED on)
􀂃 Variable= 2 (2 LED's on)

(y=input('X=')
daqhwinfo('parallel')
dio=digitalio('parallel','LPT1')
input=addline(dio,0:7,'out')
if y==1
putvalue(dio, [0 0 0 1 1 0 0 1])
end
if y==2
putvalue(dio, [0 0 0 1 1 0 1 1])
end
if y==3
putvalue(dio, [0 0 0 1 1 1 1 1])
end

if y==0 putvalue(dio, [0 0 0 0 0 0 0 0])
end )
i really understand the program from the first till
""input=addline(dio,0:7,'out')""
but after this line i didn't understand the sequence of 1,0 in putvalue(dio, [0 0 0 1 1 0 01])
i want to know what is [0 0 0 11 001] i knew that parallel port have 8 data pins but what is the sequence that he used in this program and why ?!
i need to understand how to write a program because i have a project
""Write a program to simulate any case from
your creation.
􀂃 Use in your project the chip (L293D) do drive
a motor clock wise and anti clock wise
through a MATLAB code.""

so i really finding a problems in understanding the language of matlab !! any help please :)
THANKS IN ADVANCE :)

No comments:

Post a Comment