Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2017-06-15 Thread James Richters
I have updated my unit for accessing parallel ports on Windows with Freepascal 
to now select the correct .dll  file depending on how the program is compiled.

It now uses 

 inpout32.dll if you compile for Win32

inpoutx64.dll if you compile for Win64

I also added a new sample program that can be compiled for Win32 or Win64 which 
also demonstrates some of the other procedures and functions available.

 

Here are links:

here’s the link to the FPC sample files.   
https://github.com/Zaaphod/FPC-Parallel-Port  

The InpOut32 and InpOutx64 drivers are here: 
http://www.highrez.co.uk/downloads/inpout32/

 

James

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-27 Thread Bo Berglund
On Tue, 26 Jul 2016 21:48:55 +0200, Bo Berglund
 wrote:

>On Tue, 26 Jul 2016 11:45:51 +0200, Koenraad Lelong
> wrote:
>
>>FWIW, I ported the library to fpc, together with the test/demo software 
>>(x_pigpiod_if2).
>>The fact that the communication goes via the network opens possibilities 
>>though. I tested my port on my laptop, connected to the pi. So 
>>applications running on a remote PC could control the pi's IO.
>>
>>I have no public place to publish this software, so if anyone is 
>>interested, please ask.
>>
>
>I would be interested and I could put it up on my webserver if you
>like a public spot.

I have received the code now but the project contained in the zip does
not build on my RPi3 with Raspbian and Lazarus 1.6 FPC 3.0.

I get the following error message:

Compile Project, Target: x_pigpiod_if2: Exit code 256, Errors: 1
/usr/bin/ld: warning: link.res contains output sections; did you
forget -T?
/usr/bin/ld: cannot find -lpigpiod_if2
x_pigpiod_if2.lpr(21,0) Error: Error while linking

The file it complains about is pigpiod_if2 and is not contained in the
zipfile. But there is a pigpiod_if2.pas file that seems to define a
lot of functions contained in a file with this name...
I do not know if it is an external binary library, which must be
supplied or where it resides.

-- 
Bo Berglund
Developer in Sweden

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-27 Thread James Richters
>>FWIW, I ported the library to fpc, together with the test/demo software 
>>(x_pigpiod_if2).
>>The fact that the communication goes via the network opens 
>>possibilities though. I tested my port on my laptop, connected to the 
>>pi. So applications running on a remote PC could control the pi's IO.
>>
>>I have no public place to publish this software, so if anyone is 
>>interested, please ask.
>>
>
>I would be interested and I could put it up on my webserver if you like a
public spot.
>

I would also be interest in this

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-27 Thread James Richters
>i think it is the ight place i also like to rcv the software  for directly 
>controling i/o ports for fpc on wimdows
>Thank you
>Ezra

 

Ezra,

here’s the link to the FPC files.   
https://github.com/Zaaphod/FPC-Parallel-Port  

The InpOut32 driver is here: http://www.highrez.co.uk/downloads/inpout32/

I am able to control the parallel port directly under Windows 7 Professional on 
this motherboard https://www.amazon.com/gp/product/B00IW99S4A It has on board 
parallel port on a header.  

 

James

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-26 Thread ezrashumla
i think it is the ight place i also like to rcv the software  for directly 
controling i/o ports for fpc on wimdows
Thank you
Ezra

 

 

 

-Original Message-
From: Bo Berglund <bo.bergl...@gmail.com>
To: fpc-pascal <fpc-pascal@lists.freepascal.org>
Sent: Wed, Jul 27, 2016 1:56 am
Subject: Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

On Tue, 26 Jul 2016 16:23:12 -0400,
ezrashu...@aim.com wrote:

>yes thank you

You responded to the wrong post...



-- 
Bo Berglund
Developer in Sweden

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-26 Thread Bo Berglund
On Tue, 26 Jul 2016 16:23:12 -0400,
ezrashu...@aim.com wrote:

>yes thank you

You responded to the wrong post...



-- 
Bo Berglund
Developer in Sweden

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-26 Thread ezrashumla
yes thank you
 

 

 

-Original Message-
From: Bo Berglund <bo.bergl...@gmail.com>
To: fpc-pascal <fpc-pascal@lists.freepascal.org>
Sent: Tue, Jul 26, 2016 10:49 pm
Subject: Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

On Tue, 26 Jul 2016 11:45:51 +0200, Koenraad Lelong
<fpasc...@de-brouwerij.be> wrote:

>FWIW, I ported the library to fpc, together with the test/demo software 
>(x_pigpiod_if2).
>The fact that the communication goes via the network opens possibilities 
>though. I tested my port on my laptop, connected to the pi. So 
>applications running on a remote PC could control the pi's IO.
>
>I have no public place to publish this software, so if anyone is 
>interested, please ask.
>

I would be interested and I could put it up on my webserver if you
like a public spot.


-- 
Bo Berglund
Developer in Sweden

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-26 Thread Bo Berglund
On Tue, 26 Jul 2016 11:45:51 +0200, Koenraad Lelong
 wrote:

