Siemens S7 shift register

D

Thread Starter

Duffman

hi,

i have been given a task 'to write a program which will load the state of any input, 8 times into a shift register, using the shift right command. could any1 give me an example of this using ladder as i am lost and the help section is not helping any
 
J

Jacek Dobrowolski

Use the code below. Copy text between <code> and </code>, paste to text file and give to it extension AWL, import as source file into Step7, compile.

<code>
ORGANIZATION_BLOCK OB 1
TITLE = "Main Program Sweep (Cycle)"
VERSION : 0.1


VAR_TEMP
OB1_EV_CLASS : BYTE ; //Bits 0-3 = 1 (Coming event), Bits 4-7 = 1
(Event class 1)
OB1_SCAN_1 : BYTE ; //1 (Cold restart scan 1 of OB 1), 3 (Scan 2-n
of OB 1)
OB1_PRIORITY : BYTE ; //Priority of OB Execution
OB1_OB_NUMBR : BYTE ; //1 (Organization block 1, OB1)
OB1_RESERVED_1 : BYTE ; //Reserved for system
OB1_RESERVED_2 : BYTE ; //Reserved for system
OB1_PREV_CYCLE : INT ; //Cycle time of previous OB1 scan
(milliseconds)
OB1_MIN_CYCLE : INT ; //Minimum cycle time of OB1 (milliseconds)
OB1_MAX_CYCLE : INT ; //Maximum cycle time of OB1 (milliseconds)
OB1_DATE_TIME : DATE_AND_TIME ; //Date and time OB1 started
END_VAR
BEGIN
NETWORK
TITLE =load input to register



A I 0.0;
= M 2.0;
NETWORK
TITLE =m0.0 - clock (shift) signal
//shift register is MB3, but SHR_W instruction works with words
A M 0.0;
FP M 0.1;
JNB _001;
L B#16#1;
L MW 2;
SRW ;
T MW 2;
_001: NOP 0;
NETWORK
TITLE =unload register to output



A M 3.0;
= Q 0.0;
END_ORGANIZATION_BLOCK
</code>


Regards,
Jacek Dobrowolski
 
Top