15.07.2013 Views

Automatic control function programming manual ladder language

Automatic control function programming manual ladder language

Automatic control function programming manual ladder language

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Language element Includes Comment<br />

Variables<br />

%Y0 to %Y7C %Y variable of size .L (the size is not specified)<br />

0 to ff Immediate value (hexadecimal)<br />

.0 to .7, .B, .W or .L To access a bit, byte, work or long word<br />

variable<br />

Example<br />

%Y4 -> 0.5 The address of the variable pointed to is equal to the address contained in the<br />

pointer + post-offset «0».<br />

%Y7c -> ff.B The address of the variable pointed to is equal to the address contained in the<br />

pointer + post-offset «0xff».<br />

3.10.3 Examples of Use of Pointers<br />

Processing of a Character String<br />

%V500.L = «ABCDEF» // %V500.L contains the start address of string «ABCDEF»<br />

%Y8.L = %V500.L // Pointer initialised with string start address<br />

%Y8 -> 0.B == «A» // Access to the first character in the string<br />

%Y8 -> 5.B == «F» // Access to the sixth character in the string<br />

%Y8.L += 1 // Pointer increment<br />

%Y8 -> 0.B == «B» // Access to the second character in the string<br />

Management of Four Machine Panels<br />

REMARK: The sample programme PUPITREP available under PLCTOOL illustrates the use<br />

of pointers.<br />

In a %TS<br />

spy(0, %IrcOO.&, %Qrc00.&) // Branch to %SP0 (where rc == panel number from 1 to 4)<br />

In %SP0<br />

// contains the address of the first input %Irc00<br />

// contains the address of the first output %Qrc00<br />

%Y0 -> 2.0 %Irc2.0 Jog_1<br />

%Y0 -> 2.1 %Irc2.1 Jog_10<br />

%Y0 -> 2.2 %Irc2.2 Jog_100<br />

%Y0 -> 20.W %Irc20.W Spindle potentiometer<br />

%Y0 -> 22.W %Irc22.W Feed rate potentiometer<br />

%Y4 -> 0.0 %Qrc0.0 Led_arus<br />

%Y4 -> 0.1 %Qrc0.1 Led_dcy<br />

%Y4 -> 1.0 %Qrc1.0 Led_1<br />

%Y4 -> 1.1 %Qrc1.1 Led_10<br />

en-938846/8 3 - 71<br />

3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!