This paper introduces the communication between the host computer and Panasonic FPG-C24R2 PLC by introducing ActiveX control MSComm and programming with C # language, and gives the engineering example. The method is simple, reliable, easy to transplant, and has a wide application in industrial control.
Key words: C # serial communication real-time monitoring ActiveX control
First, the preface
The C # language is. NET technology, the core development language, is a simple, modern, object-oriented and type-safe programming language, it enables rapid application development, cross-platform deployment, access to the inherent resources of the platform, support COM and. NET technology, with the powerful functions of C + + language, The cross-platform features of the Java language and the convenience and rapidity of the Delphi language are many excellent qualities. Fp∑ is a small programmable controller produced by Panasonic Electric Co., Ltd. in Japan, it has many specifications, with small size, light weight, full-featured, simple programming, cheap and other advantages, in industrial control applications are very wide. This article compiles a simple communication program with Visual Studio. NET 2003 under Windows XP to explore the implementation of serial communication with the FPG-C24R2 PLC using the MSComm control.
Ii. Introduction of ActiveX controls
You must have MSCOMM.SRG, MSCOMM32.OCX,MSCOMM32.DEP files in your Windows system directory (note Winnt under System32), and it must be registered correctly. You can install VB6.0 to obtain, after installing vb.6.0, the MSComm control automatically registers on your computer, this is more convenient than manual registration control, Visual.Studio.NET2003 in Project Project (Solution) To insert a MSComm control: After you create a new program, click Tools-->add/remove Toolbox items (Add/Remove toolbox items) to open the Customize Toolbox (Customize Toolbox) dialog box, and then select COM Components (COM component) item, and in the presence of the control you can find Microsoft Communications control,version 6.0, select the item, and then click OK. You will see the phone icon for the MSComm control in the Toolbox Control Toolbox, and drag it to the form.