View Full Version : Byte lost?

14th March 2012, 23:54
Hi y'all,
When sending a string to a PIC18F4550(TM) in HID configuration I seem to lose byte 0.
I'm using EasyHid and generated code for the uC and Delphi.
I have two listboxes in my Delphi(7) program showing both input- and outputbuffers.
Byte0 in the inputbuffer in the uC equals to byte1 the Delphi program sent.
Normally, byte0 should hold the report number.

I'm using

Anyone got any clues?

15th March 2012, 10:34
From memory the first byte is either lost or gained. We just account for it doing one or the other. What ever you are finding its sounds normal

15th March 2012, 10:40
As you know, byte 0 is reserved for the "report ID" in HID. I don't think EasyHID allows you to use this byte as general purpose data, so it strips it out.

In this case you must either use some different USB code on the device, or just start at byte 1. Typically if using HID you ignore byte 0 as this kind of thing always happens.

15th March 2012, 10:44
One thing to test with EasyHid Delphi code is that it cause an exception if you remove the USB device while the code is running.

15th March 2012, 13:00
@Tim: I can unplug and replug the device while the code is running, no problem whatsoever.
@wastrix: yes I know it's the report ID. But why would it be stripped out. EasyHid generates the descriptor include and Proton code which contains USBPoll, USBIn and USBOut (and of course the Delphi code). It doesn't do anything else.