>FWIW, I ported the library to fpc, together with the test/demo software 
>(x_pigpiod_if2).
>The fact that the communication goes via the network opens possibilities 
>though. I tested my port on my laptop, connected to the pi. So 
>applications running on a remote PC could control the pi's IO.
>
>I have no public place to publish this software, so if anyone is 
>interested, please ask.
>

I would be interested and I could put it up on my webserver if you
like a public spot.


-- 
Bo Berglund
Developer in Sweden

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-26 Thread Koenraad Lelong

Op 24-07-16 om 16:29 schreef James Richters:

Bo,
I also have a raspberry pi project..  I got a hifi-berry card for it and it
is streaming audio to a central audio system, I'm using VLC media player and
an app on my cell phone to control it,  I have not made use of the GPIO on
them yet, but I would really like to learn how this can be accomplished with
FPC, since I am more familiar with pascal than any other language, it would
be great to learn how to do this!  I have a particular application in mind.
I have a relay board that will turn relays on and off with TTL level
signals, what I wish to do is have a remote way to turn certain amplifiers
on and off.   There are 24 amplifiers going to 44 speakers (4 are
subwoffers) in and around my house, sometimes I'll want just downstairs and
outside amps on, other times I'll want just one room on, or all amps on
etc.The amps are all in my crawlspace under the first floor, and that's
where the raspberry pi is.  I also have some volume control chips that are
controlled by clocking data into them, I could chain them all together and
be able to control all of them with just one clock and one data bit.
Any advice on how to get started on controlling GPIO with a raspberry pi
with FPC would be greatly appreciated!

-Original Message-
From: fpc-pascal-boun...@lists.freepascal.org
[mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of Bo Berglund
Sent: Sunday, July 24, 2016 2:22 AM
To: fpc-pascal@lists.freepascal.org
Subject: Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

On Fri, 22 Jul 2016 14:19:20 +, Mark Morgan Lloyd
<markmll.fpc-pas...@telemetry.co.uk> wrote:


Or go the whole hog and
port the program onto a Raspberry Pi: Bo's doing something like you're
asking.


Yes, indeed! I now have something like 7-8 operational RPi units for
different purposes and in several places I have used the GPIO pins to
control and read back digital stuff from FPC programs. Very convenient.

Last I did was to attach a 4-way relay board to a RPi and put a smapp FPC
command line program on it, which gets called from a PHP script on the
Apache webserver on the Pi.
Now I have a webpage, with which I can switch on/off the relays with in
order to control the operational state of some measuring equipment sitting
half way across the workd!

You could do a LOT with FPC and a Raspberry Pi!

Examples:
The Pi also runs an OpenVPN server so I can access it with PuTTY and/or
TightVNC to program it if I need to.

My Pi also has a port mapping utility which makes it possible for me to
remotely access a WiFi network device on a WiFi access point close to the
RPi again from a long distance away. THis was created with FPC and Indy10 on
the RPi.


While Bo's contribution is valid, I have the impression that the 
raspberry is going to the pigpiod. Newer raspbian images have a switch 
(in raspi-config/advanced options) to enable a gpio-server. Using that 
it is possible to access all gpio-functions (gpio, serial, spi, pwm, 
...) as a normal user. See http://abyz.co.uk/rpi/pigpio/index.html. 
There is a snag : the communication with the server happens via the 
network, so it could be that your pi will be hijacked, unless you take 
precautions.


FWIW, I ported the library to fpc, together with the test/demo software 
(x_pigpiod_if2).
The fact that the communication goes via the network opens possibilities 
though. I tested my port on my laptop, connected to the pi. So 
applications running on a remote PC could control the pi's IO.


I have no public place to publish this software, so if anyone is 
interested, please ask.


Koenraad.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows - PiGpio.zip (1/1)

2016-07-26 Thread Bo Berglund

begin 644 PiGpio.zip
M4$L#!!0``@`(`#Q/F4CB2,%-K@L``",F```*4'<+G!A<\U9_U/B
MR!+_>?DK^JJL.CA920*Z*K=7AP(N=2H4X%GU?C@JD(GF;4A22=!UM_9_?Y^>
M228!T=-7WKY'N9#T]/27S_3T]/2N`B^ED7<6>6&[\JU")Z<7UF%SG\Y&@R&-
MQ8V7I/$#=6/O3L1ULOTDI(4=T"H1E(:TM`,O6OEV*F@1K2A,;T5,<3[+CH6=
M5"HTO?426H2.(/RF(DF%0V'@/]!)'-K.(ES2?+&46B[GNB(600H!2R8E
MT/-`@<`T/5:A,CC2,O&7DBR7(=NJ%`51:AMFD,WL>QC3Y^F'B*NO_>
M-/!')R&=B/C&7P7.<87>4\=Q6+QPO4#0>.19Y&(N_('>>SH=72E$X+=#7J`X
M[,`A]CV&-TQI2@T'[XW6>VO_.0T>6YEH#5+RH#%D,;?"=B`P\C!N'>WMM0RJ
M@HP?D/)1:84;`SAH-4]V:17=V[&3U"K?*]]VEHQT./^W^?]OYM/N]4O$"
M6.G:"U!I8#P'=`.7>"VXHC-@:K$^0QJ&?T/VMD,O(EN6+QCQ+[RMKAMD=]+^W$+/?`Q5D*J`!B?&%
M)Q!/VI-QX487=L3+D5!DWP!UUTU$6H3=6;R6^8.-,4BRGGPVL\]I'P
M!+]^]POLT7LG7T55W-NSW7VIQ>+\:*5'*8X1)Q`$N-ZT*<;GC
M@5<@%BDG@K!8F6QAP@"Y+2UO-X]?%H,!M]J17SPEB&/I.;'#%0#BD\

Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows - PiGpio.zip (0/1)

