Author Topic: HID in a service  (Read 1066 times)


  • Newbie
  • *
  • Posts: 15
    • View Profile
HID in a service
« on: February 01, 2012, 05:18:55 am »
Hello everyone!

We are considering the nrComm library for use in a project / instrument were six Mettler Toledo scales will be used to keep track of bulk fluid usage by the instrument.  The primary instrument control software is written in Delphi and has been for close to 8 years.  The Mettler scales will be the first USB HID devices we've had to connect to.

As always our customer strongly prefers not to be locked in to a single path/technology in as much as possible.   So the Mettler scales will be read and managed by a service application also written in Delphi. The primary instrument control software will connect to the service and retrieve scale data.  This will remove the need to V&V the primary control software should the scale solution change in the future.

In USB mode the Mettler scales present themselves as HID devices.  I can see them enumerated in Device Manager and see the scale serial numbers which is a good thing because we would like to use the serial numbers to ID the correct scale for each bulk fluid.

I've downloaded the trial version of nrComm and plan to try a few tests however before I spend too much time I wanted to find out if there were any limitations that would prevent the nrComm HID routines from working within a threaded service application.

In our current invocation of the scale service application the scales are interfaced using RS-232.  The desire is to move to USB since it will eliminate a bunch of power cabling to each scale and the plug/play features of USB will allow us to react to scales that fail a little better than a COM port would.  A powered USB hub would be used to provide power to the scales.

In our current version of the service app each scale gets its own state machine thread.   This would be how we would like to implement using USB.  Each scale detected would attach to a thread which would continuously query the scale and read back the weight data.

So my two basic questions are:

1) Any issues with nrComm and HID components in a service application?

2) Any issues with nrComm and HID in threads (within the service app)?

Thanks in advance!

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1017
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: HID in a service
« Reply #1 on: February 01, 2012, 05:11:36 pm »

Thank you for your interest in our product and for your detail information.

You can try to start from HIDDemo that you can find after nrComm Lib installation.

Please note that HID device is significant different from RS232 technology.
HID device operates the HID reports for I/O operations.

Now regarding your questions:

1) TnrHid component can be used in service win application. You can create it at runtime and should NOT use visual controls.
2) Component creates its own thread more monitor incoming data. You need to set TnrHID.UseMainThread property into false. It prevents waiting main window thread (ordinary for updating visual controls in gui apps).

Roman Novgorodov
DeepSoftware LLC
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.


  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: HID in a service
« Reply #2 on: February 01, 2012, 11:43:33 pm »
Thank you Roman.

I've posted a new question in this forum.  Please look for it.