News:

;) This forum is the property of Proton software developers

Main Menu

Delphi & Serial

Started by JonW, Sep 25, 2021, 09:43 AM

Previous topic - Next topic

JonW

Now and again I need to write Gui to support some of the test hardware for mass production and have been using Xojo as it cross compiles onto Linix and even the RPI which we use on some some occasions as its cheap to implement in Asia.

I see that quite a few guys on here are using Delphi, so have downloaded the community edition to have a mess around with but delphi doesn't natively ship with any serial controls which I find a little odd.

Rather than troll through all the ones online, what do you guys use and do you have any example projects that i can take a look at

Cheers

Jon

John Drew

I downloaded a component years ago and used it on a couple of projects. I'll have a look tomorrow, I paid a modest amount.
John

JohnB

JohnB

JonW

#3
Cheers John
Is this easy to use?  If you guys are using it TcomPort then at least I have some support.   I took a quick look at NCOMM trial version too and some guys are using the CDC ports with this on ST M0.
Never used Delphi but it looks fairly straight forward.  I used to use VB and then needed to code a Gui really quickly on site so opted for Xojo is ok but it has its limitations and the serial can be a bit flaky with multiple instances running concurrently.  In some instances we need 16 ports to keep up with the production rate

J

John Drew

#4
G'day  Jon.
I used TComport by Dejan Crnila in projects. I think it may be free. It is available on sourceforge.net
The last time I compiled for serial port it was with an older version of Delphi. I haven't reinstalled the component on Delphi XE5 which is my current Delphi version.
I haven't bothered with updating as I can do everything I need on XE5.
If you want I can send you the source code for a project that uses tComport. I have used other tComport components in the past but found Dejan's worked fine.
John

PS
Another one I've used is ZYLserialport

top204

#5
I've always used the "old fashioned" direct method of opening a file to a com stream, then treating the com data as a file import and export. :-) If events are required for the data, they can be added. However, I often use a timer that looks at the com port so that the data being input is addedd to a serial buffer array, and vice-versa. Then a flag is raised to say that there is data from a com port, or sometimes that, what was being looked for has arrived in full and is correct. This can also be used to examine the registry and see if the com has been disconnected, and this sometimes helps stop windows from locking the com port with a serial timeout.

This is how most of the components work, but they often make it more difficult to do simple tasks because they use events for everything, and with the timer method, multi-tasking from the program itself is not required because the Operating System's tasker does the work for you, and the timers will always capture/transmit whatever is there because the virtual com ports have built-in buffers as well as standard.

JonW

Thanks Guys.  Lots of things to try.
Any examples would be great.  Email Jon@mwave-ltd.com

Les, how do you open the port?

Cheers

J

atomix

#7
here is a small code on VB6 for example.