Download the following 4 files:
- porttalk.sys, copy to C:\WINDOWS\system32\drivers
- lptread.m
- lptread.mexw32
- lptwrite.mexw32
Copy the last three files to a directory where your matlab can access.
Your LPT port number is probably 0x378 (or 888). Assume lptport is the port number, then we use lptread to read from the port:
val = lptread(lptport)
and use lptwrite to write to the port
lptwrite(lptport, val)
As a real example, we want to control the step motor Gary created to investigate motion artifact in fMRI. Here is a sample code:
lptport = hex2dec('378'); dir = hex2dec('40'); data = hex2dec('20'); for ii=1:30 lptwrite(lptport, data+dir); pause(0.005) lptwrite(lptport, dir) pause(0.005) end
Author of lptread.m: Erik Flister, UCSD, 2006. Adapted from Andreas Widmann.
sorry, i couldnt access this command in matlab 7.you asked to download four file but it didnt work .there is a command error about lptread and lptwrite.
if there are any solution different than this please re send
thanx in advance
sudip
@sudip regmi
What are the error messages?
Hey Xu Cui,
Thanks for creating this driver. It works great!
Xie Xie,
Steve
Undefined function or variable ‘lptwrite’.
Error in lptdeneme (line 5)
lptwrite(lptport, data+dir);
I have Windows 64-bit, and the MATLAB cannot recognize the lptwrite function.
I get the following error
Undefined function or variable ‘lptwrite’.
Does lptwrite only works on 32-bit? Could you please help me with this?
Thanks,
Nidhi