Data receiver application: the function of this application is as serial data receiver from serial port such as COM1. COM2, COM3, etc.
1. Enter the component as follows, The following is component that is used:
No | Component | Property | Value |
1 | Form 1 | Caption | Read Data Serial |
2 | Groupbox1 | Name | Read Data Serial |
3 | Button1 | Caption | Clear |
4 | Button2 | Caption | Connect |
5 | Button3 | Caption | Set Serial |
6 | Button4 | Caption | Close |
7 | Label1 | Caption | Received data |
8 | ComPort1 | - | - |
9 | Memo1 | Lines | - |
Figure. Serial Communication Between 2 Personal Computer On Borland Delphi 7 Using Comport Component : Received Serial Data:Visualization of receive data serial application design
Declare a global variable named datain
Figure . declare global variable named datain
type source code as follows
No | Component | Event | Source Code |
1 | Button1 | OnClick | memo1.Text:=''; |
2 | Button2 | OnClick | ComPort1.Open; |
3 | Button3 | OnClick | ComPort1.ShowSetupDialog; |
4 | Button4 | OnClick | application.Terminate; |
5 | Form1 | OnCloseQuery atau dapat juga OnDestroy | comport1.Close; |
6 | comport1 | OnRxChar | ComPort1.ReadStr(datain,count); memo1.Text:= memo1.Text + ' '+datain +' '; |
The following is the result of Screen Shoot when application is used
Figure. Serial Communication Between 2 Personal Computer On Borland Delphi 7 Using Comport Component : Received Serial Data : Visualization of receive data serial application
I hope this article can give benefit to the visitors, readers, developer and me. Thanks for visiting and availability for sharing this article by pressing Share this on Facebook |