Visual PLC Productivity tools Programmer’s Guide Editor Language Instruct
Visual PLC Productivity tools Programmer’s Guide Editor Language Instruction Set Ver 7.xx ARSoft international - Copyright © 1999 Page 2 Page 3 Structure of programs and datas..........................................................................................5 VPU Files (Visual Pascal Unit) .............................................................................. 5 MVARGLOB.VPU ................................................................................................ 5 Presentation of the editor......................................................................................................6 First Step.................................................................................................................................7 Project definition ............................................................................................... 7 Second Step............................................................................................................................8 Declare the process variables (Globals variables). .................................................. 8 The Types of Variables available in Visual PLC........................................................ 9 Third Step..............................................................................................................................10 Writing a Program in Ladder.............................................................................. 10 Loading the real time engine. ............................................................................ 11 Loading the real time engine. ............................................................................ 12 Mnemonics ..................................................................................................... 13 Invert Input or output parameter of a functional module ....................................... 13 Blocks of Programs (in line) .............................................................................. 14 Possibility of testing if the input is true in the program block.................................. 14 Writing a program in Grafcet............................................................................. 15 Create a GRAFCET ........................................................................................... 15 Renum steps................................................................................................... 16 Instructions and variables concerning a Grafcet ................................................... 16 Grafcet variables can be used by other programs ................................................. 17 Use of external functions in Grafcet.................................................................... 18 Introduction to the Pascal Language .................................................................................19 Textual commentaries...................................................................................... 19 Identifiers ...................................................................................................... 20 Declarations ................................................................................................... 20 Boolean types :............................................................................................... 21 Arrays............................................................................................................ 21 Character strings............................................................................................. 21 The operators ................................................................................................. 22 The arithmetical operators ................................................................................ 22 Character string operator.................................................................................. 22 Logic operators ............................................................................................... 23 The boolean operators...................................................................................... 23 Tips & tricks ................................................................................................... 23 The Relational Operators .................................................................................. 24 Instructions .................................................................................................... 24 Simple Instructions.......................................................................................... 24 Affectations .................................................................................................... 24 Call of a procedure .......................................................................................... 24 Compound statements ..................................................................................... 25 IF THEN ELSE Statement .................................................................................. 25 REPEAT UNTIL Statement ................................................................................. 26 WHILE DO Statement....................................................................................... 26 CASE OF Statement ......................................................................................... 26 FOR TO /DOWNTO Statement............................................................................ 27 Procedures and functions.................................................................................. 28 Writing functional modules.................................................................................................29 Philosophy of a functional module ...................................................................... 29 Programming in a functional module .................................................................. 30 Test equation in Ladder validating the functional module....................................... 31 System Variables............................................................................................. 31 To quit the functional module ............................................................................ 31 Examples of functional modules......................................................................... 32 Tables transfer and typecast ............................................................................. 33 Page 4 Transfer a table in another table........................................................................ 34 Transfer of variables ........................................................................................ 35 Shift bits to left in consecutives words. ............................................................... 36 Call functions and procedure in a library VPU....................................................... 37 Compiling a functional module........................................................................... 37 Cross references ............................................................................................. 40 Statuts of the real time engine............................................................................................41 Adding a program to the real time engine ........................................................... 42 Programs execution order of in the real time engine ............................................. 43 Saving the configuration of the real time engine .................................................. 43 Loading the configuration in the real time engine ................................................. 43 Writing cyclical programs in Pascal language..................................................................44 The USES clause ............................................................................................. 44 Cyclical programs with interface........................................................................................45 Writing VPU libraries............................................................................................................47 Initialization in a library.................................................................................... 48 Passing parameters by values and address.......................................................... 48 Calling procedures and functions in a DLL.......................................................................50 To redefine the name of the function contained in a DLL ....................................... 50 Localization of a DLL ........................................................................................ 50 Example of Visual PLC variable allocated in an external DLL.........................................51 Launching the real time engine automatically ..................................................................52 Visualization of programs loaded.......................................................................................53 Profibus Configuration tool for DPC102 Profibus card ....................................................54 Setting the equipment parameters ..................................................................... 55 Test of the Profibus card and ScanDP. ................................................................ 55 Testing the communication with connected Profibus equipment.............................. 56 Dangerous Interactions with Visual PLC .............................................................. 56 Maintenance of data.............................................................................................................57 To add a password protecting the editor...........................................................................59 Page 5 Structure of programs and datas With Arsoft’s compiler included, Visual PLC works differently to most traditional programs. All programs you write will be compiled at maximum speed, which means they are without external and additionnal programs. Each program (Ladder, Grafcet, Language etc….) will be checked for syntax errors, and then will be compiled in a file extension (.VPU). VPU Files (Visual Pascal Unit) These files are the result of program compilations. Once compiled, they contain all the variables and procedures declarations to be operated by the real time kernel or with other VPUs. A VPU could be the declaration of the application’s global variables in its simplest form. It could also be procedures or functions that you created for use in other programs. With the VPUs ‘pre-compiled’, programs using them do not need to have their source codes for running. It is impossible to know in what language a VPU has been written. We will see later on that VPUs have an Interface part and an Implementation part. Interfacing is the declaration of the variables or procedures that can be accessed by other VPUs. The implementation is the real part of the code. The ‘Driver’ programs communicating with the embedded cards in your PC are also VPUs allowing you to interface with physical elements (I/O) and the Input/Output image table that uses the program. MVARGLOB.VPU Within the Visual PLC package, Mvarglob.VPU is the basic file containing all the process variables, such as the input/output image table, internal variables, bits of the active steps and their activation time. Before starting to develop a program in Ladder, Grafcet or indeed any other packages, you need to declare the variables with the help of the Global Variable editor. Models of variables (pre-definitions) are implemented. With starting a new project, you can choose a model of variables (Schneider, Siemens, Allen Bradley Etc..). You can also add your own variables to this model. Page 6 Presentation of the editor The list of Ladders, Grafcets, Functional Modules, Programs (in Pascal language) and global variables appear in the navigator. You can double click the items for their display and their modification. Click on ‘new button’ for a creation. New Ladder, grafcet or program. Show or hide the navigator Display area for programs Resize Windows To compile the program in the current window Tools to copy, paste, undo, Find, Replace, Prints, Print preview and Zooms. Definition of the Mnemonics Page 7 First Step Project definition Before programming, you must define a project. This project will contain a title and the physical path on your hard disk. If no project is defined in the launching of the editor, this window appears automatically. Click on Project Change to change or define a new project To change the current project, double-click in the left hand list (Existing Projects). Note : While clicking on a project in the left list and by striking <Del > key, the project and its contents are completely erased. When creating a new project, the specified directory is created on the disc and all the files contained in the installation directory under ‘Modules’ sub-directory (ex:C:\api32\Modules) are copied in the new project directory. It will contain all the functional Modules delivered. Stike here the the new project name and its directory Use the Navigator to choose an existing directory Page 8 Second Step Declare the process variables (Globals variables). Note : All Ladder Programs, and Grafcets refer to the globals variables. A variable can be initialised. Example : Consigne : Integer=1000 ; Double-Click on Variables icon. A window appears to propose predefined models of variables. The system creates a list of variables corresponding to the specific PLC. The user can constantly remove or add a variable of your choice and write the variable at the end of the list or use the help of the assistant. Assistant to add a variable Compiling Variables. (Mvarglob.VPU is created) Page 9 The Types of Variables available in Visual PLC Boolean : Byte (True=1 False=0). Byte : Byte 8 bits. (Bits 0 to 7) Word : Word 16 bits. (Bits 0 to 15). Integer : Integer 32 Bits. (Bits 0 to 31 ). -2147483648 to 2147483647 Real : Float. (10 bytes) 1,9x10-4951 to 1,1x104932 Single : Float 1.5e-45..3.4e38 (4 bytes) String : String of 255 characters. (1 to 255). Array : Array of variables define above. Example : Array [0..12] of Boolean; Boolean MBool : Boolean; MBool:=True; MBool:=False; equivalent to Mbool:=1; Mbool:=0; Byte By : Byte; By:=12; Word Wd : Word; WD:=12000; WD:=$F012; Integer It : Integer ; It:=255; It:=$FF; Numerical value allocation; It.0:=True; It.4:=False; Bit of Integer allocation; Real, Single RL : Real; RL:=-12.40; SL : Single ; SL :=456.89 ; String ST : String; ST:='Visual PLC'; ST:='C:\WinNt'; Array AMBOOL: Array [0..10] of Boolean; AMBool[1]:=True; ABY : Array [1..50] of Byte; ABY[2]:=34; AWD : Array [1..50] of Word; AWD[2]:=12034; AIT : Array [1..30] of Integer; AIT[4]:=-255; AIT[5].0 :=True; ARL : Array [2..14] of Real; ARL[2]:=-34.6789; AST : Array [0..6] of String; AST[2]:='Bonjour'; Contrary to others Soflogic, Visual PLC is allowed address Bit in a word. Example: W10.0 (First bit of word « W10 ») . Page 10 Third Step Writing a Program in Ladder Having defined the global variables and internal variables in the Mvarglob.VPU, it is possible to write programs in Ladder (which will be also VPUs). A window appears to be allowed to write a program in Ladder. A toolbar appears below the standard bar. The programs written in Ladder are organized in consecutives segments, allowing the constitution of cross references. Click on the New button. Choose new ladder. NO contact NC Contact Positive Edge Negative Edge continuity Vertical Branch Links (Continuity Coil Set Reset Invert I/O module Fonctionnal Module Comment In line Program New Segment Page 11 Blinking Program During the first compilation, the system requires a name for uploads/Ingenierie_Lourd/ plc-guide.pdf
Documents similaires










-
43
-
0
-
0
Licence et utilisation
Gratuit pour un usage personnel Attribution requise- Détails
- Publié le Nov 24, 2021
- Catégorie Heavy Engineering/...
- Langue French
- Taille du fichier 0.5542MB