LPT usage

For issues with communication ports, protocols, etc.
Post Reply
squibit
Posts: 16
Joined: Jan 16, 2006 19:44

LPT usage

Post by squibit »

Using FB via FBIDE-64 bit machine-Windows 7(am signed on as administrator)
Printer connected to parallel port does not respond to a sequence such as:
open lpt "LPT1:EMU=TTY" for output as #2
print #2,"SAM"
nor to explicit outputs to the port such as
out &h378,i where has been declared to be a byte and various
values of i are used.

inp(&h378) does return a value(-8) [ 248 if i is declared as ubyte]

using shell "print todo.dat" DOES work
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: LPT usage

Post by D.J.Peters »

For port inp/outp commands you need inpoutx64.dll here are a stzep by step http://www.logix4u.net/parallel-port/26 ... -xp-64-bit

Joshy
squibit
Posts: 16
Joined: Jan 16, 2006 19:44

Re: LPT usage

Post by squibit »

Thank you for your help to date.

Don't understand how to "link" to inpoutx64.lib

(the driver file has been placed in System32\drivers and inpoutx64.dll has been put in freebasic\lib\win32)
Have tried multiple placements of the ....lib file, inclib's, libpath's, name changes, etc.

By the way, how does one officially thank you.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: LPT usage

Post by D.J.Peters »

Delete the import lib file: inpoutx64.lib from FreeBasic folder (it's for VisualStudio C/C++)

Here are the FreeBASIC include file you need for win32 and win64.

Joshy

file: inpout.bi

Code: Select all

#ifndef __INPOUT_BI__
#define __INPOUT_BI__

#ifdef __FB_WIN32__
 #ifdef __FB_64BIT__
  extern "Windows-MS" lib "inpoutx64"
 #else
  extern "Windows-MS" lib "inpout32"
 #endif
   declare sub      Out32(byval PortAddress as short, byval data as short)
   declare function Inp32(byval PortAddress as short) as short
 end extern 
#else
#error Sorry OS must be Windows X86 or x86_64 !
#endif

#endif
test01.bas

Code: Select all

#include "inpout32.bi"
print Inp32(&H278)
sleep
squibit
Posts: 16
Joined: Jan 16, 2006 19:44

Re: LPT usage

Post by squibit »

Have put inpoutx64.dll into freebasic\lib

Is this correct? Or should it go into windows\sys32?

Is the "WINDOWS MS" before lib an indication that it should go into some Windows folder.

Keep getting error message that the format of the file is incorrect.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: LPT usage

Post by D.J.Peters »

squibit wrote:Have put inpoutx64.dll into freebasic\lib Is this correct ?
No put it in the same folder where your *.exe are build and inpoutx64.sys also.
squibit wrote:Keep getting error message that the format of the file is incorrect.
I wrote it before search and delete the file inpoutx64.lib it's for VisualStudio C/C++ not for FreeBASIC.
Be sure you use a 64-bit FreeBASIC compiler.

If you use a 32-bit FreeBASIC compiler on your 64-bit windows you have to use instead inpout32.dll inpout32.sys.

Joshy
squibit
Posts: 16
Joined: Jan 16, 2006 19:44

Re: LPT usage

Post by squibit »

Joshy,
Thanks for all you help.
Did what you said; program compiled but did not print.

On the website with this link
https://groups.google.com/forum/#!topic ... bIO2wHK1KU

found an extra step was required, involving Installing the driver.

Program now prints--only trouble, which I can live with-is that printing occurs after one closes the
execution of the program.

Bernie
Post Reply