[fpc-pascal] Re: Accessing USB HID from Lazarus programs?

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Mon Mar 21 09:55:44 CET 2011

Bo Berglund wrote:
> I posted this on the lazarus list but they suggested to send it to the
> FPC list instead in order to possibly get better answers...
> On Sun, 20 Mar 2011 10:04:28 -0500, Bo Berglund
> <bo.berglund at gmail.com> wrote:
>> I need to create a program using Lazarus/FPC to access a data
>> collection device built using a PIC24F series microprocessor with
>> built-in USB support. The firmware makes the PIC processor register as
>> a Human Interface Device (HID) class USB device.
>> I understand that for the HID class one does not have to provide a USB
>> driver, there is already a generic one on Windows and possibly also on
>> Linux.
>> And the HID interface is not limited to mice and such, for example the
>> PicKit3 PIC programmer and ICE uses the HID driver and it can both
>> program code into PIC:s and execute PIC code with breakpoints from
>> within MPLAB (the PIC develeopment IDE).
>> My objective is to read the data from the data collection device using
>> the USB interface and display the data on screen and also save to the
>> PC disk.
>> My FPC program should be able to run on Windows and preferably also on
>> Linux.
>> But I can't find any good examples on how to access the USB HID
>> device....
>> Can someone here please provide some help, links to code examples or
>> similar?

I'm accessing a Velleman K8055, which I think fits your description, 
using libusb etc. I used Uwe Zimmerman's port of libusb 
http://wiki.lazarus.freepascal.org/Hardware_Access#USB with very minor 
changes, I used some C sources as examples but can't remember which- 
possibly http://libk8055.sourceforge.net/

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

[Opinions above are the author's, not those of his employers or colleagues]

More information about the fpc-pascal mailing list