Download 3318 kB
Transcript
5 - Editors in CoDeSys In the field Initial value, you may enter the initial value of the variable being declared. If this is an array or a valid structure, you can open a special initialization dialog via the input assistant dialog for other variable types. button or open the In the initialization dialog for an array you are presented a list of array elements; a mouse click on the space following „:="opens an editing field for entering the initial value of an element. In the initialization dialog for a structure, individual components are displayed in a tree structure. The type and default initial value appear in brackets after the variable name; each is followed by „:=". A mouse click on the field following „:=" opens an editing field in which you can enter the desired initial value. If the component is an array, then the display of individual fields in the array can be expanded by a mouse click on the plus sign before the array name and the fields can be edited with initial values. After leaving the initialization dialog with OK, the initialization of the array or the structure appears in the field Initial value of the declaration dialog in IEC format. Example: x:=5,field:=2,3,struct2:=(a:=2,b:=3) In the Address field, you can bind the variable being declared to an IEC address (AT declaration). If applicable, enter a Comment. The comment can be formatted with line breaks by using the key combination <Ctrl> + <Enter>. By pressing OK, the declaration dialog is closed and the variable is entered in the corresponding declaration editor in accordance to the IEC syntax. Note: The dialog box for variable declaration you also get by the command 'Edit' 'Declare Variable'. If the cursor is resting on a variable in Online mode, the Autodeclare window can be opened with <Shift><F2> with the current variable-related settings displayed. Line Numbers in the Declaration Editor In offline mode, a simple click on a special line number will mark the entire text line. In the online mode, a single click on a specific line number will open up or close the variable in this line, in case a structural variable is involved. Declarations as tables If the Declarations as tables option is activated in the Project Options (category ‘Editor’) or – if you already are working in the declaration editor – in the context menu, the declaration editor will look like a table. As in a card-index box, you can select the register cards of the respective variable types and edit the variables. For each variable you are given the following entry fields. Name: Input the identifier of the variable. Address: If necessary, input the address of the variable (AT declaration) Type: Input the type of the variable. (Input the function block when instantiating a function block) Initial: Enter a possible initialization of the variable (corresponding to the ":= " assignment operator). Comment: Enter a comment here. Both of the display types of the declaration editor can be changed without causing any problems. In online mode there are no different display types. Insert new declaration: In order to edit a new variable, select the 'Insert' 'New Declaration' command (see below). Sorting the declarations: CoDeSys V2.3 5-9