LPT Communication
BlitzPlus Forums/BlitzPlus Programming/LPT Communication
| ||
Is it possible to communicate with the LPT port via the stream=openstream("LPT1") method? If so, what would the default baud rate be, and how can it be changed. Also, should I create a byte that determines whether each pin is on or off? |
| ||
Search PortIO DLL. Allows you to toggle pins via byte and so forth. |
| ||
deja vu: http://blitzbasic.com/Community/posts.php?topic=46477 |
| ||
Unfortunately, this requires other software to be installed and running previously. I am a stickler for having nothing running in the background on my pc, so if there is any other way, it would be wonderful. I have read that it is possible to open up communication with the serial port via file=openfile("COM1") but I was wondering if the same method works with LPT. |
| ||
Well, I finally decided to go ahead and try writing data to LPT. I wrote a few random bytes (while forgetting to unplug the printer) and it freaked. But it works! If there are ways to set the baud rate etc. that would be great. Otherwise, I'm done. |
| ||
Scratch that. It writes to the printer buffer, which made the printer freak. Back to square 1. |
| ||
You can access LPT or COM ports with Win32 API. You need some userlibs definitions for Blitz. Look for samples on this forum and on MSDN. |
| ||
Sorry this is for B3d, but it may be of help. I posted some parallel port I/O stuff in the user libs. It's low level and should allow you to read and write status, control and data bit/bytes. I used it to control the position of Radio Control servos. http://www.blitzbasic.com/codearcs/codearcs.php?code=1487 It's been awhile since I've done low level output to printer, and it varies with hardware. In general write data, send strobe, watch status for ack, send next character. Also keep in mind printers have commands ie HPGL. If it's application printing your looking for I think Kanati had a blitz3d printing dll, there maybe others out there. Summary, Most OS's will require you use a DLL to allow access to hardware ports ( thats the law ). There is a winapi for printing as well, here is some vb6 code as example. Also don't use the word baud with parallel communications because there is no UART with parallel printing and thus no control register to set a rate. 8) |