Link to home
Start Free TrialLog in
Avatar of MelissaCandyGirl
MelissaCandyGirl

asked on

SERIAL PORTS AND DELPHI

Example: My company has a machine that sends the registration of customers through the serial port to the computer, how do I get this data and insert them in 1 memo of my program before they go to the computer? is still necessary that they go to the computer to be stored in 2 places in the memo and the computer.
Avatar of twocandles
twocandles

Do you mean you have 2 different apps? If so, you won't be able to read the serial port from 2 apps, since the 2nd one that tries to open the serial port will get an error ("port already open" or "cannot open file"). If you want to display the data as it comes in, you will have to write 1 application for both write to memo and store it wherever you want.
Avatar of MelissaCandyGirl

ASKER

no. since the data comes from the serial port, my program that I am trying to open the door and get the data, then he closes the door. and here the company's other program opens the door again and get the data.
But then the data needs to be sent twice in order to be read by two apps at two different times...

Or you can write the data back to the port. At my company we're using a similar approach: we have a cable that connects COM1 and COM2 on the same machine in cross-mode. You can write to COM2 and read from COM1 using the same computer.
Finally...  how do I get this data and insert them in 1 memo of my program?
how do I get this data and insert them in 1 memo of my program before they go to the computer? is still necessary that they go to the computer to be stored in 2 places in the memo and the computer.
This sounds like you are trying to intercept the data so that you can display it in a field on a form in your application but you still want the data to wind up "at the computer".
Where is the data when it is "at the computer"?  Do you mean that it is being put in a database or what?  Also, the term "memo field" sounds like you may be used to working with MS Access . . . Are you saying that you want to write this to a text field that has multiple lines?  If so, do you want each received piece of data to be written on a separate line?
Are you having trouble reading the serial port?
If you can answer these questions I can probably help you.  I've worked with serial communications in Delphi.
Greetings 8080_Diver, data is sent by the computer through the serial port, has an automated program that already handle such data and do the work that has been programmed for you, if a register.
my problem is, we assume that I get this program, do not use it more, then I want my program, which will take the data by serial port and put in a memo, but this is just one example that I taking these data at 1 memo I can do what you want then, records and more.
I know nothing about serial ports and read the data that pass through it, so I wanted this basic example.
I know nothing about serial ports
Now, that is going to be a problem.  Dealing with serial ports is not as simple as dropping a TADOCONNECTION and a TADOQUERY component on a DataModule and setting the aprameters and then off you go.  There are several factors to consider when working with serial ports, things like:
  • Is there a carrier signal (i.e. is the port connected to anything)?
  • Time outs,
  • Is there data available at the port?
  • Getting the data before it gets over written;
  • Do you need to send an acknowledgement?
  • What do you do if the data is garbages (i.e. do you send a NACK instead of an ACK)?
And that is just to mention a few of the points.  No offense intended but this is definitely not for the novice or the faint of heart!
There is a set of components that I use for this purpose and I have a manual that is something like 1200 pages for them.  The components are now available for free (that's the Good News) and you can probably find them by searching for their comercial name of  "Asynch Pro".  The Bad News is, as I mentioned, the manual I have is rather thick and the components, while wonderful for working with serial ports, are more than a bit complicated . . . and they are the best ones I know of.
8080_Diver, thanks dear, I'll download the manual and study.
Finally, you can make an example of the code of practice and get the data from the serial port and all go to a memo?
can be in any way with any parameter, and any point on your preference, just to have me as an example study.
Avatar of MerijnB
To be honest, I think 8080_Diver gives a little over complicated point of view of things.

MelissaCandy: what do you know about the data which is sent out of the serial port, the protocol?
ASKER CERTIFIED SOLUTION
Avatar of 8080_Diver
8080_Diver
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks dear