reading/writing to the parallel printer port
reading/writing to the parallel printer port
Hi...
I'm new here but I'm old Qbasic hacker...
I have written a program in Qbasic that reads and writes data to LPT1:
'Identify the LPT1 Address
DEF SEG = 0
pdata% = PEEK(&H408) + PEEK(&H409) * 256
IF pdata% = 0 THEN
PRINT " LPT1 not found"
SHELL "pause"
END
ELSE
PRINT " LPT1 found at &H"; HEX$(pdata%)
pstatus% = pdata% + 1
END IF
that worked with a line printer cable connected to a PC with a printer port running in a DOS environment.
Now I have a "newer" PC and a USB cable which has a parallel printer connector to an old dot matrix printer.
prints great with this Freebasic Code:
' Send some text to the Windows printer on LPT1:, using driver text imaging.
Open Lpt "LPT1:EMU=TTY" For Output As #1
Print #1, "Testing!"
Close
if freebasic can send data to LPT1(via the printer driver), is it also possible to send/read data from LPT1 at the connector pin level?
like this in Qbasic?:
' write a hex F8 to output port 378 to set pins 5,6,7 & 8 &(9)to hi
OUT pdata%, &HF8
I'm new here but I'm old Qbasic hacker...
I have written a program in Qbasic that reads and writes data to LPT1:
'Identify the LPT1 Address
DEF SEG = 0
pdata% = PEEK(&H408) + PEEK(&H409) * 256
IF pdata% = 0 THEN
PRINT " LPT1 not found"
SHELL "pause"
END
ELSE
PRINT " LPT1 found at &H"; HEX$(pdata%)
pstatus% = pdata% + 1
END IF
that worked with a line printer cable connected to a PC with a printer port running in a DOS environment.
Now I have a "newer" PC and a USB cable which has a parallel printer connector to an old dot matrix printer.
prints great with this Freebasic Code:
' Send some text to the Windows printer on LPT1:, using driver text imaging.
Open Lpt "LPT1:EMU=TTY" For Output As #1
Print #1, "Testing!"
Close
if freebasic can send data to LPT1(via the printer driver), is it also possible to send/read data from LPT1 at the connector pin level?
like this in Qbasic?:
' write a hex F8 to output port 378 to set pins 5,6,7 & 8 &(9)to hi
OUT pdata%, &HF8
Re: reading/writing to the parallel printer port
Simply put: only DOS allowes "direct HW (hardware) access".
All the other more modern OS's (operating systems) don't do that, in fact they "protect against direct HW access".
You'll have to use something like: in "Try to use inpout32.dll" thread to achieve that (on windows).
Read from there to the current tread-end (it's otherwise far too long ...).
All the other more modern OS's (operating systems) don't do that, in fact they "protect against direct HW access".
You'll have to use something like: in "Try to use inpout32.dll" thread to achieve that (on windows).
Read from there to the current tread-end (it's otherwise far too long ...).
Re: reading/writing to the parallel printer port
keven wrote:
like this in FreeBasic?:
Dim pdata as integer
Lib inpout32.dll
pdata=888 ‘hex 378
‘ write a hex F8 to output port 378 to set pins 5,6,7 & 8 to hi
OUT pdata, &HF8
Re: reading/writing to the parallel printer port
You'll need both, the driver and the .dll ...
the .dll alone is not changing anything (it comunicates with the driver).
Q: How to use it? A: Read the documentation driver/.dll ...
the .dll alone is not changing anything (it comunicates with the driver).
Q: How to use it? A: Read the documentation driver/.dll ...
Re: reading/writing to the parallel printer port
Henrik Haftmann has written a version of inpout32.dll that can be used to replace the existing windows version. The interface to the parallel port is seamless as a driver is included in the dll. I guess I wouldn’t need to reference the dll, just execute the inp and out commands to parallel port address (defaulted to hex 378).
I be trying it out tomorrow... mite have to use the 64 bit version.
I be trying it out tomorrow... mite have to use the 64 bit version.
Re: reading/writing to the parallel printer port
run this to compile:
C:\FreeBasic\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\fbc64.exe –l inpoutx64.dll C:\LapCounter\TEST_FOLDER\MY4LANK1.bas
get this error message:
C:\FreeBasic\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\bin\win64\ld.exe: cannot find -linpoutx64.dll
inpoutx64.dll is in the TEST_FOLDER as well as being located in the C:\Windows\SysWOW64 folder.....
what's going wrong?
C:\FreeBasic\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\fbc64.exe –l inpoutx64.dll C:\LapCounter\TEST_FOLDER\MY4LANK1.bas
get this error message:
C:\FreeBasic\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\bin\win64\ld.exe: cannot find -linpoutx64.dll
inpoutx64.dll is in the TEST_FOLDER as well as being located in the C:\Windows\SysWOW64 folder.....
what's going wrong?
Re: reading/writing to the parallel printer port
Put a copy of the .dll to: [FBC-Dir]\lib\win64\ folder (the compiler needs it there).
Except you have the correct .dll.a file (in-/export library).
To run the compiled .exe, the .dll should be in the same folder ...
Except you have the correct .dll.a file (in-/export library).
To run the compiled .exe, the .dll should be in the same folder ...
Re: reading/writing to the parallel printer port
Mr. SWiss (or anyone else that mite know):
whats a InpOutx64.dll.a file?
and should it be here?:
C:\FreeBasic\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win64
whats a InpOutx64.dll.a file?
and should it be here?:
C:\FreeBasic\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win64
Re: reading/writing to the parallel printer port
do I also need to put the inpout64x.lib some where for this to compile successfully?
Re: reading/writing to the parallel printer port
InpOutx64.dll.a = in-/export library (description what a .dll contains)
If you don't have one, use the: InpOutx64.dll (instead)
Read my previous post again until you understand it's meaning.
If you don't have one, use the: InpOutx64.dll (instead)
Yes, correct. This is just for compiling.keven wrote:and should it be here?:
C:\FreeBasic\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\lib\win64\...
Read my previous post again until you understand it's meaning.