Using Delphi Components for Serial Communication

CPort is a Delphi component created by Dejan Crnila. it provide interfaces for Delphi programmers to use the serial communication ports. If you need to utilize serial modem or any other serial communication devices in your Delphi application, you should use this component.

It’s obviously doesn’t take much to install and use a modem however this will depend on the purpose.  However like anything you can understand how it works then it can help when developing code which needs to interface with the device.

Although a modem is often just thought of as a method for connecting to the internet, there is much more to the device and it’s applications, A modem actually converts digital to analog and the opposite way to.  Remember all telephone main lines are mostly digital however the lines to most US houses are usually analog.  This means that it they are designed to transmit, a voltage wave which is an exact replica of the sound wave coming from human speech.  This voltage wave is called an analog wave.

The serial post or UART serial port as it’s correctly known is an input/output device.  Why is this important? Well because the modem has a serial port communicating between them and the computer, your code will need to traverse this connection in order to make it work.

Dealing with serial devices is in some ways m,ore complicated than standard network programming.  Being able to send commands however to such a device vastly increases the potential of your code to facilitate communication between different devices.   So for example it can be especially useful in the modern world of relaying proxy servers and IP addresses through different devices.  Take for instance the use of a residential IP provider who needs to use normal home IP addresses to create a pool of IP addresses.

The AT-CMD Tester and many Delphi applications that need an access to the serial ports use this component as the interface to it. One of them is the miniSMS – a program to read SMS on a cellphone message inbox via PC serial port.
It’s a little bit complex for me when I use this component for the first time since I don’t know much about serial communication programming. But when I get used to it, I can see that It’s a good one.

Installing CPort Delphi Component
Remove all previously installed files of ComPort Library (TComPort component).
Extract Sources zip file into Delphi Lib folder.

Use “File/Open” menu item in Delphi IDE to open ComPort run-time package source file (Delphi6: CPortLib6.dpk; Delphi7: CPortLib7.dpk).
Click “Compile” button in Package window to compile the library.
Now you have to install design-time package. Use File/Open menu item to open design-time package source file (Delphi6: DsgnCPort6.dpk; Delphi7: DsgnCPort7.dpk). Click “Compile” button in Package window to compile the package.

Click “Install” button to register ComPort into the IDE. ComPort components appear in “CPortLib” page of component pallete.

If you are new to CPort, you can click here to get an example and a brief explanation about using CPort component to read data from your cellular phone.

More on Proxies Here –


Leave a Reply