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

Koenraad Lelong fpascal1 at de-brouwerij.be
Tue Jul 26 11:45:51 CEST 2016

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-bounces at lists.freepascal.org
> [mailto:fpc-pascal-bounces at lists.freepascal.org] On Behalf Of Bo Berglund
> Sent: Sunday, July 24, 2016 2:22 AM
> To: fpc-pascal at lists.freepascal.org
> Subject: Re: [fpc-pascal] Parallel Port Access with Free Pascal - windows
> On Fri, 22 Jul 2016 14:19:20 +0000, Mark Morgan Lloyd
> <markMLl.fpc-pascal at 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 

FWIW, I ported the library to fpc, together with the test/demo software 
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.


More information about the fpc-pascal mailing list