![jumpstorydownload20200403000238 | Embarcadero RAD Studio Delphi C++Builder Blogs](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2020/08/jumpstory-download20200403-000238.jpg?resize=1140%2C694&ssl=1)
Serial Communications is a core communication between PC and peripheral devices Such as a programmable instrument or another computer. Do you feel challenged or tired in writing code to communicate with serial devices from your Delphi/C++ applications? How about Siemens protocols such as 3964 and 3964R? Don’t worry, WINSOFT offers us easy and robust components to do the job with better user control.
Features:
- Communication with devices connected to a serial port or using a virtual serial port.
- Easy way to control your device communication.
- Offers a wide range of communication properties and flow control options.
- Flexible to open, close, read-write events to a log file.
- Uses multithreaded and overlapping for maximum performance.
- On/Off color indication for associated com signal control.
- Can Send and Receive data using 3964/3964R communication protocols.
Versions Supported: Delphi 5 – Delphi 10.4/C++ and Lazarus 2.0.10
Platforms: Windows;
Installation Steps:
Prerequisites: Ensure 10.4 MB minimum free space available in the system.
- Download Protsuite Setup and Right-click Open.
- Read the Information Window about features, installation, and copyright. Click Next.
- Browse for the custom destination folder to install and click Next.
- Browse for the custom Start Menu folder and click Next. You can ignore creating by clicking the checkbox Don’t create a Start Menu folder option.
- Review your folder settings and click Install. You can click Back to change your folder settings.
- Once Installation Progress is done click Finish.
- Ensure the Communication Protocol Suite files are shown in the chosen Start Menu Folder by clicking Windows Start Menu.
Installation Steps Demo:
Key Serial Communication concepts:
RS232 Serial Communications is a communication of bits that sends and receives data between PC ( Data Terminal Equipment DTE) to remote Device or another PC (Data Communications Equipment DCE).
Request To Send (RTS) Outgoing flow control signal controlled by DTE. Clear To Send (CTS) Incoming flow control signal controlled by DCE. Data Set Ready (DSR) Incoming handshaking signal controlled by DCE. Data Terminal Ready (DTR) Outgoing handshaking signal controlled by DTE.Carrier Detect (CD) Incoming signal from a modem. Ring Indicator (RI) Incoming signal from a modem. More details: Serial Intro.
How to build applications using ProtSuite components:
1. Open Rad Studio 10.4.1 and Create a Windows VCL Application. Navigate to Components bar -> System. Check the ProtSuite Components installed as shown.
2. Drag and Drop the TComPort,TComSignal, and TProt3964R component or by adding Comport, Comsignal, Prot3964R.pas into your unit and create these components by code.
TComPort: Enables to communicate with devices connected to serial port.
![Comportproperties | Embarcadero RAD Studio Delphi C++Builder Blogs](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2020/10/Comportproperties.png?resize=309%2C376&ssl=1)
- BaudRate: At which communication device operates.
- BufferSizes: Device internal Input/Outbuffer size in bytes:
- Characters: Special Communication characters.
- Databits: Number of bits in bytes transmitted and received.
- DeviceName: Communication Device name.
- FlowControl: Specifies DTS,RTS and XOn/XOff flow control
- LogFile: Open, Close, read, write operations, and communication events are written to a log file.
- ModemStatus: To determine modem status OnCTSChange, OnDSRChange, OnRLSDChange Events.
- Parity: Parity scheme used by communication e.g) even, odd, etc
- ThreadPriority: Priority of communication thread.
- Timeouts: Communication Timeouts in milliseconds.
3. Retrieve comport devices in PC. ComPort.EnumComDevicesFromRegistry(ComboBoxDeviceName.Items); // tstrings parama lists comport devices.
4. Shows Comport Config Dialog. ComPort.ConfigDialog;// A dialog to preconfigure device settings like baud rate etc.
5. Shows the Device info by Device Name.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
var DeviceInfo: TDeviceInfo; Info: string; begin if ComPort.DeviceInfo(ComPort.DeviceName, DeviceInfo) then with DeviceInfo do Info := 'Description: ' + Description + NewLine + 'Device: ' + Device + NewLine + 'Device name: ' + DeviceName + NewLine + 'Driver: ' + Driver + NewLine + 'Driver provider: ' + DriverProvider + NewLine + 'Driver version: ' + DriverVersion + NewLine + 'Enumerator name: ' + EnumeratorName + NewLine + 'Friendly name: ' + FriendlyName + NewLine + 'Instance: ' + Instance + NewLine + 'Location: ' + Location + NewLine + 'Manufacturer: ' + Manufacturer + NewLine + 'Physical name: ' + PhysicalName + NewLine + 'Reported description: ' + ReportedDescription + NewLine + 'Service: ' + Service else Info := 'No info available'; ShowMessage(StringReplace(Info, '&', '&&', [rfReplaceAll])); end; |
6. Opens or closes the comport.
1 2 3 4 |
procedure TFormComPort.SpeedButtonOpenCloseClick(Sender: TObject); begin ComPort.Active := not ComPort.Active; end; |
7.Use comport SetRTS,ClearRTS,SetDTR,ClearDTR routines for respective operations.
1 2 3 4 |
ComPort.SetRTS; // Sets Hardware Flow control. ComPort.ClearRTS;// Clears RTS (Request To Send) line. ComPort.SetDTR; // Set Device is ready connected and turned on. ComPort.ClearDTR;// Clears DTR (Data Terminal Ready) line. |
8.Use Comport events for better handling of the data transmission/receiving which includes OnError.
TComSignal: To visually indicate, using specified colors, the status of the communicating signal.
![Comsignal | Embarcadero RAD Studio Delphi C++Builder Blogs](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2020/10/Comsignal.png?resize=352%2C277&ssl=1)
- ColorOff/On – Color of control component when selected signal off/on
- Comport: Comport used for serial Communication.
- Control: Associated visual control to indicate.
- Delay: Minimal time the signal is indicated as on.
- Signal: Signal to be indicated.
- SignalValue:Value of the selected signal.
9. Use OnSignal to change color of the associated control based on signal value.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
procedure TFormComPort.ComSignalCTSSignal(Sender: TObject); begin if ComSignalCTS.SignalValue then begin PanelCTSLed.Color := ComSignalCTS.ColorOn; PanelCTSLed.Font.Color := clBlack; end else begin PanelCTSLed.Color := ComSignalCTS.ColorOff; PanelCTSLed.Font.Color := clWhite; end end; |
TProt3964R: Enables to send and receive data using 3964/3964R communictaion protocols.
![prot3964R | Embarcadero RAD Studio Delphi C++Builder Blogs](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2020/10/prot3964R.png?resize=341%2C289&ssl=1)
- AcknowledgementTimeout: Max time permitted to partners acknowledgment to arrive during setup or release.
- BlockCheck: Whether Block Check Character is used.
- BlockTimeout: Maximum delay for repeated device data attempt.
- Comport: Comport used for serial communication.
- Priority: Behaviour when simultaneous send request occurs.
- Recieve/SendRetry: Send/Recieve attempts before error reported.
10. Send data using this protocol.
1 2 3 4 |
procedure TFormComPort.SpeedButtonSendClick(Sender: TObject); begin Prot3964R.Send(Edit.Text); end; |
11. For receiving data,
1 2 3 4 5 |
procedure TFormComPort.Prot3964RDataReceived(Sender: TObject; const Data: AnsiString); begin Memo.SelText := 'Recieved:' + 'Hello' + NewLine; end; |
Sample Application Demo:
Conclusion: Just 11 steps, you can communicate with comport devices using 3964R protocol from your applications. WINSOFT made these components to make developer life easy and you can save your time and effort.
In our picks for your next read, we have the C++ bit set ready to help you increase productivity in programming with its modern features.
Check out the full WINSOFT Communication Protocol Suite for Access in Delphi and C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition