rs-plc-aa
Level-1
- Beiträge
- 727
- Reaktionspunkte
- 57
-> Hier kostenlos registrieren
Hier ein kurzes Beispiel (*.awl):
Wenn man den Status beobachtet sieht man daß zunächst im Baustein das Löschen geklappt hat und anschließed im OB sieht man dann daß das Bitmuster wieder im DB steckt...
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 =
L DB10.DBW 0;
CALL FB 1 , DB 1 (
DB_Nr := 10,
Bit0 := DB10.DBX 0.0,
Bit1 := DB10.DBX 0.1,
Bit2 := DB10.DBX 0.2,
Bit3 := DB10.DBX 0.3,
Bit4 := DB10.DBX 0.4,
Bit5 := DB10.DBX 0.5,
Bit6 := DB10.DBX 0.6,
Bit7 := DB10.DBX 0.7,
Bit8 := DB10.DBX 1.0,
Bit9 := DB10.DBX 1.1,
Bit10 := DB10.DBX 1.2,
Bit11 := DB10.DBX 1.3,
Bit12 := DB10.DBX 1.4,
Bit13 := DB10.DBX 1.5,
Bit14 := DB10.DBX 1.6,
Bit15 := DB10.DBX 1.7);
L DB10.DBW 0;
END_ORGANIZATION_BLOCK
FUNCTION_BLOCK FB 1
TITLE =
VERSION : 0.1
VAR_INPUT
DB_Nr : INT ;
END_VAR
VAR_IN_OUT
Bit0 : BOOL ;
Bit1 : BOOL ;
Bit2 : BOOL ;
Bit3 : BOOL ;
Bit4 : BOOL ;
Bit5 : BOOL ;
Bit6 : BOOL ;
Bit7 : BOOL ;
Bit8 : BOOL ;
Bit9 : BOOL ;
Bit10 : BOOL ;
Bit11 : BOOL ;
Bit12 : BOOL ;
Bit13 : BOOL ;
Bit14 : BOOL ;
Bit15 : BOOL ;
END_VAR
VAR_TEMP
DB_Nr_Int : INT ;
END_VAR
BEGIN
NETWORK
TITLE =
SET ;
S #Bit1;
S #Bit3;
S #Bit5;
S #Bit7;
S #Bit11;
NETWORK
TITLE =
L #DB_Nr;
T #DB_Nr_Int;
AUF DB [#DB_Nr_Int];
L 0;
T DBW 0;
NETWORK
TITLE =
L DBW 0;
U #Bit0;
U #Bit1;
U #Bit2;
U #Bit3;
U #Bit4;
U #Bit5;
U #Bit6;
U #Bit7;
U #Bit8;
U #Bit9;
U #Bit10;
U #Bit11;
U #Bit12;
U #Bit13;
U #Bit14;
U #Bit15;
END_FUNCTION_BLOCK
DATA_BLOCK DB 1
TITLE =
VERSION : 0.0
FB 1
BEGIN
DB_Nr := 0;
Bit0 := FALSE;
Bit1 := FALSE;
Bit2 := FALSE;
Bit3 := FALSE;
Bit4 := FALSE;
Bit5 := FALSE;
Bit6 := FALSE;
Bit7 := FALSE;
Bit8 := FALSE;
Bit9 := FALSE;
Bit10 := FALSE;
Bit11 := FALSE;
Bit12 := FALSE;
Bit13 := FALSE;
Bit14 := FALSE;
Bit15 := FALSE;
END_DATA_BLOCK
Wenn man den Status beobachtet sieht man daß zunächst im Baustein das Löschen geklappt hat und anschließed im OB sieht man dann daß das Bitmuster wieder im DB steckt...