Recent

Author Topic: USB-HID with microcontroller  (Read 739 times)

Erni

  • New Member
  • *
  • Posts: 15
USB-HID with microcontroller
« on: November 11, 2019, 09:53:18 am »
Hello!
I'm absolutely new to USB-Programming. My microcontroller
is a PIC 16F1459 with Oshonsoft-Basic. It switches a LED
on or off by receiving a '1' or '0' via USB-HID, for test.
This works with a Demo-Software (Windows 7).
But how can I communicate with this microcontroller (sending
and receiving data) with Lazarus and this FPC-USB-HID Library
(https://github.com/LongDirtyAnimAlf/FPC-USB-HID)?
I think, I need something like "SetFeatureReport" and
"GetFeatureReport". How is this todo with the example in the
library? NewUSB.SetFeatureReport(data,size) is not working.

Thanks!
Erni

MarkMLl

  • Hero Member
  • *****
  • Posts: 1101
Re: USB-HID with microcontroller
« Reply #1 on: November 11, 2019, 10:38:47 am »
When you say "not working", what exactly happens? I've talked to various HID devices but only on Linux and in most cases using low-level operating system calls.

Do you have the source of the demo program?
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1324
Re: USB-HID with microcontroller
« Reply #2 on: November 11, 2019, 10:56:19 am »
Author here.
For linux, FeatureReport is not (yet) implemented !

Erni

  • New Member
  • *
  • Posts: 15
Re: USB-HID with microcontroller
« Reply #3 on: November 11, 2019, 11:25:56 am »
Thanks for help!
Yes, with "not working" I mean, that it is not implemented, sorry.
I tried Delphi 7 and JvHidController, using "SetOutputReport (data,size)"
and it works. But how is it done with this FPC-HID-LAZ Library?
This Library is designed for microcontrollers, so it should be ideal
for me, but I'm very stupid.
Erni

Erni

  • New Member
  • *
  • Posts: 15
Re: USB-HID with microcontroller
« Reply #4 on: November 11, 2019, 11:32:27 am »
Correction:

But how is it done with this FPC-USB-HID Library?

MarkMLl

  • Hero Member
  • *****
  • Posts: 1101
Re: USB-HID with microcontroller
« Reply #5 on: November 11, 2019, 11:50:38 am »
So what operating system are you using?
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

Erni

  • New Member
  • *
  • Posts: 15
Re: USB-HID with microcontroller
« Reply #6 on: November 11, 2019, 11:58:53 am »
I'm using Windows 7

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1324
Re: USB-HID with microcontroller
« Reply #7 on: November 11, 2019, 12:01:18 pm »
Well, on Windows, the library uses JvHidController !!
So, you need to give me more info about "not-working".

Erni

  • New Member
  • *
  • Posts: 15
Re: USB-HID with microcontroller
« Reply #8 on: November 11, 2019, 12:08:06 pm »
Hello DonAlfredo,
I'm sure, that your library is OK.
But I cannot find the right syntax to do something like "SetOutputReport",
I get compiler-errors.
Can you give me a short hint, how to write this command?
Sorry for my bad english.

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1324
Re: USB-HID with microcontroller
« Reply #9 on: November 11, 2019, 12:10:20 pm »
You seem to have working Delphi 7 code.
Send it to me and I will have a look.
Without code, I have to use my imagination, and I am not good at that ... ;-)

Erni

  • New Member
  • *
  • Posts: 15
Re: USB-HID with microcontroller
« Reply #10 on: November 11, 2019, 12:23:51 pm »
I'm now not at my Work-PC, but with Delphi-7 it was
dev.SetOutputReport(databuffer,size) and i thought
that i could easily convert it to NewUSB.SetOutputReport
in your example in the lib. But this gave me a compiler-
error. I think, i have to learn more about programming
and the problem is on my side.
Bye!
Erni

 

TinyPortal © 2005-2018