GatorV Posted October 8, 2004 Share Posted October 8, 2004 Hi, I have been searching for a good tutorial on how to perform I/O to the Parallel Port (LPT1), but had no luck :(, can any one recomend one? Thanks in Advance :D Link to comment Share on other sites More sharing options...
0 Andareed Posted October 8, 2004 Share Posted October 8, 2004 What OS? If you use windows, you should be able to use CreateFile and specify file = "LPT1". From MSDN: hCom = CreateFile("LPT1", GENERIC_READ | GENERIC_WRITE, 0, // must be opened with exclusive-access NULL, // no security attributes OPEN_EXISTING, // must use OPEN_EXISTING 0, // not overlapped I/O NULL // hTemplate must be NULL for comm devices ); You can then use ReadFile and WriteFile and treat LPT1 just like a file. Link to comment Share on other sites More sharing options...
0 GatorV Posted October 8, 2004 Author Share Posted October 8, 2004 Thanks I am using Windows, basically I want to send a high bit to certain pins, this is for a hardware thing, and I wan't to simulate a button press on the Board, via the LPT1 device. Thanks :cool: Link to comment Share on other sites More sharing options...
0 GatorV Posted October 8, 2004 Author Share Posted October 8, 2004 BUMP, anyone?? Link to comment Share on other sites More sharing options...
0 azcodemonkey Posted October 9, 2004 Share Posted October 9, 2004 You'll probably need to use DeviceIoControl to access specific ports on the parallel connector. Look for IOCTL_PAR_SET_READ_ADDRESS and IOCTL_PAR_SET_WRITE_ADDRESS. You'll probably need to use a few other operations, too. http://msdn.microsoft.com/library/en-us/pa....asp?frame=true Link to comment Share on other sites More sharing options...
0 Andareed Posted October 9, 2004 Share Posted October 9, 2004 Shouldn't ReadFile/WriteFile work? Those IOCTL's seem only relavent when dealing with ecp or epp mode. In any case, you'll need to use DeviceIoControl with the IOCTL's mentioned by weenur. Link to comment Share on other sites More sharing options...
0 azcodemonkey Posted October 9, 2004 Share Posted October 9, 2004 I don't know. I'm only guessing. Can you specify port in WriteFile? Link to comment Share on other sites More sharing options...
0 Andareed Posted October 9, 2004 Share Posted October 9, 2004 No idea either ;) Parport.sys source (or something useful) might be included in some windows ddk though. You could check this for a definative answer. Link to comment Share on other sites More sharing options...
Question
GatorV
Hi, I have been searching for a good tutorial on how to perform I/O to the Parallel Port (LPT1), but had no luck :(, can any one recomend one?
Thanks in Advance :D
Link to comment
Share on other sites
7 answers to this question
Recommended Posts