2016-07-26 Thread Bo Berglund
On Sun, 24 Jul 2016 10:29:04 -0400, "James Richters"
 wrote:

>Bo, 
>I also have a raspberry pi project..  I got a hifi-berry card for it and it
>is streaming audio to a central audio system, I'm using VLC media player and
>an app on my cell phone to control it,  I have not made use of the GPIO on
>them yet, but I would really like to learn how this can be accomplished with
>FPC, since I am more familiar with pascal than any other language, it would
>be great to learn how to do this!  I have a particular application in mind.
>I have a relay board that will turn relays on and off with TTL level
>signals, what I wish to do is have a remote way to turn certain amplifiers
>on and off.   There are 24 amplifiers going to 44 speakers (4 are
>subwoffers) in and around my house, sometimes I'll want just downstairs and
>outside amps on, other times I'll want just one room on, or all amps on
>etc.The amps are all in my crawlspace under the first floor, and that's
>where the raspberry pi is.  I also have some volume control chips that are
>controlled by clocking data into them, I could chain them all together and
>be able to control all of them with just one clock and one data bit.   
>Any advice on how to get started on controlling GPIO with a raspberry pi
>with FPC would be greatly appreciated!
>

It has been discussed over at the Raspberry Pi forum. Basically the
solution is to use a modified version of teh PiGpio.pas driver.
Here are a few threads where I was involved:

https://www.raspberrypi.org/forums/viewtopic.php?p=826439#p826439

https://www.raspberrypi.org/forums/viewtopic.php?p=826888#p826888

I have attached a zipped version of the PiGpio.pas driver file for
you.


-- 
Bo Berglund
Developer in Sweden

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-24 Thread James Richters
Bo, 
I also have a raspberry pi project..  I got a hifi-berry card for it and it
is streaming audio to a central audio system, I'm using VLC media player and
an app on my cell phone to control it,  I have not made use of the GPIO on
them yet, but I would really like to learn how this can be accomplished with
FPC, since I am more familiar with pascal than any other language, it would
be great to learn how to do this!  I have a particular application in mind.
I have a relay board that will turn relays on and off with TTL level
signals, what I wish to do is have a remote way to turn certain amplifiers
on and off.   There are 24 amplifiers going to 44 speakers (4 are
subwoffers) in and around my house, sometimes I'll want just downstairs and
outside amps on, other times I'll want just one room on, or all amps on
etc.The amps are all in my crawlspace under the first floor, and that's
where the raspberry pi is.  I also have some volume control chips that are
controlled by clocking data into them, I could chain them all together and
be able to control all of them with just one clock and one data bit.   
Any advice on how to get started on controlling GPIO with a raspberry pi
with FPC would be greatly appreciated!

