talking to my parallel port (LPT1)
56 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, I try to send a signal to the LPT1 using a 64 bit MATLAB on a 64 bit Windows 7. Unfortunately it doesn't work. I tried several methods:
Version 1:
if regexp(computer,'64')
lib = 'inpoutx64.dll';
libcall = 'inpoutx64';
else
lib = 'inpout32.dll';
libcall = 'inpout32';
end
if ~libisloaded(libcall)
loadlibrary(lib,'inpout32.h');
end
port_address = hex2dec('0378');
input = calllib(libcall, 'Inp32', port_address + 1);
calllib(libcall, 'Out32', port_address, 255);
unloadlibrary(libcall); %close library when finished
version 2:
ioObj = io64;
status = io64(ioObj)
address = hex2dec('378');
data_out=1;
io64(ioObj,address,data_out); % send a signal
data_out=0;
io64(ioObj,address,data_out); % stop sending a signal
clear io64;
Version 3:
loadlibrary('inpout32', 'inpout32.h');
calllib('inpout32', 'Out32', 888, 255);
unloadlibrary('input32');
Version 4:
config_io;
global cogent;
if( cogent.io.status ~= 0 )
error('inp/outp installation failed');
end
address = hex2dec('378');
byte = 99;
outp(address,byte);
%datum=inp(address);
I wrote a script that should send every second a signal to the LPT1 and measured the voltage on every contemplable pin. Nothing happend....what have I done wrong? Has anyone an idea? I would be reallly glad! Thanx!
6 Kommentare
Christopher Warren
am 22 Mär. 2018
I found out how to make the "ioObj = io64" commands (version 2 above) in the original post) work on my machine. My problem was that my LPT port did not have the typical address (378) because Windows 10 assigns parallel port addresses differently now. Find out your LPT address range by going into device manager, "Multifunction Adapters" and double clicking your parallel port. the I/O range is listed there, and your ports address will be the first 4 characters following "0x". In my case it was 0xDFD8, so my address is DFD8, and I use the code "address = hex2dec('DFD8');" to set my address. Then my triggers worked.
Nicole Long
am 3 Mai 2019
Thank you, thank you, thank you Christopher Warren for posting your solution. Despite endless searching, I could not figure where the LPT address was on my Windows 10 machine. Now I can finally send triggers. Thanks!!
Antworten (1)
Mireia Torralba
am 3 Apr. 2017
Hi, I am checking your code and maybe the problem is you are not giving enough time to your parallel port? LPT is very fast but whenever you try to write too fast you may have problems. So I would advice to use:
ioObj = io64;
status = io64(ioObj)
address = hex2dec('378');
data_out=1;
io64(ioObj,address,data_out); % send a signal
data_out=0;
pause(0.01); %10 miliseconds should be perfectly ok
io64(ioObj,address,data_out); % stop sending a signal
clear io64;
If this does not work, check that indeed your LPT output is 378 (should be, this is the standard). These are the things that come to my mind. Cheers!
0 Kommentare
Siehe auch
Kategorien
Mehr zu Prepare Model Inputs and Outputs finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!