![Delphi Delphi](/uploads/1/2/5/4/125488037/832289336.jpg)
![Port Port](/uploads/1/2/5/4/125488037/421147752.jpg)
Actually, standard serial comports are still being used by vast quantities of newly manufactured items such as weighing machines, bar code scanners, modems, satellite boxes, GPS, test equipment, medical systems, scientific instruments etc. Etc, some of which use RS485/Rs232. Other serial port systems such as USB are very complicated in their operation and extremely fragile in an industrial environment.
I can understand a serial port down to the register level inside the chip. I would have to spend a lot of time to get that acquainted with USB!!! I've tackled this problem by detection a couple of times before. USB to serial convertors almost always get a 'high' comport number allocated ( 4).
So enumerate the comports (TComport can do this) and start with the highest port going down. You will need (like you mentioned) do detect whether either device (scale or printer) is attached to a comport, my gut feeling is that the scale is easy, but the printer might pose a problem. Do you have full documentation on the protocol used for both devices?
Delphi 7 Component that implements DF1 Procotol which is use by Micrologix and SLC 500 from Allen Bradley, I don't have to say that this is the Component that I use most and make me won more money. Nov 19, 2011 - is a freeware tool we've used with great success for many years.