• Welcome to Proton BASIC Community. Please login or sign up.
 
Oct 18, 2021, 03:30 AM

News:

Let's find out together what makes a PIC Tick!


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

Sep 25, 2021, 03:10 PM #3 Last Edit: Sep 25, 2021, 03:16 PM by JONW
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

Sep 26, 2021, 02:41 AM #4 Last Edit: Sep 26, 2021, 04:43 AM by John Drew
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

Sep 26, 2021, 11:07 AM #5 Last Edit: Sep 26, 2021, 11:11 AM by top204
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