-Original Message-
From: fpc-pascal-boun...@lists.freepascal.org
[mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of Bo Berglund
Sent: Sunday, July 24, 2016 2:22 AM
To: fpc-pascal@lists.freepascal.org
Subject: Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

On Fri, 22 Jul 2016 14:19:20 +, Mark Morgan Lloyd
<markmll.fpc-pas...@telemetry.co.uk> wrote:

>Or go the whole hog and
>port the program onto a Raspberry Pi: Bo's doing something like you're 
>asking.

Yes, indeed! I now have something like 7-8 operational RPi units for
different purposes and in several places I have used the GPIO pins to
control and read back digital stuff from FPC programs. Very convenient.

Last I did was to attach a 4-way relay board to a RPi and put a smapp FPC
command line program on it, which gets called from a PHP script on the
Apache webserver on the Pi.
Now I have a webpage, with which I can switch on/off the relays with in
order to control the operational state of some measuring equipment sitting
half way across the workd!

You could do a LOT with FPC and a Raspberry Pi!

Examples:
The Pi also runs an OpenVPN server so I can access it with PuTTY and/or
TightVNC to program it if I need to.

My Pi also has a port mapping utility which makes it possible for me to
remotely access a WiFi network device on a WiFi access point close to the
RPi again from a long distance away. THis was created with FPC and Indy10 on
the RPi.


>Any of those have the advantage that the electronics can be positioned 
>to minimise the signal run carrying TTL. Long printer cables are 
>generally bad news.

15 cm wires to the relay board...


--
Bo Berglund
Developer in Sweden

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-24 Thread Bo Berglund
On Fri, 15 Jul 2016 14:59:10 -0700 (MST), Zaaphod
 wrote:

>I am trying to get access to the parallel port with Free Pascal.  
>
>I'm trying to use this version of inpout32 (x64)
>http://www.highrez.co.uk/downloads/inpout32/ 
>
>Here's my program:
>http://pastebin.com/facf6EFc
>
>Here's my Unit:
>http://pastebin.com/XR0aYUPR
>
>When I try to run it, I get a windows message The application was unable to
>start correctly (0xc07b). click ok to close the application.
>
>then  I get Exitcode 123 in the Free Pascal IDE.  123 is decimal of 7b.
>
>Does anyone know how to get this to work?   reading and writing the parallel
>port used to be so easy, now it's extremely confusing, thanks windows!

If I remember correctly the printer port was originally on the ISA
bus, which is no longer present on modern day PC:s.
On that bus the programs could simply address the port and read/write
data to say $378 (LPT1:).
I used that ages ago too.
But then it changed on both the PC hardwaere and in Windows (more
protection of the bits) and direct access stopped working.
I think you need another solution for the hardware.


-- 
Bo Berglund
Developer in Sweden

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-24 Thread Bo Berglund
On Fri, 22 Jul 2016 14:19:20 +, Mark Morgan Lloyd
 wrote:

>Or go the whole hog and 
>port the program onto a Raspberry Pi: Bo's doing something like you're 
>asking.

Yes, indeed! I now have something like 7-8 operational RPi units for
different purposes and in several places I have used the GPIO pins to
control and read back digital stuff from FPC programs. Very
convenient.

Last I did was to attach a 4-way relay board to a RPi and put a smapp
FPC command line program on it, which gets called from a PHP script on
the Apache webserver on the Pi.
Now I have a webpage, with which I can switch on/off the relays with
in order to control the operational state of some measuring equipment
sitting half way across the workd!

You could do a LOT with FPC and a Raspberry Pi!

Examples:
The Pi also runs an OpenVPN server so I can access it with PuTTY
and/or TightVNC to program it if I need to.

My Pi also has a port mapping utility which makes it possible for me
to remotely access a WiFi network device on a WiFi access point close
to the RPi again from a long distance away. THis was created with FPC
and Indy10 on the RPi.


>Any of those have the advantage that the electronics can be positioned 
>to minimise the signal run carrying TTL. Long printer cables are 
>generally bad news.

15 cm wires to the relay board...


-- 
Bo Berglund
Developer in Sweden

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-23 Thread James Richters
Thank you for getting me on the right track with this Marc,  I have it
working now!
Here is a link I found that explains it: 
http://www.freepascal.org/docs-html/ref/refsu72.html

I would have never thought of that!  

I posted the fixed program on github here if anyone is interested:
https://github.com/Zaaphod/FPC-Parallel-Port

I tested it the Inp32 and Out32 functions and they are now working!  
Thank you everyone very much for the help with this!

-Original Message-
From: fpc-pascal-boun...@lists.freepascal.org
[mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of Marc Santhoff
Sent: Saturday, July 23, 2016 1:09 AM
To: fpc-pascal@lists.freepascal.org
Subject: Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

On Sa, 2016-07-23 at 05:55 +0200, Marc Santhoff wrote:
> On Fr, 2016-07-22 at 18:20 -0400, James Richters wrote:
> > I'm trying to avoid custom hardware if possible.  I have always used
> > parallel ports and never had a problem with them until now.   I like the
> > idea of a parallel port because they are still built onto motherboards,
and
> > there are also a TON of USB to parallel port adapters out there.   I'm
> > trying to keep this simple.
> > 
> > I put a repository of my test program here:
> > https://github.com/Zaaphod/FPC-Parallel-Port.  Perhaps someone can see
what
> > I'm doing wrong.I'm reading 255s no matter what I do.I included
my
> > old turbo pascal test program.  I would normally specify the port in 
> > hex with a $ like this $378.  I could write to the port then read 
> > back what I just wrote.. which is what I am trying to do now.. I 
> > don't have anything hooked up to the port yet, I should be able to write
to it and read it back.
> > 
> > I seem to be accessing the DLL correctly, because I tried it on a 
> > windows 7 computer and  IsInpOutDriverOpen was false, because I 
> > forgot to install the driver, once I installed the driver 
> > IsInpOutDriverOpen is now true, so that tells me I'm accessing the DLL
and the DLL is confirming the driver is open.
> 
> >From what I know, although it may be a bit outdated, on windows 
> >external
> functions have to be declared 'cdecl'. Which isn't so in the library 
> port to pascal.
> 
> One example:
> 
>   implementation
>   Function IsInpOutDriverOpen; external 'inpout32.DLL';
> 
> would then be:
> 
>   implementation
>   Function IsInpOutDriverOpen; cdecl; external 'inpout32.DLL';

No, sorry. It has to be the other way round:

  Function IsInpOutDriverOpen; {$ifndef Win32}cdecl{$else}stdcall{$endif};
external 'inpout32.DLL';

I didn't recognize that it is  $ifndef, not $ifdef.

Marc


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-23 Thread James Richters
I get 
Error: Calling convection doesn't match forward
Error: Found Declaration: IsInpOutDriverOpen:Boolean;

Do I need to specify the functions differently in the interface section?
Thanks for the help


-Original Message-
From: fpc-pascal-boun...@lists.freepascal.org
[mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of Marc Santhoff
Sent: Saturday, July 23, 2016 1:09 AM
To: fpc-pascal@lists.freepascal.org
Subject: Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

On Sa, 2016-07-23 at 05:55 +0200, Marc Santhoff wrote:
> On Fr, 2016-07-22 at 18:20 -0400, James Richters wrote:
> > I'm trying to avoid custom hardware if possible.  I have always used
> > parallel ports and never had a problem with them until now.   I like the
> > idea of a parallel port because they are still built onto motherboards,
and
> > there are also a TON of USB to parallel port adapters out there.   I'm
> > trying to keep this simple.
> > 
> > I put a repository of my test program here:
> > https://github.com/Zaaphod/FPC-Parallel-Port.  Perhaps someone can see
what
> > I'm doing wrong.I'm reading 255s no matter what I do.I included
my
> > old turbo pascal test program.  I would normally specify the port in 
> > hex with a $ like this $378.  I could write to the port then read 
> > back what I just wrote.. which is what I am trying to do now.. I 
> > don't have anything hooked up to the port yet, I should be able to write
to it and read it back.
> > 
> > I seem to be accessing the DLL correctly, because I tried it on a 
> > windows 7 computer and  IsInpOutDriverOpen was false, because I 
> > forgot to install the driver, once I installed the driver 
> > IsInpOutDriverOpen is now true, so that tells me I'm accessing the DLL
and the DLL is confirming the driver is open.
> 
> >From what I know, although it may be a bit outdated, on windows 
> >external
> functions have to be declared 'cdecl'. Which isn't so in the library 
> port to pascal.
> 
> One example:
> 
>   implementation
>   Function IsInpOutDriverOpen; external 'inpout32.DLL';
> 
> would then be:
> 
>   implementation
>   Function IsInpOutDriverOpen; cdecl; external 'inpout32.DLL';

No, sorry. It has to be the other way round:

  Function IsInpOutDriverOpen; {$ifndef Win32}cdecl{$else}stdcall{$endif};
external 'inpout32.DLL';

I didn't recognize that it is  $ifndef, not $ifdef.

Marc


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-22 Thread Marc Santhoff
On Sa, 2016-07-23 at 05:55 +0200, Marc Santhoff wrote:
> On Fr, 2016-07-22 at 18:20 -0400, James Richters wrote:
> > I'm trying to avoid custom hardware if possible.  I have always used
> > parallel ports and never had a problem with them until now.   I like the
> > idea of a parallel port because they are still built onto motherboards, and
> > there are also a TON of USB to parallel port adapters out there.   I'm
> > trying to keep this simple.
> > 
> > I put a repository of my test program here:
> > https://github.com/Zaaphod/FPC-Parallel-Port.  Perhaps someone can see what
> > I'm doing wrong.I'm reading 255s no matter what I do.I included my
> > old turbo pascal test program.  I would normally specify the port in hex
> > with a $ like this $378.  I could write to the port then read back what I
> > just wrote.. which is what I am trying to do now.. I don't have anything
> > hooked up to the port yet, I should be able to write to it and read it back.
> > 
> > I seem to be accessing the DLL correctly, because I tried it on a windows 7
> > computer and  IsInpOutDriverOpen was false, because I forgot to install the
> > driver, once I installed the driver IsInpOutDriverOpen is now true, so that
> > tells me I'm accessing the DLL and the DLL is confirming the driver is open.
> 
> >From what I know, although it may be a bit outdated, on windows external
> functions have to be declared 'cdecl'. Which isn't so in the library
> port to pascal.
> 
> One example:
> 
>   implementation
>   Function IsInpOutDriverOpen; external 'inpout32.DLL';
> 
> would then be:
> 
>   implementation
>   Function IsInpOutDriverOpen; cdecl; external 'inpout32.DLL';

No, sorry. It has to be the other way round:

  Function IsInpOutDriverOpen; {$ifndef Win32}cdecl{$else}stdcall{$endif}; 
external 'inpout32.DLL';

I didn't recognize that it is  $ifndef, not $ifdef.

Marc


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-22 Thread Marc Santhoff
On Fr, 2016-07-22 at 18:20 -0400, James Richters wrote:
> I'm trying to avoid custom hardware if possible.  I have always used
> parallel ports and never had a problem with them until now.   I like the
> idea of a parallel port because they are still built onto motherboards, and
> there are also a TON of USB to parallel port adapters out there.   I'm
> trying to keep this simple.
> 
> I put a repository of my test program here:
> https://github.com/Zaaphod/FPC-Parallel-Port.  Perhaps someone can see what
> I'm doing wrong.I'm reading 255s no matter what I do.I included my
> old turbo pascal test program.  I would normally specify the port in hex
> with a $ like this $378.  I could write to the port then read back what I
> just wrote.. which is what I am trying to do now.. I don't have anything
> hooked up to the port yet, I should be able to write to it and read it back.
> 
> I seem to be accessing the DLL correctly, because I tried it on a windows 7
> computer and  IsInpOutDriverOpen was false, because I forgot to install the
> driver, once I installed the driver IsInpOutDriverOpen is now true, so that
> tells me I'm accessing the DLL and the DLL is confirming the driver is open.

>From what I know, although it may be a bit outdated, on windows external
functions have to be declared 'cdecl'. Which isn't so in the library
port to pascal.

One example:

  implementation
  Function IsInpOutDriverOpen; external 'inpout32.DLL';

would then be:

  implementation
  Function IsInpOutDriverOpen; cdecl; external 'inpout32.DLL';

HTH,
Marc


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-22 Thread James Richters
I'm trying to avoid custom hardware if possible.  I have always used
parallel ports and never had a problem with them until now.   I like the
idea of a parallel port because they are still built onto motherboards, and
there are also a TON of USB to parallel port adapters out there.   I'm
trying to keep this simple.

I put a repository of my test program here:
https://github.com/Zaaphod/FPC-Parallel-Port.  Perhaps someone can see what
I'm doing wrong.I'm reading 255s no matter what I do.I included my
old turbo pascal test program.  I would normally specify the port in hex
with a $ like this $378.  I could write to the port then read back what I
just wrote.. which is what I am trying to do now.. I don't have anything
hooked up to the port yet, I should be able to write to it and read it back.

I seem to be accessing the DLL correctly, because I tried it on a windows 7
computer and  IsInpOutDriverOpen was false, because I forgot to install the
driver, once I installed the driver IsInpOutDriverOpen is now true, so that
tells me I'm accessing the DLL and the DLL is confirming the driver is open.


-Original Message-
From: fpc-pascal-boun...@lists.freepascal.org
[mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of Mark Morgan
Lloyd
Sent: Friday, July 22, 2016 5:39 PM
To: fpc-pascal@lists.freepascal.org
Subject: Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

James Richters wrote:

I was rather rushed earlier for reasons that would probably amuse but would
be vastly OT (shoving sheep around Sussex since we're shearing Saturday...).

> I like the looks of that Velleman K8055,  that would do the job for me if
I
> can get it to work.   I would actually prefer a linux port of my program

The Velleman boards usually come as kits, but they use PTH components and
are a doddle to assemble. My recollection is that the K8055 came with
something crude that allowed you to interface from e.g. Visual Basic,
however I found that somebody had reverse-engineered it and produced a
library (?) for Linux... I can't remember whether this was C or Pascal. I
used this with Lazarus (the IDE and class library that sits on top of FPC)
to produce something similar to Velleman's own demo app, you'd obviously be
welcome to this.

However in the general case I think it would be worth bearing in mind that
functionality of the Velleman board could fairly easily be implemented using
appropriate firmware on an Arduino, and this is likely to be more "future
proof" than a demo kit. But I don't have any ready URLs etc.

> however I keep hitting a roadblock when I try to use the graph unit.  
> My program used the turbo pascal graph unit exclusively for it's user 
> interface and I'm trying to avoid re-writing the entire thing.  It 
> works fine in windows, but when I try to run it on linux I can't get 
> it to compile, it can't find the graph unit.  I may have some 
> directories set wrong or something, I'm not sure, but that's what's
holding me up on a linux port.

Can't comment on that, but I see Graham's lending a hand. Particularly if
you're porting to Linux you do need to consider whether you're planning to
run in the context of a GUI or over SSH etc, what /exactly/ are you trying
to display and on what sort of system?

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-22 Thread Mark Morgan Lloyd

James Richters wrote:

I was rather rushed earlier for reasons that would probably amuse but 
would be vastly OT (shoving sheep around Sussex since we're shearing 
Saturday...).



I like the looks of that Velleman K8055,  that would do the job for me if I
can get it to work.   I would actually prefer a linux port of my program


The Velleman boards usually come as kits, but they use PTH components 
and are a doddle to assemble. My recollection is that the K8055 came 
with something crude that allowed you to interface from e.g. Visual 
Basic, however I found that somebody had reverse-engineered it and 
produced a library (?) for Linux... I can't remember whether this was C 
or Pascal. I used this with Lazarus (the IDE and class library that sits 
on top of FPC) to produce something similar to Velleman's own demo app, 
you'd obviously be welcome to this.


However in the general case I think it would be worth bearing in mind 
that functionality of the Velleman board could fairly easily be 
implemented using appropriate firmware on an Arduino, and this is likely 
to be more "future proof" than a demo kit. But I don't have any ready 
URLs etc.



however I keep hitting a roadblock when I try to use the graph unit.  My
program used the turbo pascal graph unit exclusively for it's user interface
and I'm trying to avoid re-writing the entire thing.  It works fine in
windows, but when I try to run it on linux I can't get it to compile, it
can't find the graph unit.  I may have some directories set wrong or
something, I'm not sure, but that's what's holding me up on a linux port.


Can't comment on that, but I see Graham's lending a hand. Particularly 
if you're porting to Linux you do need to consider whether you're 
planning to run in the context of a GUI or over SSH etc, what /exactly/ 
are you trying to display and on what sort of system?


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-22 Thread James Richters
I like the looks of that Velleman K8055,  that would do the job for me if I
can get it to work.   I would actually prefer a linux port of my program
however I keep hitting a roadblock when I try to use the graph unit.  My
program used the turbo pascal graph unit exclusively for it's user interface
and I'm trying to avoid re-writing the entire thing.  It works fine in
windows, but when I try to run it on linux I can't get it to compile, it
can't find the graph unit.  I may have some directories set wrong or
something, I'm not sure, but that's what's holding me up on a linux port.


-Original Message-
From: fpc-pascal-boun...@lists.freepascal.org
[mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of Mark Morgan
Lloyd
Sent: Friday, July 22, 2016 10:19 AM
To: fpc-pascal@lists.freepascal.org
Subject: Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

James Richters wrote:
> What I need to do is be able to read some 5v TTL Inputs in and write 
> some 5v TTL outputs out.  The parallel port always worked when my 
> program was a DOS program.. it was so simple, just do Port[$378]:= data to
set the bits on the
> port  or data:=port[$378] to read some bits from the port.   I'm not
opposed
> to some hardware other than a parallel port if it will be able to
interface
> with freepascal easily, if anyone can make a recommendation.   Serial
ports
> won't work because they are not made to just read and write bits like 
> the parallel port and they are not TTL voltage levels.

Something like a Velleman K8055, which I've talked to using libusb on Linux.
Or an Arduino with appropriate firmware. Or go the whole hog and port the
program onto a Raspberry Pi: Bo's doing something like you're asking.

Any of those have the advantage that the electronics can be positioned to
minimise the signal run carrying TTL. Long printer cables are generally bad
news.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-22 Thread James Richters
Thank you!  I was indeed trying to use the 64bit DLL.. I mistakenly thought
you were supposed to use the version of the operating system, not the
program.

I have absolutely zero experience with windows programs.   I am able to run
my program now, but still not working exactly as I want it to work.. but I
think I might need to set my port to the right mode.. so I'll see if that
works.



-Original Message-
From: fpc-pascal-boun...@lists.freepascal.org
[mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of Marc Santhoff
Sent: Friday, July 22, 2016 10:56 AM
To: fpc-pascal@lists.freepascal.org
Subject: Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows
> > When I try to run it, I get a windows message The application was
> unable to
> > start correctly (0xc07b). click ok to close the application.
> 
> You could search Microsofts web site to decode this error. 

Or use a search engine:

http://www.techanges.com/fix-error-0xc7b/
http://stackoverflow.com/questions/10492037/the-application-was-unable-to-st
art-correctly-0xc07b

Looks like you are using a 32 Bit version on 64 bit or the like. The
original site tells about similar error:

http://www.highrez.co.uk/downloads/inpout32/

Look at the update history...


Marc

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-22 Thread Marc Santhoff
On Do, 2016-07-21 at 05:29 +0200, Marc Santhoff wrote:
> On Fr, 2016-07-15 at 14:59 -0700, Zaaphod wrote:
> > I am trying to get access to the parallel port with Free Pascal.  
> > 
> > I'm trying to use this version of inpout32 (x64)
> > http://www.highrez.co.uk/downloads/inpout32/ 
> > 
> > Here's my program:
> > http://pastebin.com/facf6EFc
> > 
> > Here's my Unit:
> > http://pastebin.com/XR0aYUPR
> > 
> > When I try to run it, I get a windows message The application was
> unable to
> > start correctly (0xc07b). click ok to close the application.
> 
> You could search Microsofts web site to decode this error. 

Or use a search engine:

http://www.techanges.com/fix-error-0xc7b/
http://stackoverflow.com/questions/10492037/the-application-was-unable-to-start-correctly-0xc07b

Looks like you are using a 32 Bit version on 64 bit or the like. The
original site tells about similar error:

http://www.highrez.co.uk/downloads/inpout32/

Look at the update history...


Marc

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-22 Thread Mark Morgan Lloyd

James Richters wrote:

What I need to do is be able to read some 5v TTL Inputs in and write some 5v
TTL outputs out.  The parallel port always worked when my program was a DOS
program.. it was so simple, just do Port[$378]:= data to set the bits on the
port  or data:=port[$378] to read some bits from the port.   I'm not opposed
to some hardware other than a parallel port if it will be able to interface
with freepascal easily, if anyone can make a recommendation.   Serial ports
won't work because they are not made to just read and write bits like the
parallel port and they are not TTL voltage levels.


Something like a Velleman K8055, which I've talked to using libusb on 
Linux. Or an Arduino with appropriate firmware. Or go the whole hog and 
port the program onto a Raspberry Pi: Bo's doing something like you're 
asking.


Any of those have the advantage that the electronics can be positioned 
to minimise the signal run carrying TTL. Long printer cables are 
generally bad news.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-22 Thread James Richters
What I need to do is be able to read some 5v TTL Inputs in and write some 5v
TTL outputs out.  The parallel port always worked when my program was a DOS
program.. it was so simple, just do Port[$378]:= data to set the bits on the
port  or data:=port[$378] to read some bits from the port.   I'm not opposed
to some hardware other than a parallel port if it will be able to interface
with freepascal easily, if anyone can make a recommendation.   Serial ports
won't work because they are not made to just read and write bits like the
parallel port and they are not TTL voltage levels.

-Original Message-
From: fpc-pascal-boun...@lists.freepascal.org
[mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of Marc Santhoff
Sent: Wednesday, July 20, 2016 11:29 PM
To: fpc-pascal@lists.freepascal.org
Subject: Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

On Fr, 2016-07-15 at 14:59 -0700, Zaaphod wrote:
> I am trying to get access to the parallel port with Free Pascal.  
> 
> I'm trying to use this version of inpout32 (x64) 
> http://www.highrez.co.uk/downloads/inpout32/
> 
> Here's my program:
> http://pastebin.com/facf6EFc
> 
> Here's my Unit:
> http://pastebin.com/XR0aYUPR
> 
> When I try to run it, I get a windows message The application was 
> unable to start correctly (0xc07b). click ok to close the application.

You could search Microsofts web site to decode this error.

> then  I get Exitcode 123 in the Free Pascal IDE.  123 is decimal of 7b.
> 
> Does anyone know how to get this to work?   reading and writing the
parallel
> port used to be so easy, now it's extremely confusing, thanks windows!

Didn't test, but as a remark: parallel port is dead and it has been a
constant source of problems. First the access rights problems you know of.
Second it has no fixed timing, so you're in trouble when e.g.
flashing a microcontroller works on one machine and refuses to on another
one. Third it is not electrically protected, if you fry it, the mainboard is
dead by chance or you have to insert an extension board - which is hard to
find nowadays, too.

Depending on your needs I'd suggest using a USB-to-serial-Adapter or
similar. They are cheap and well supported (e.g. using CP2102). As an
alternative FTDI has some nice USB-to-anything (including parallel) chips
and they sell modules with mil spacing pins for easy breadboarding.

HTH somehow,
Marc


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-21 Thread Marc Santhoff
On Do, 2016-07-21 at 08:39 -0500, Paul Breneman wrote:

> You can do *everything* via USB. :) I joked about this several years ago 
> but then went searching and found USB to ISA slot and USB to PCI slot 
> adapters.  Folks use these to run expensive data acquisition cards.

https://www.youtube.com/watch?v=MoREmn7SCwg ?

CNR,
Marc


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-21 Thread Paul Breneman

On 07/20/2016 10:29 PM, Marc Santhoff wrote:
...

Depending on your needs I'd suggest using a USB-to-serial-Adapter or
similar. They are cheap and well supported (e.g. using CP2102). As an
alternative FTDI has some nice USB-to-anything (including parallel)
chips and they sell modules with mil spacing pins for easy
breadboarding.


You can do *everything* via USB. :) I joked about this several years ago 
but then went searching and found USB to ISA slot and USB to PCI slot 
adapters.  Folks use these to run expensive data acquisition cards.


Regards,
Paul
www.ControlPascal.com

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows

2016-07-20 Thread Marc Santhoff
On Fr, 2016-07-15 at 14:59 -0700, Zaaphod wrote:
> I am trying to get access to the parallel port with Free Pascal.  
> 
> I'm trying to use this version of inpout32 (x64)
> http://www.highrez.co.uk/downloads/inpout32/ 
> 
> Here's my program:
> http://pastebin.com/facf6EFc
> 
> Here's my Unit:
> http://pastebin.com/XR0aYUPR
> 
> When I try to run it, I get a windows message The application was unable to
> start correctly (0xc07b). click ok to close the application.

You could search Microsofts web site to decode this error.

> then  I get Exitcode 123 in the Free Pascal IDE.  123 is decimal of 7b.
> 
> Does anyone know how to get this to work?   reading and writing the parallel
> port used to be so easy, now it's extremely confusing, thanks windows!

Didn't test, but as a remark: parallel port is dead and it has been a
constant source of problems. First the access rights problems you know
of. Second it has no fixed timing, so you're in trouble when e.g.
flashing a microcontroller works on one machine and refuses to on
another one. Third it is not electrically protected, if you fry it, the
mainboard is dead by chance or you have to insert an extension board -
which is hard to find nowadays, too.

Depending on your needs I'd suggest using a USB-to-serial-Adapter or
similar. They are cheap and well supported (e.g. using CP2102). As an
alternative FTDI has some nice USB-to-anything (including parallel)
chips and they sell modules with mil spacing pins for easy
breadboarding.

HTH somehow,
Marc


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal