PLC Set Up Running collectd client

This commit is contained in:
Michael Rest
2012-07-13 14:10:58 +02:00
parent 6de58653bb
commit 656a6c33b6
201 changed files with 22571 additions and 0 deletions

6
Administrator.set Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=3.0.90.18?>
<ProjectSettings xmlns="http://br-automation.co.at/AS/ProjectSettings">
<Print Header="%lProject: %n%c%x" Footer="%cPage: %p" />
<ConfigurationManager ActiveConfigurationName="Config2" />
</ProjectSettings>

6
LastUser.set Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=3.0.90.21 SP03?>
<ProjectSettings xmlns="http://br-automation.co.at/AS/ProjectSettings">
<Print Header="%lProject: %n%c%x" Footer="%cPage: %p" />
<ConfigurationManager ActiveConfigurationName="Config1" />
</ProjectSettings>

View File

@@ -0,0 +1,12 @@
VAR
bBlink0_1 : BOOL;
bBlink0_5 : BOOL;
bBlink1_0 : BOOL;
bBlink2_0 : BOOL;
bBlink5_0 : BOOL;
gdtActTime : DATE_AND_TIME; (*Current Date and Time*)
gDTSActTimeUTC : DTStructure := (0); (*Current Date and Time as DTS (ms) UTC !!!*)
gudUnixTimeUTC : UDINT; (*Current Date and Time as Unixts UTC !!!*)
gOuNull : BOOL; (*DUMMY for Output*)
gAOuNull : INT; (*DUMMY for Output*)
END_VAR

View File

@@ -0,0 +1,67 @@
(*// Constants*)
VAR CONSTANT
gAInNull : INT := 0; (*O FOR Analog Input*)
gTrue : BOOL := TRUE; (*Konstant TRUE*)
gFalse : BOOL := FALSE; (*Konstant False*)
gInNull : BOOL := FALSE; (*FALSE FOR Input *)
iAIVoltageOverflow : INT := 16#7FFF; (* Analog Input Voltage Mode,Overflow *)
iAIVoltageUnderflow : INT := -32767; (* Analog Input Voltage Underflow *)
END_VAR
(*## Bathtypes*)
VAR CONSTANT
btDEPOT : USINT := 1; (*Bathtype*)
btSINK : USINT := 2; (*Bathtype*)
btBLOW_DRYER : USINT := 3; (*Bathtype*)
btACTIVE : USINT := 4; (*Bathtype*)
btTRANSPORT : USINT := 5; (*Bathtype*)
END_VAR
(*## DEPOT/TRANSPORT CarrierModes*)
VAR CONSTANT
gRECIPEMODE_NOP : USINT := 0; (*RecipeMode No Operation*)
gRECIPEMODE_RESET : USINT := 1; (*RecipeMode Reset Carrier Step*)
gRECIPEMODE_COPY : USINT := 2; (*RecipeMode Copy Recipe*)
END_VAR
(*## DEPOT/TRANSPORT LogMode*)
VAR CONSTANT
gLOGMODE_NOP : USINT := 0; (*Logmode No Operation*)
gLOGMODE_WRITE : USINT := 0; (*Logmode Write Logfile*)
END_VAR
(*## Carriertypes*)
VAR CONSTANT
gCARRIER_CARRIER : USINT := 1; (*Carriertype*)
gCARRIER_DRUM : USINT := 2; (*Carriertype*)
gudProdID_EMPTY : UDINT := 0; (*Sparecarrier *)
gudProdID_TEST : UDINT := 4294967295; (*Testproduction *)
gMAXBathGroup : USINT := 8; (*Available Bathgroups*)
gMAXBathInGroup : USINT := 7; (*Maximum Baths -1 in Group*)
gMAXCurrentProg : USINT := 9; (*Maximum Currentprograms -1*)
usMAX_BATHPOS : USINT := 60; (*Maximum Bathpositon (Machine independent)*)
usMAX_CARRIER : USINT := 50; (*Maximum Carrier*)
usMAX_CARRIERSTEP : USINT := 20; (*Maximum Step in Carrier Log*)
END_VAR
(*Statusbits of Carrierstep*)
VAR CONSTANT
gCARRIERSTEP_UNUSED : USINT := 0; (*Carrier Step not Used*)
gCARRIERSTEP_USED : USINT := 1; (*Carrier Step Used*)
gCARRIERSTEP_OK : USINT := 2; (*Carrier Step Finished without Problems*)
gCARRIERSTEP_INTERUPTED : USINT := 4; (*Carrier Step Stopped before Min Time*)
gCARRIERSTEP_OVERTIME : USINT := 8; (*Carrier Step took to long*)
gCARRIERSTEP_TEMPERATURE : USINT := 16; (*Carrier Step Temperature Error*)
gCARRIERSTEP_BATHMOVEMENT : USINT := 32; (*Carrier Step Problem with Bathmovement*)
gCARRIERSTEP_CURRENT : USINT := 64; (*Carrier Step Problem with Current*)
gCARRIERSTEP_CURRENT_CHANGED : USINT := 128; (*Carrier Step Current Changed*)
END_VAR
(*## States of Carrier*)
VAR CONSTANT
gCARRIER_CLEAN : USINT := 0; (*Carrier was placed on Depot*)
gCARRIER_SPARE : USINT := 1; (*Carrier was marked as Empty Carrier*)
gCARRIER_INPROCESS : USINT := 2; (*Carrier was marked as Full Carrier*)
gCARRIER_INPROCESS_WITH_ERROR : USINT := 3; (*Carrier is in process with errors*)
gCARRIER_FINISHED_OK : USINT := 4; (*Carrier is finished without errors*)
gCARRIER_FINISHED_WITH_ERROR : USINT := 5; (*Carrier is finished errors*)
END_VAR
(*## Sprayreg behaviour*)
VAR CONSTANT
SPRAY_ON_LIFT : USINT := 2; (*Sprayregs spray on Lift*)
SPRAY_ON_SINK : USINT := 1; (*Sprayregs spray on Sink*)
END_VAR

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=3.0.90.21 SP03?>
<Package xmlns="http://br-automation.co.at/AS/Package">
<Objects>
<Object Type="File">GlobalComon.var</Object>
<Object Type="Program" Language="IEC" Description="Actual Date_And_Time">get_dt</Object>
<Object Type="Program" Language="IEC" Description="Blinker 0,1 -0,5s">blinker</Object>
<Object Type="File">GlobalConstants.var</Object>
</Objects>
</Package>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=3.0.90.21 SP03?>
<Program xmlns="http://br-automation.co.at/AS/Program">
<Files>
<File Description="Local variables" Private="true">blinker.var</File>
<File Description="Initialization code">blinkerInit.ab</File>
<File Description="Cyclic code">blinkerCyclic.ab</File>
</Files>
</Program>

View File

@@ -0,0 +1,13 @@
(********************************************************************
* COPYRIGHT -- kA
********************************************************************
* Program: blinker
* File: blinker.var
* Author: michi
* Created: November 23, 2009
********************************************************************
* Local variables of program blinker
********************************************************************)
VAR
iCount : USINT;
END_VAR

View File

@@ -0,0 +1,30 @@
(********************************************************************
* COPYRIGHT -- kA
********************************************************************
* Program: blinker
* File: blinkerCyclic.ab
* Author: michi
* Created: November 23, 2009
********************************************************************
* Implementation of program blinker
********************************************************************)
PROGRAM _CYCLIC
(* cyclic program *)
;Has to be taskclass 10ms
bBlink0_1 = not bBlink0_1
inc (iCount)
if ((iCount mod 5) = 0) then
bBlink0_5 = not bBlink0_5
endif
if ((iCount mod 10) = 0) then
bBlink1_0 = not bBlink1_0
endif
if ((iCount mod 20) = 0) then
bBlink2_0 = not bBlink2_0
endif
if ((iCount mod 50) = 0) then
bBlink5_0 = not bBlink5_0
iCount = 0
endif
END_PROGRAM

View File

@@ -0,0 +1,16 @@
(********************************************************************
* COPYRIGHT -- kA
********************************************************************
* Program: blinker
* File: blinkerInit.ab
* Author: michi
* Created: November 23, 2009
********************************************************************
* Implementation of program blinker
********************************************************************)
PROGRAM _INIT
iCount = 0
END_PROGRAM

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=3.0.90.21 SP03?>
<Program xmlns="http://br-automation.co.at/AS/Program">
<Files>
<File Private="true">get_dt.var</File>
<File>get_dtInit.ab</File>
<File>get_dtCyclic.ab</File>
</Files>
</Program>

View File

@@ -0,0 +1,13 @@
VAR
lDTGetTime : DTGetTime;
lUtcDTStructureGetTime : UtcDTStructureGetTime;
END_VAR
(*For unixtimestamp conversion*)
VAR CONSTANT
uiDaysToMonthStart : ARRAY[0..11] OF UINT := [0,31,59,90,120,151,181,212,243,273,304,334];
END_VAR
VAR
udYears : UDINT;
udSwitchYears : UDINT;
udUnixTime : UDINT;
END_VAR

View File

@@ -0,0 +1,26 @@
PROGRAM _CYCLIC
//SGC Version
//Retrieve actual Date and Time in different Formats
//as Date and Time
lDTGetTime.enable = true
lDTGetTime FUB DTGetTime ()
gdtActTime = lDTGetTime.DT1
DT_TO_DTStructure (gdtActTime, ADR (gDTSActTimeUTC))
//as Unix Timestamp
udYears = gDTSActTimeUTC.year - 1970
udSwitchYears = ((gDTSActTimeUTC.year - 1) - 1968) / 4\
- ((gDTSActTimeUTC.year - 1) - 1900) / 100\
+ ((gDTSActTimeUTC.year - 1) - 1600) / 400
udUnixTime = gDTSActTimeUTC.second + 60 * gDTSActTimeUTC.minute + 3600 * gDTSActTimeUTC.hour + \
(uiDaysToMonthStart[gDTSActTimeUTC.month - 1] + gDTSActTimeUTC.day -1 + udYears * 365 + udSwitchYears) * 86400
IF (gDTSActTimeUTC.month > 2) AND (gDTSActTimeUTC.year MOD 4 = 0) AND ((gDTSActTimeUTC.year MOD 100 <> 0) OR (gDTSActTimeUTC.year MOD 400 = 0)) THEN
udUnixTime = udUnixTime + 86400
ENDIF
gudUnixTimeUTC = udUnixTime
END_PROGRAM

View File

@@ -0,0 +1,5 @@
PROGRAM _INIT
(* init program *)
;tSEtSntpClient_0.enalbe = true
END_PROGRAM

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=3.0.90.21 SP03?>
<Package xmlns="http://br-automation.co.at/AS/Package">
<Objects>
<Object Type="Program" Language="IEC" Description="Collectd Client">collectd</Object>
</Objects>
</Package>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=3.0.90.21 SP03?>
<Program xmlns="http://br-automation.co.at/AS/Program">
<Files>
<File Description="Implementation code">collectd.st</File>
<File Description="Local data types" Private="true">collectd.typ</File>
<File Description="Local variables" Private="true">collectd.var</File>
</Files>
</Program>

View File

@@ -0,0 +1,413 @@
(********************************************************************
* COPYRIGHT --
********************************************************************
* Program: collectd
* File: collectd.st
* Author: michi
* Created: July 10, 2012
********************************************************************
* Implementation of program collectd
********************************************************************)
PROGRAM _INIT
END_PROGRAM
PROGRAM _CYCLIC
TON_Delay ();
CASE enStep OF
//==========================================
enSTEP_INIT:
FUB_UdpOpen.enable := 1;
FUB_UdpOpen.pIfAddr := ADR ('192.168.100.68');
FUB_UdpOpen.port := 25826;
FUB_UdpOpen.options := udpOPT_REUSEADDR;
FUB_UdpConnect.enable := 1;
FUB_UdpConnect.port := 25826;
FUB_UdpConnect.pHost := ADR ('192.168.30.20');
enStep := enSTEP_OPEN;
//==========================================
enSTEP_OPEN:
FUB_UdpOpen ();
luiStatus := FUB_UdpOpen.status;
IF luiStatus = 0 THEN
FUB_UdpConnect.ident := FUB_UdpOpen.ident;
FUB_UdpSend.ident := FUB_UdpOpen.ident;
FUB_UdpClose.ident := FUB_UdpOpen.ident;
enStep := enSTEP_CLIENT;
ELSIF luiStatus <> ERR_FUB_BUSY THEN
enStep := enSTEP_ERROR;
ludNextAdr := strcpy (ADR (lStrDebug), ADR ('STEP_OPEN-ERROR: '));
END_IF
//==========================================
enSTEP_CLIENT:
FUB_UdpConnect ();
luiStatus := FUB_UdpConnect.status;
IF luiStatus = 0 THEN
enStep := enSTEP_READY;
ELSIF luiStatus <> ERR_FUB_BUSY THEN
enStep := enSTEP_ERROR;
ludNextAdr := strcpy (ADR (lStrDebug), ADR ('STEP_CLIENT-ERROR: '));
END_IF
//==========================================
enSTEP_READY:
//Host (len = Type (2) + len (2) + data)
ludNextAdr := strcpy (ADR (lBSendBuf), ADR (''));
ludStartAdr := ludNextAdr;
ludNextAdr := memcpy (ludNextAdr, ADR (PT_HOST), 2);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$0a'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('plcto'), 6);
//terminate String with NULL
//TIME
ludNextAdr := memcpy (ludNextAdr, ADR (PT_TIME), 2);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$0C'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludUnixTimeUTC := H_TO_NDINT (gudUnixTimeUTC);
ludNextAdr := memcpy (ludNextAdr, ADR (ludUnixTimeUTC), 4);
//INTERVAL
ludNextAdr := memcpy (ludNextAdr, ADR (PT_INTERVAL), 2);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$0C'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$1E'), 1);
//PLUGIN
ludNextAdr := memcpy (ludNextAdr, ADR (PT_PLUGIN), 2);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$0f'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('TemperOfen'), 11);
//PLUGIN_INSTANCE
ludNextAdr := memcpy (ludNextAdr, ADR (PT_PLUGIN_INSTANCE), 2);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$07'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('01'), 3);
//TYPE
ludNextAdr := memcpy (ludNextAdr, ADR (PT_TYPE), 2);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$10'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('temperature'), 12);
//TYPE_INSTANCE
ludNextAdr := memcpy (ludNextAdr, ADR (PT_TYPE_INSTANCE), 2);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$08'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('t01'), 4);
//VALUES
ludNextAdr := memcpy (ludNextAdr, ADR (PT_VALUES), 2);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$0f'), 1); //15, 24, 33, 42, 51, 60
//valuecount
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$01'), 1);
//Value 1
ludNextAdr := memcpy (ludNextAdr, ADR (VT_GAUGE), 1);
IF giOven1Temp1 < 32767 THEN
lrValue := INT_TO_REAL (giOven1Temp1) / 10.0;
ELSE
lrValue := 0;
END_IF;
memcpy (ADR (ldValue), ADR (lrValue), 4);
ldValue1 := 0;
ldValue2 := ldValue AND 2#10000000_00000000_00000000_00000000;
ldValue2 := ldValue2 OR SHL (INT_TO_DWORD (DWORD_TO_INT (SHR ((ldValue AND 2#01111111_10000000_00000000_00000000), 23)) + 896), 20);
ldValue2 := ldValue2 OR SHR ((ldValue AND 2#00000000_01111111_11111111_11111111), 3);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue1), 4);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) + 3 , 1);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) + 2 , 1);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) + 1 , 1);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) , 1);
//TYPE_INSTANCE
ludNextAdr := memcpy (ludNextAdr, ADR (PT_TYPE_INSTANCE), 2);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$08'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('t02'), 4);
//VALUES
ludNextAdr := memcpy (ludNextAdr, ADR (PT_VALUES), 2);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$0f'), 1); //15, 24, 33, 42, 51, 60
//valuecount
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$01'), 1);
//Value 1
ludNextAdr := memcpy (ludNextAdr, ADR (VT_GAUGE), 1);
IF giOven1Temp2 < 32767 THEN
lrValue := INT_TO_REAL (giOven1Temp2) / 10.0;
ELSE
lrValue := 0;
END_IF;
memcpy (ADR (ldValue), ADR (lrValue), 4);
ldValue1 := 0;
ldValue2 := ldValue AND 2#10000000_00000000_00000000_00000000;
ldValue2 := ldValue2 OR SHL (INT_TO_DWORD (DWORD_TO_INT (SHR ((ldValue AND 2#01111111_10000000_00000000_00000000), 23)) + 896), 20);
ldValue2 := ldValue2 OR SHR ((ldValue AND 2#00000000_01111111_11111111_11111111), 3);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue1), 4);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) + 3 , 1);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) + 2 , 1);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) + 1 , 1);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) , 1);
//TYPE_INSTANCE
ludNextAdr := memcpy (ludNextAdr, ADR (PT_TYPE_INSTANCE), 2);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$08'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('t03'), 4);
//VALUES
ludNextAdr := memcpy (ludNextAdr, ADR (PT_VALUES), 2);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$0f'), 1); //15, 24, 33, 42, 51, 60
//valuecount
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$01'), 1);
//Value 1
ludNextAdr := memcpy (ludNextAdr, ADR (VT_GAUGE), 1);
IF giOven1Temp3 < 32767 THEN
lrValue := INT_TO_REAL (giOven1Temp3) / 10.0;
ELSE
lrValue := 0;
END_IF;
memcpy (ADR (ldValue), ADR (lrValue), 4);
ldValue1 := 0;
ldValue2 := ldValue AND 2#10000000_00000000_00000000_00000000;
ldValue2 := ldValue2 OR SHL (INT_TO_DWORD (DWORD_TO_INT (SHR ((ldValue AND 2#01111111_10000000_00000000_00000000), 23)) + 896), 20);
ldValue2 := ldValue2 OR SHR ((ldValue AND 2#00000000_01111111_11111111_11111111), 3);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue1), 4);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) + 3 , 1);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) + 2 , 1);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) + 1 , 1);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) , 1);
//TYPE_INSTANCE
ludNextAdr := memcpy (ludNextAdr, ADR (PT_TYPE_INSTANCE), 2);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$08'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('t04'), 4);
//VALUES
ludNextAdr := memcpy (ludNextAdr, ADR (PT_VALUES), 2);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$0f'), 1); //15, 24, 33, 42, 51, 60
//valuecount
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$01'), 1);
//Value 1
ludNextAdr := memcpy (ludNextAdr, ADR (VT_GAUGE), 1);
IF giOven1Temp4 < 32767 THEN
lrValue := INT_TO_REAL (giOven1Temp4) / 10.0;
ELSE
lrValue := 0;
END_IF;
memcpy (ADR (ldValue), ADR (lrValue), 4);
ldValue1 := 0;
ldValue2 := ldValue AND 2#10000000_00000000_00000000_00000000;
ldValue2 := ldValue2 OR SHL (INT_TO_DWORD (DWORD_TO_INT (SHR ((ldValue AND 2#01111111_10000000_00000000_00000000), 23)) + 896), 20);
ldValue2 := ldValue2 OR SHR ((ldValue AND 2#00000000_01111111_11111111_11111111), 3);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue1), 4);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) + 3 , 1);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) + 2 , 1);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) + 1 , 1);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) , 1);
//TYPE_INSTANCE
ludNextAdr := memcpy (ludNextAdr, ADR (PT_TYPE_INSTANCE), 2);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$08'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('t05'), 4);
//VALUES
ludNextAdr := memcpy (ludNextAdr, ADR (PT_VALUES), 2);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$0f'), 1); //15, 24, 33, 42, 51, 60
//valuecount
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$01'), 1);
//Value 1
ludNextAdr := memcpy (ludNextAdr, ADR (VT_GAUGE), 1);
IF giOven1Temp5 < 32767 THEN
lrValue := INT_TO_REAL (giOven1Temp5) / 10.0;
ELSE
lrValue := 0;
END_IF;
memcpy (ADR (ldValue), ADR (lrValue), 4);
ldValue1 := 0;
ldValue2 := ldValue AND 2#10000000_00000000_00000000_00000000;
ldValue2 := ldValue2 OR SHL (INT_TO_DWORD (DWORD_TO_INT (SHR ((ldValue AND 2#01111111_10000000_00000000_00000000), 23)) + 896), 20);
ldValue2 := ldValue2 OR SHR ((ldValue AND 2#00000000_01111111_11111111_11111111), 3);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue1), 4);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) + 3 , 1);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) + 2 , 1);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) + 1 , 1);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) , 1);
//TYPE_INSTANCE
ludNextAdr := memcpy (ludNextAdr, ADR (PT_TYPE_INSTANCE), 2);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$08'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('t06'), 4);
//VALUES
ludNextAdr := memcpy (ludNextAdr, ADR (PT_VALUES), 2);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$0f'), 1); //15, 24, 33, 42, 51, 60
//valuecount
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$01'), 1);
//Value 1
ludNextAdr := memcpy (ludNextAdr, ADR (VT_GAUGE), 1);
IF giOven1Temp6 < 32767 THEN
lrValue := INT_TO_REAL (giOven1Temp6) / 10.0;
ELSE
lrValue := 0;
END_IF;
memcpy (ADR (ldValue), ADR (lrValue), 4);
ldValue1 := 0;
ldValue2 := ldValue AND 2#10000000_00000000_00000000_00000000;
ldValue2 := ldValue2 OR SHL (INT_TO_DWORD (DWORD_TO_INT (SHR ((ldValue AND 2#01111111_10000000_00000000_00000000), 23)) + 896), 20);
ldValue2 := ldValue2 OR SHR ((ldValue AND 2#00000000_01111111_11111111_11111111), 3);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue1), 4);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) + 3 , 1);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) + 2 , 1);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) + 1 , 1);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) , 1);
//TYPE_INSTANCE
ludNextAdr := memcpy (ludNextAdr, ADR (PT_TYPE_INSTANCE), 2);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$08'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('t07'), 4);
//VALUES
ludNextAdr := memcpy (ludNextAdr, ADR (PT_VALUES), 2);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$0f'), 1); //15, 24, 33, 42, 51, 60
//valuecount
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$01'), 1);
//Value 1
ludNextAdr := memcpy (ludNextAdr, ADR (VT_GAUGE), 1);
IF giOven1Temp7 < 32767 THEN
lrValue := INT_TO_REAL (giOven1Temp7) / 10.0;
ELSE
lrValue := 0;
END_IF;
memcpy (ADR (ldValue), ADR (lrValue), 4);
ldValue1 := 0;
ldValue2 := ldValue AND 2#10000000_00000000_00000000_00000000;
ldValue2 := ldValue2 OR SHL (INT_TO_DWORD (DWORD_TO_INT (SHR ((ldValue AND 2#01111111_10000000_00000000_00000000), 23)) + 896), 20);
ldValue2 := ldValue2 OR SHR ((ldValue AND 2#00000000_01111111_11111111_11111111), 3);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue1), 4);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) + 3 , 1);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) + 2 , 1);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) + 1 , 1);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) , 1);
//TYPE_INSTANCE
ludNextAdr := memcpy (ludNextAdr, ADR (PT_TYPE_INSTANCE), 2);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$08'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('t08'), 4);
//VALUES
ludNextAdr := memcpy (ludNextAdr, ADR (PT_VALUES), 2);
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$0f'), 1); //15, 24, 33, 42, 51, 60
//valuecount
ludNextAdr := memcpy (ludNextAdr, ADR ('$00'), 1);
ludNextAdr := memcpy (ludNextAdr, ADR ('$01'), 1);
//Value 1
ludNextAdr := memcpy (ludNextAdr, ADR (VT_GAUGE), 1);
IF giOven1Temp8 < 32767 THEN
lrValue := INT_TO_REAL (giOven1Temp8) / 10.0;
ELSE
lrValue := 0;
END_IF;
memcpy (ADR (ldValue), ADR (lrValue), 4);
ldValue1 := 0;
ldValue2 := ldValue AND 2#10000000_00000000_00000000_00000000;
ldValue2 := ldValue2 OR SHL (INT_TO_DWORD (DWORD_TO_INT (SHR ((ldValue AND 2#01111111_10000000_00000000_00000000), 23)) + 896), 20);
ldValue2 := ldValue2 OR SHR ((ldValue AND 2#00000000_01111111_11111111_11111111), 3);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue1), 4);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) + 3 , 1);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) + 2 , 1);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) + 1 , 1);
ludNextAdr := memcpy (ludNextAdr, ADR (ldValue2) , 1);
enStep := enSTEP_SEND;
//==========================================
enSTEP_SEND:
FUB_UdpSend.enable := 1;
FUB_UdpSend.datalen := ludNextAdr -ludStartAdr;
FUB_UdpSend.pData := ADR (lBSendBuf);
FUB_UdpSend ();
luiStatus := FUB_UdpSend.status;
IF luiStatus = 0 THEN
TON_Delay.IN := 1;
TON_Delay.PT := t#30s;
enStep := enSTEP_WAIT;
ELSIF luiStatus <> ERR_FUB_BUSY THEN
enStep := enSTEP_ERROR;
ludNextAdr := strcpy (ADR (lStrDebug), ADR ('STEP_READY-ERROR: '));
END_IF
//==========================================
enSTEP_WAIT:
IF TON_Delay.Q = 1 THEN
TON_Delay.IN := 0;
enStep := enSTEP_READY;
END_IF
//==========================================
enSTEP_CLOSE:
FUB_UdpClose.enable := 1;
FUB_UdpClose ();
luiStatus := FUB_UdpClose.status;
IF luiStatus = 0 THEN
enStep := enSTEP_CLOSED;
ELSIF luiStatus <> ERR_FUB_BUSY THEN
enStep := enSTEP_ERROR;
ludNextAdr := strcpy (ADR (lStrDebug), ADR ('STEP_CLOSE-ERROR: '));
END_IF
//==========================================
enSTEP_ERROR:
CASE luiStatus OF
udpERR_NOMORE_IDENTS:
strcat (ludNextAdr, ADR ('No More Idents'));
udpERR_ALREADY_EXIST:
strcat (ludNextAdr, ADR ('Already Exists'));
udpERR_INVALID_IDENT:
strcat (ludNextAdr, ADR ('Invalid Ident'));
udpERR_SOCKET_BIND:
strcat (ludNextAdr, ADR ('Socket BIND'));
udpERR_SOCKET_CONNECT:
strcat (ludNextAdr, ADR ('Socket Connect'));
ELSE
strcat (ludNextAdr, ADR ('DEFAULT'));
END_CASE
enStep := enSTEP_ERROR_STOP;
//==========================================
enSTEP_ERROR_STOP:
enSTEP_CLOSED:
END_CASE
END_PROGRAM

View File

@@ -0,0 +1,26 @@
(********************************************************************
* COPYRIGHT --
********************************************************************
* Program: collectd
* File: collectd.typ
* Author: michi
* Created: July 10, 2012
********************************************************************
* Local data types of program collectd
********************************************************************)
TYPE
Steps_enum :
(
enSTEP_INIT,
enSTEP_OPEN,
enSTEP_CLIENT,
enSTEP_READY,
enSTEP_SEND,
enSTEP_WAIT,
enSTEP_CLOSE,
enSTEP_ERROR,
enSTEP_ERROR_STOP,
enSTEP_CLOSED
);
END_TYPE

View File

@@ -0,0 +1,41 @@
(********************************************************************
* COPYRIGHT --
********************************************************************
* Program: collectd
* File: collectd.var
* Author: michi
* Created: July 10, 2012
********************************************************************
* Local variables of program collectd
********************************************************************)
VAR
FUB_UdpOpen : UdpOpen;
FUB_UdpConnect : UdpConnect;
FUB_UdpClose : UdpClose;
FUB_UdpSend : UdpSend;
TON_Delay : TON;
luiStatus : UINT;
ludStartAdr : UDINT;
lrValue : REAL := 1234.0;
ldValue : DWORD;
ldValue1 : DWORD;
ldValue2 : DWORD;
ludNextAdr : UDINT;
ludUnixTimeUTC : UDINT;
lStrDebug : STRING[80];
lBSendBuf : ARRAY[0..1023] OF BYTE;
enStep : Steps_enum := (0); (*Steps of Connection Handling*)
END_VAR
(*//Collectd Part Types*)
VAR
PT_HOST : STRING[2] := '$00$00';
PT_TIME : STRING[2] := '$00$01';
PT_PLUGIN : STRING[2] := '$00$02';
PT_PLUGIN_INSTANCE : STRING[2] := '$00$03';
PT_TYPE : STRING[2] := '$00$04';
PT_TYPE_INSTANCE : STRING[2] := '$00$05';
PT_VALUES : STRING[2] := '$00$06';
PT_INTERVAL : STRING[2] := '$00$07';
PT_TIME_HR : STRING[2] := '$00$08'; (*Time High Resolution*)
VT_GAUGE : STRING[1] := '$01'; (*GAUGE: Double (LREAL) little Endian*)
END_VAR

13
Logical/Global.typ Normal file
View File

@@ -0,0 +1,13 @@
(********************************************************************
* COPYRIGHT --
********************************************************************
* File: Global.typ
* Author: Administrator
* Created: November 03, 2011
********************************************************************
* Global data types of project testplc
********************************************************************)
TYPE
END_TYPE

27
Logical/Global.var Normal file
View File

@@ -0,0 +1,27 @@
(********************************************************************
* COPYRIGHT --
********************************************************************
* File: Global.var
* Author: Administrator
* Created: November 03, 2011
********************************************************************
* Global variables of project testplc
********************************************************************)
VAR
giOven1Temp1 : INT;
giOven1Temp2 : INT;
giOven1Temp3 : INT;
giOven1Temp4 : INT;
giOven1Temp5 : INT;
giOven1Temp6 : INT;
giOven1Temp7 : INT;
giOven1Temp8 : INT;
giOven2Temp1 : INT;
giOven2Temp2 : INT;
giOven2Temp3 : INT;
giOven2Temp4 : INT;
giOven2Temp5 : INT;
giOven2Temp6 : INT;
giOven2Temp7 : INT;
giOven2Temp8 : INT;
END_VAR

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=3.0.0.0?>
<Library xmlns="http://br-automation.co.at/AS/Library" Description="This library contains function interfaces for IEC 1131-3 conversion functions.">
<Files>
<File>AsIecCon.fun</File>
</Files>
<Dependencies>
<Dependency ObjectName="AsTime" />
</Dependencies>
</Library>

View File

@@ -0,0 +1,49 @@
/* Automation Studio Generated Header File, Format Version 1.00 */
/* do not change */
#ifndef ASIECCON_H_
#define ASIECCON_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <bur/plc.h>
/* Constants */
/* Datatypes */
/* Datatypes of function blocks */
/* Prototyping of functions and function blocks */
signed short H_TO_NINT(signed short IN);
unsigned short H_TO_NUINT(unsigned short IN);
signed long H_TO_NDINT(signed long IN);
unsigned long H_TO_NUDINT(unsigned long IN);
float H_TO_NREAL(float IN);
plctime H_TO_NTIME(plctime IN);
DATE_AND_TIME H_TO_NDT(DATE_AND_TIME IN);
signed short N_TO_HINT(signed short IN);
unsigned short N_TO_HUINT(unsigned short IN);
signed long N_TO_HDINT(signed long IN);
unsigned long N_TO_HUDINT(unsigned long IN);
float N_TO_HREAL(float IN);
plctime N_TO_HTIME(plctime IN);
DATE_AND_TIME N_TO_HDT(DATE_AND_TIME IN);
signed short swapINT(signed short IN);
unsigned short swapUINT(unsigned short IN);
signed long swapDINT(signed long IN);
unsigned long swapUDINT(unsigned long IN);
float swapREAL(float IN);
#ifdef __cplusplus
};
#endif
#endif /* ASIECCON_H_ */

View File

@@ -0,0 +1,62 @@
/* Automation Studio Generated Header File, Format Version 1.00 */
/* do not change */
#ifndef ASIECCON_H_
#define ASIECCON_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <bur/plc.h>
/* Constants */
/* Datatypes */
/* Datatypes of function blocks */
/* Prototyping of functions and function blocks */
signed short H_TO_NINT(signed short IN);
unsigned short H_TO_NUINT(unsigned short IN);
signed long H_TO_NDINT(signed long IN);
unsigned long H_TO_NUDINT(unsigned long IN);
float H_TO_NREAL(float IN);
plctime H_TO_NTIME(plctime IN);
DATE_AND_TIME H_TO_NDT(DATE_AND_TIME IN);
DATE H_TO_NDATE(DATE IN);
TOD H_TO_NTOD(TOD IN);
signed short N_TO_HINT(signed short IN);
unsigned short N_TO_HUINT(unsigned short IN);
signed long N_TO_HDINT(signed long IN);
unsigned long N_TO_HUDINT(unsigned long IN);
float N_TO_HREAL(float IN);
plctime N_TO_HTIME(plctime IN);
DATE_AND_TIME N_TO_HDT(DATE_AND_TIME IN);
DATE N_TO_HDATE(DATE IN);
TOD N_TO_HTOD(TOD IN);
signed short swapINT(signed short IN);
unsigned short swapUINT(unsigned short IN);
WORD swapWORD(WORD IN);
signed long swapDINT(signed long IN);
unsigned long swapUDINT(unsigned long IN);
DWORD swapDWORD(DWORD IN);
TIME swapTIME(TIME IN);
DATE_AND_TIME swapDT(DATE_AND_TIME IN);
DATE swapDATE(DATE IN);
TOD swapTOD(TOD IN);
float swapREAL(float IN);
/* The interface declarations of the AsIecCon functions are not included here
* because they are inline in IEC languages. The x_TO_STRING and the
* STRING_TO_x functions are not available for C programms. */
#ifdef __cplusplus
};
#endif
#endif /* ASIECCON_H_ */

View File

@@ -0,0 +1,62 @@
/* Automation Studio Generated Header File, Format Version 1.00 */
/* do not change */
#ifndef ASIECCON_H_
#define ASIECCON_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <bur/plc.h>
/* Constants */
/* Datatypes */
/* Datatypes of function blocks */
/* Prototyping of functions and function blocks */
signed short H_TO_NINT(signed short IN);
unsigned short H_TO_NUINT(unsigned short IN);
signed long H_TO_NDINT(signed long IN);
unsigned long H_TO_NUDINT(unsigned long IN);
float H_TO_NREAL(float IN);
plctime H_TO_NTIME(plctime IN);
DATE_AND_TIME H_TO_NDT(DATE_AND_TIME IN);
DATE H_TO_NDATE(DATE IN);
TOD H_TO_NTOD(TOD IN);
signed short N_TO_HINT(signed short IN);
unsigned short N_TO_HUINT(unsigned short IN);
signed long N_TO_HDINT(signed long IN);
unsigned long N_TO_HUDINT(unsigned long IN);
float N_TO_HREAL(float IN);
plctime N_TO_HTIME(plctime IN);
DATE_AND_TIME N_TO_HDT(DATE_AND_TIME IN);
DATE N_TO_HDATE(DATE IN);
TOD N_TO_HTOD(TOD IN);
signed short swapINT(signed short IN);
unsigned short swapUINT(unsigned short IN);
WORD swapWORD(WORD IN);
signed long swapDINT(signed long IN);
unsigned long swapUDINT(unsigned long IN);
DWORD swapDWORD(DWORD IN);
TIME swapTIME(TIME IN);
DATE_AND_TIME swapDT(DATE_AND_TIME IN);
DATE swapDATE(DATE IN);
TOD swapTOD(TOD IN);
float swapREAL(float IN);
/* The interface declarations of the AsIecCon functions are not included here
* because they are inline in IEC languages. The x_TO_STRING and the
* STRING_TO_x functions are not available for C programms. */
#ifdef __cplusplus
};
#endif
#endif /* ASIECCON_H_ */

View File

@@ -0,0 +1,149 @@
(********************************************************************
* COPYRIGHT -- Bernecker + Rainer
********************************************************************
* Library: AsUDP
* File: AsUDP.fun
* Author: B+R
********************************************************************
* Functions and function blocks of library AsUDP
********************************************************************)
FUNCTION_BLOCK UdpOpen (*opens a UDP port; asynchronous execution*)
VAR_INPUT
enable : BOOL; (*enables execution*)
pIfAddr : UDINT; (*pointer to the IP address of the ethernet interface where the UDP socket should be connected*)
port : UINT; (*port number that the UDP socket should connect to*)
options : UDINT; (*options that can be set during opening, e.g., udpOPT_REUSEADDR*)
END_VAR
VAR_OUTPUT
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
ident : UDINT; (*identifier used for all other UDP FBKs as an input parameter*)
END_VAR
VAR
i_state : UINT; (*internal variable*)
i_result : UINT; (*internal variable*)
i_tmp : UDINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK UdpClose (*closes a UDP port and frees up all required resources; asynchronous execution*)
VAR_INPUT
enable : BOOL; (*enables execution*)
ident : UDINT; (*identifier returned from UdpOpen*)
END_VAR
VAR_OUTPUT
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
END_VAR
VAR
i_state : UINT; (*internal variable*)
i_result : UINT; (*internal variable*)
i_tmp : UDINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK UdpConnect (*connects a UDP port to an opposite station; asynchronous execution*)
VAR_INPUT
enable : BOOL; (*enables execution*)
ident : UDINT; (*identifier returned from UdpOpen*)
pHost : UDINT; (*pointer to the ip address of the receiver*)
port : UINT; (*port number of the receiver*)
END_VAR
VAR_OUTPUT
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
END_VAR
VAR
i_state : UINT; (*internal variable*)
i_result : UINT; (*internal variable*)
i_tmp : UDINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK UdpDisconnect (*connects a UDP port and the opposite station; asynchronous execution*)
VAR_INPUT
enable : BOOL; (*enables execution*)
ident : UDINT; (*identifier returned from UdpOpen*)
END_VAR
VAR_OUTPUT
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
END_VAR
VAR
i_state : UINT; (*internal variable*)
i_result : UINT; (*internal variable*)
i_tmp : UDINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK UdpSend (*sends udp datagrams; asynchronous execution*)
VAR_INPUT
enable : BOOL; (*enables execution*)
ident : UDINT; (*identifier returned from UdpOpen*)
pHost : UDINT; (*pointer to the ip address or name of the receiver*)
port : UINT; (*port number of the receiver*)
pData : UDINT; (*pointer to the send datagram*)
datalen : UDINT; (*length of send datagram*)
flags : UDINT; (*send flags*)
END_VAR
VAR_OUTPUT
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
sentlen : UDINT; (*number of bytes sent*)
END_VAR
VAR
i_state : UINT; (*internal variable*)
i_result : UINT; (*internal variable*)
i_tmp : UDINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK UdpRecv (*receives udp datagrams; asynchronous execution*)
VAR_INPUT
enable : BOOL; (*enables execution*)
ident : UDINT; (*identifier returned from UdpOpen*)
pData : UDINT; (*pointer to the buffer where to store received datagram*)
datamax : UDINT; (*buffer size (max. length of received datagram)*)
flags : UDINT; (*receive flags*)
pIpAddr : UDINT; (*pointer where to store the ip address of the sender*)
END_VAR
VAR_OUTPUT
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
recvlen : UDINT; (*lentgh of received datagram*)
port : UINT; (*port number of transmitter*)
END_VAR
VAR
i_state : UINT; (*internal variable*)
i_result : UINT; (*internal variable*)
i_tmp : UDINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK UdpIoctl (*changes or retrieves settings; asynchronous execution*)
VAR_INPUT
enable : BOOL; (*enables execution*)
ident : UDINT; (*identifier returned from UdpOpen*)
ioctl : UDINT; (*io control code*)
pData : UDINT; (*pointer to the input/output data buffer*)
datalen : UDINT; (*lentgh of io control input data*)
END_VAR
VAR_OUTPUT
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
outlen : UDINT; (*length of the input data or maximum length of the output data*)
END_VAR
VAR
i_state : UINT; (*internal variable*)
i_result : UINT; (*internal variable*)
i_tmp : UDINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK

View File

@@ -0,0 +1,21 @@
(********************************************************************
* COPYRIGHT -- Bernecker + Rainer
********************************************************************
* Library: AsUDP
* File: AsUDP.typ
* Author: B+R
********************************************************************
* Data types of library AsUDP
********************************************************************)
TYPE
udpIP_MREQ_typ : STRUCT (*multicast*)
pMcastAddr : UDINT; (*pointer to the multicast address*)
pIfAddr : UDINT; (*pointer to the interface address*)
END_STRUCT;
udpSO_ADDRESS_typ : STRUCT (*socket address*)
pPort : UDINT; (*pointer where to store the portnumber*)
pIpAddr : UDINT; (*pointer where to store the socket ip address*)
END_STRUCT;
END_TYPE

View File

@@ -0,0 +1,66 @@
(********************************************************************
* COPYRIGHT -- Bernecker + Rainer
********************************************************************
* Library: AsUDP
* File: AsUDP.var
* Author: B+R
********************************************************************
* Local variables of library AsUDP
********************************************************************)
VAR CONSTANT
udpERR_INVALID_IDENT : UINT := 32500; (*invalid ident*)
udpERR_NOMORE_IDENTS : UINT := 32501; (*no more idents*)
udpERR_ALREADY_EXIST : UINT := 32502; (*socket already exists*)
udpERR_PARAMETER : UINT := 32503; (*invalid parameter, check parameter*)
udpERR_INVALID_IOCTL : UINT := 32504; (*io control not supported*)
udpERR_NO_DATA : UINT := 32505; (*no data to receive*)
udpERR_SENTLEN : UINT := 32506; (*send failed*)
udpERR_WOULDBLOCK : UINT := 32507; (*would block, call again*)
udpERR_CONNREFUSED : UINT := 32508; (*connection refused*)
udpERR_ACCESS : UINT := 32509; (*send broadcast failed (broadcast option not set)*)
udpERR_UNREACHABLE : UINT := 32510; (*network/host is unreachable*)
udpERR_INTERFACE : UINT := 32511; (*illegal inetrafce*)
udpERR_SOCKET_CREATE : UINT := 32550; (*create socket failed*)
udpERR_SOCKET_BIND : UINT := 32551; (*bind socket failed*)
udpERR_SOCKET_CONNECT : UINT := 32552; (*connect socket failed*)
udpERR_SYSTEM : UINT := 32599; (*system error*)
udpSO_BROADCAST_SET : UDINT := 1001; (*set option broadcast (true/false)*)
udpSO_BROADCAST_GET : UDINT := 1002; (*get option broadcast*)
udpSO_SNDBUF_SET : UDINT := 1003; (*set option send buffer*)
udpSO_SNDBUF_GET : UDINT := 1004; (*get option send buffer*)
udpSO_RCVBUF_SET : UDINT := 1005; (*set option receive buffer*)
udpSO_RCVBUF_GET : UDINT := 1006; (*get option receive buffer*)
udpSO_ADDRESS_GET : UDINT := 1007; (*get socket address*)
udpIP_ADD_MEMBERSHIP : UDINT := 2001; (*add multicast group*)
udpIP_DROP_MEMBERSHIP : UDINT := 2002; (*leave multicast group*)
udpIP_MULTICAST_IF_SET : UDINT := 2003; (*set interface for outgoing multicats*)
udpIP_MULTICAST_IF_GET : UDINT := 2004; (*get interface for outgoing multicats*)
udpIP_MULTICAST_TTL_SET : UDINT := 2005; (*set time to life for outgoing multicats*)
udpIP_MULTICAST_TTL_GET : UDINT := 2006; (*get time to life for outgoing multicats*)
udpIP_MULTICAST_LOOP_SET : UDINT := 2007; (*set wether or not loopback multicats*)
udpIP_MULTICAST_LOOP_GET : UDINT := 2008; (*get loopback multicats*)
udpIP_TOS_SET : UDINT := 2009; (*set type of service field for outgoing packets*)
udpIP_TOS_GET : UDINT := 2010; (*get type of service field for outgoing packets*)
udpIP_TTL_SET : UDINT := 2011; (*set time to live field for outgoing packets*)
udpIP_TTL_GET : UDINT := 2012; (*get time to live field for outgoing packets*)
udpID_LIST_GET : UDINT := 3001; (*get ident list*)
udpID_MAX_GET : UDINT := 3002; (*get max ident count*)
udpMSG_PEEK : UDINT := 1; (*don't remove data from socket (receive)*)
udpMSG_DONTROUTE : UDINT := 2; (*message don't route (send)*)
udpOPT_REUSEADDR : UDINT := 1; (*option reuse address*)
udpOPT_REUSEPORT : UDINT := 2; (*option reuse port*)
udpOPT_BROADCAST : UDINT := 4; (*option enable broadcast*)
udpIP_TOS_LOWDELAY : UDINT := 16; (*type of service priority low delay*)
udpIP_TOS_THROUGHPUT : UDINT := 8; (*type of service priority throughput*)
udpIP_TOS_RELIABILITY : UDINT := 4; (*type of service priority reliability*)
udpIP_TOS_MINCOST : UDINT := 2; (*type of service priority mincost*)
udpINVALID_IDENT : UDINT := 0; (*invlaid ident*)
END_VAR

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=3.0.0.0?>
<Library xmlns="http://br-automation.co.at/AS/Library" Description="This library contains FBKs for exchanging data packets via datagram sockets (UDP).">
<Files>
<File>AsUDP.var</File>
<File>AsUDP.typ</File>
<File>AsUDP.fun</File>
</Files>
<Dependencies>
<Dependency ObjectName="runtime" />
</Dependencies>
</Library>

View File

@@ -0,0 +1,268 @@
/* Automation Studio generated header file */
/* Do not edit ! */
#ifndef _ASUDP_
#define _ASUDP_
#ifdef __cplusplus
extern "C"
{
#endif
#include <bur/plctypes.h>
#include <runtime.h>
#ifndef _IEC_CONST
#define _IEC_CONST _WEAK const
#endif
/* Constants */
#ifdef _REPLACE_CONST
#define udpINVALID_IDENT 0U
#define udpIP_TOS_MINCOST 2U
#define udpIP_TOS_RELIABILITY 4U
#define udpIP_TOS_THROUGHPUT 8U
#define udpIP_TOS_LOWDELAY 16U
#define udpOPT_BROADCAST 4U
#define udpOPT_REUSEPORT 2U
#define udpOPT_REUSEADDR 1U
#define udpMSG_DONTROUTE 2U
#define udpMSG_PEEK 1U
#define udpID_MAX_GET 3002U
#define udpID_LIST_GET 3001U
#define udpIP_TTL_GET 2012U
#define udpIP_TTL_SET 2011U
#define udpIP_TOS_GET 2010U
#define udpIP_TOS_SET 2009U
#define udpIP_MULTICAST_LOOP_GET 2008U
#define udpIP_MULTICAST_LOOP_SET 2007U
#define udpIP_MULTICAST_TTL_GET 2006U
#define udpIP_MULTICAST_TTL_SET 2005U
#define udpIP_MULTICAST_IF_GET 2004U
#define udpIP_MULTICAST_IF_SET 2003U
#define udpIP_DROP_MEMBERSHIP 2002U
#define udpIP_ADD_MEMBERSHIP 2001U
#define udpSO_ADDRESS_GET 1007U
#define udpSO_RCVBUF_GET 1006U
#define udpSO_RCVBUF_SET 1005U
#define udpSO_SNDBUF_GET 1004U
#define udpSO_SNDBUF_SET 1003U
#define udpSO_BROADCAST_GET 1002U
#define udpSO_BROADCAST_SET 1001U
#define udpERR_SYSTEM 32599U
#define udpERR_SOCKET_CONNECT 32552U
#define udpERR_SOCKET_BIND 32551U
#define udpERR_SOCKET_CREATE 32550U
#define udpERR_INTERFACE 32511U
#define udpERR_UNREACHABLE 32510U
#define udpERR_ACCESS 32509U
#define udpERR_CONNREFUSED 32508U
#define udpERR_WOULDBLOCK 32507U
#define udpERR_SENTLEN 32506U
#define udpERR_NO_DATA 32505U
#define udpERR_INVALID_IOCTL 32504U
#define udpERR_PARAMETER 32503U
#define udpERR_ALREADY_EXIST 32502U
#define udpERR_NOMORE_IDENTS 32501U
#define udpERR_INVALID_IDENT 32500U
#else
_IEC_CONST unsigned long udpINVALID_IDENT = 0U;
_IEC_CONST unsigned long udpIP_TOS_MINCOST = 2U;
_IEC_CONST unsigned long udpIP_TOS_RELIABILITY = 4U;
_IEC_CONST unsigned long udpIP_TOS_THROUGHPUT = 8U;
_IEC_CONST unsigned long udpIP_TOS_LOWDELAY = 16U;
_IEC_CONST unsigned long udpOPT_BROADCAST = 4U;
_IEC_CONST unsigned long udpOPT_REUSEPORT = 2U;
_IEC_CONST unsigned long udpOPT_REUSEADDR = 1U;
_IEC_CONST unsigned long udpMSG_DONTROUTE = 2U;
_IEC_CONST unsigned long udpMSG_PEEK = 1U;
_IEC_CONST unsigned long udpID_MAX_GET = 3002U;
_IEC_CONST unsigned long udpID_LIST_GET = 3001U;
_IEC_CONST unsigned long udpIP_TTL_GET = 2012U;
_IEC_CONST unsigned long udpIP_TTL_SET = 2011U;
_IEC_CONST unsigned long udpIP_TOS_GET = 2010U;
_IEC_CONST unsigned long udpIP_TOS_SET = 2009U;
_IEC_CONST unsigned long udpIP_MULTICAST_LOOP_GET = 2008U;
_IEC_CONST unsigned long udpIP_MULTICAST_LOOP_SET = 2007U;
_IEC_CONST unsigned long udpIP_MULTICAST_TTL_GET = 2006U;
_IEC_CONST unsigned long udpIP_MULTICAST_TTL_SET = 2005U;
_IEC_CONST unsigned long udpIP_MULTICAST_IF_GET = 2004U;
_IEC_CONST unsigned long udpIP_MULTICAST_IF_SET = 2003U;
_IEC_CONST unsigned long udpIP_DROP_MEMBERSHIP = 2002U;
_IEC_CONST unsigned long udpIP_ADD_MEMBERSHIP = 2001U;
_IEC_CONST unsigned long udpSO_ADDRESS_GET = 1007U;
_IEC_CONST unsigned long udpSO_RCVBUF_GET = 1006U;
_IEC_CONST unsigned long udpSO_RCVBUF_SET = 1005U;
_IEC_CONST unsigned long udpSO_SNDBUF_GET = 1004U;
_IEC_CONST unsigned long udpSO_SNDBUF_SET = 1003U;
_IEC_CONST unsigned long udpSO_BROADCAST_GET = 1002U;
_IEC_CONST unsigned long udpSO_BROADCAST_SET = 1001U;
_IEC_CONST unsigned short udpERR_SYSTEM = 32599U;
_IEC_CONST unsigned short udpERR_SOCKET_CONNECT = 32552U;
_IEC_CONST unsigned short udpERR_SOCKET_BIND = 32551U;
_IEC_CONST unsigned short udpERR_SOCKET_CREATE = 32550U;
_IEC_CONST unsigned short udpERR_INTERFACE = 32511U;
_IEC_CONST unsigned short udpERR_UNREACHABLE = 32510U;
_IEC_CONST unsigned short udpERR_ACCESS = 32509U;
_IEC_CONST unsigned short udpERR_CONNREFUSED = 32508U;
_IEC_CONST unsigned short udpERR_WOULDBLOCK = 32507U;
_IEC_CONST unsigned short udpERR_SENTLEN = 32506U;
_IEC_CONST unsigned short udpERR_NO_DATA = 32505U;
_IEC_CONST unsigned short udpERR_INVALID_IOCTL = 32504U;
_IEC_CONST unsigned short udpERR_PARAMETER = 32503U;
_IEC_CONST unsigned short udpERR_ALREADY_EXIST = 32502U;
_IEC_CONST unsigned short udpERR_NOMORE_IDENTS = 32501U;
_IEC_CONST unsigned short udpERR_INVALID_IDENT = 32500U;
#endif
/* Datatypes and datatypes of function blocks */
typedef struct udpIP_MREQ_typ
{ unsigned long pMcastAddr;
unsigned long pIfAddr;
} udpIP_MREQ_typ;
typedef struct udpSO_ADDRESS_typ
{ unsigned long pPort;
unsigned long pIpAddr;
} udpSO_ADDRESS_typ;
typedef struct UdpOpen
{
/* VAR_INPUT (analog) */
unsigned long pIfAddr;
unsigned short port;
unsigned long options;
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned long ident;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UdpOpen_typ;
typedef struct UdpClose
{
/* VAR_INPUT (analog) */
unsigned long ident;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UdpClose_typ;
typedef struct UdpConnect
{
/* VAR_INPUT (analog) */
unsigned long ident;
unsigned long pHost;
unsigned short port;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UdpConnect_typ;
typedef struct UdpDisconnect
{
/* VAR_INPUT (analog) */
unsigned long ident;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UdpDisconnect_typ;
typedef struct UdpSend
{
/* VAR_INPUT (analog) */
unsigned long ident;
unsigned long pHost;
unsigned short port;
unsigned long pData;
unsigned long datalen;
unsigned long flags;
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned long sentlen;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UdpSend_typ;
typedef struct UdpRecv
{
/* VAR_INPUT (analog) */
unsigned long ident;
unsigned long pData;
unsigned long datamax;
unsigned long flags;
unsigned long pIpAddr;
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned long recvlen;
unsigned short port;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UdpRecv_typ;
typedef struct UdpIoctl
{
/* VAR_INPUT (analog) */
unsigned long ident;
unsigned long ioctl;
unsigned long pData;
unsigned long datalen;
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned long outlen;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UdpIoctl_typ;
/* Prototyping of functions and function blocks */
void UdpOpen(struct UdpOpen* inst);
void UdpClose(struct UdpClose* inst);
void UdpConnect(struct UdpConnect* inst);
void UdpDisconnect(struct UdpDisconnect* inst);
void UdpSend(struct UdpSend* inst);
void UdpRecv(struct UdpRecv* inst);
void UdpIoctl(struct UdpIoctl* inst);
#ifdef __cplusplus
};
#endif
#endif /* _ASUDP_ */

View File

@@ -0,0 +1,268 @@
/* Automation Studio generated header file */
/* Do not edit ! */
#ifndef _ASUDP_
#define _ASUDP_
#ifdef __cplusplus
extern "C"
{
#endif
#include <bur/plctypes.h>
#include <runtime.h>
#ifndef _IEC_CONST
#define _IEC_CONST _WEAK const
#endif
/* Constants */
#ifdef _REPLACE_CONST
#define udpINVALID_IDENT 0U
#define udpIP_TOS_MINCOST 2U
#define udpIP_TOS_RELIABILITY 4U
#define udpIP_TOS_THROUGHPUT 8U
#define udpIP_TOS_LOWDELAY 16U
#define udpOPT_BROADCAST 4U
#define udpOPT_REUSEPORT 2U
#define udpOPT_REUSEADDR 1U
#define udpMSG_DONTROUTE 2U
#define udpMSG_PEEK 1U
#define udpID_MAX_GET 3002U
#define udpID_LIST_GET 3001U
#define udpIP_TTL_GET 2012U
#define udpIP_TTL_SET 2011U
#define udpIP_TOS_GET 2010U
#define udpIP_TOS_SET 2009U
#define udpIP_MULTICAST_LOOP_GET 2008U
#define udpIP_MULTICAST_LOOP_SET 2007U
#define udpIP_MULTICAST_TTL_GET 2006U
#define udpIP_MULTICAST_TTL_SET 2005U
#define udpIP_MULTICAST_IF_GET 2004U
#define udpIP_MULTICAST_IF_SET 2003U
#define udpIP_DROP_MEMBERSHIP 2002U
#define udpIP_ADD_MEMBERSHIP 2001U
#define udpSO_ADDRESS_GET 1007U
#define udpSO_RCVBUF_GET 1006U
#define udpSO_RCVBUF_SET 1005U
#define udpSO_SNDBUF_GET 1004U
#define udpSO_SNDBUF_SET 1003U
#define udpSO_BROADCAST_GET 1002U
#define udpSO_BROADCAST_SET 1001U
#define udpERR_SYSTEM 32599U
#define udpERR_SOCKET_CONNECT 32552U
#define udpERR_SOCKET_BIND 32551U
#define udpERR_SOCKET_CREATE 32550U
#define udpERR_INTERFACE 32511U
#define udpERR_UNREACHABLE 32510U
#define udpERR_ACCESS 32509U
#define udpERR_CONNREFUSED 32508U
#define udpERR_WOULDBLOCK 32507U
#define udpERR_SENTLEN 32506U
#define udpERR_NO_DATA 32505U
#define udpERR_INVALID_IOCTL 32504U
#define udpERR_PARAMETER 32503U
#define udpERR_ALREADY_EXIST 32502U
#define udpERR_NOMORE_IDENTS 32501U
#define udpERR_INVALID_IDENT 32500U
#else
_IEC_CONST unsigned long udpINVALID_IDENT = 0U;
_IEC_CONST unsigned long udpIP_TOS_MINCOST = 2U;
_IEC_CONST unsigned long udpIP_TOS_RELIABILITY = 4U;
_IEC_CONST unsigned long udpIP_TOS_THROUGHPUT = 8U;
_IEC_CONST unsigned long udpIP_TOS_LOWDELAY = 16U;
_IEC_CONST unsigned long udpOPT_BROADCAST = 4U;
_IEC_CONST unsigned long udpOPT_REUSEPORT = 2U;
_IEC_CONST unsigned long udpOPT_REUSEADDR = 1U;
_IEC_CONST unsigned long udpMSG_DONTROUTE = 2U;
_IEC_CONST unsigned long udpMSG_PEEK = 1U;
_IEC_CONST unsigned long udpID_MAX_GET = 3002U;
_IEC_CONST unsigned long udpID_LIST_GET = 3001U;
_IEC_CONST unsigned long udpIP_TTL_GET = 2012U;
_IEC_CONST unsigned long udpIP_TTL_SET = 2011U;
_IEC_CONST unsigned long udpIP_TOS_GET = 2010U;
_IEC_CONST unsigned long udpIP_TOS_SET = 2009U;
_IEC_CONST unsigned long udpIP_MULTICAST_LOOP_GET = 2008U;
_IEC_CONST unsigned long udpIP_MULTICAST_LOOP_SET = 2007U;
_IEC_CONST unsigned long udpIP_MULTICAST_TTL_GET = 2006U;
_IEC_CONST unsigned long udpIP_MULTICAST_TTL_SET = 2005U;
_IEC_CONST unsigned long udpIP_MULTICAST_IF_GET = 2004U;
_IEC_CONST unsigned long udpIP_MULTICAST_IF_SET = 2003U;
_IEC_CONST unsigned long udpIP_DROP_MEMBERSHIP = 2002U;
_IEC_CONST unsigned long udpIP_ADD_MEMBERSHIP = 2001U;
_IEC_CONST unsigned long udpSO_ADDRESS_GET = 1007U;
_IEC_CONST unsigned long udpSO_RCVBUF_GET = 1006U;
_IEC_CONST unsigned long udpSO_RCVBUF_SET = 1005U;
_IEC_CONST unsigned long udpSO_SNDBUF_GET = 1004U;
_IEC_CONST unsigned long udpSO_SNDBUF_SET = 1003U;
_IEC_CONST unsigned long udpSO_BROADCAST_GET = 1002U;
_IEC_CONST unsigned long udpSO_BROADCAST_SET = 1001U;
_IEC_CONST unsigned short udpERR_SYSTEM = 32599U;
_IEC_CONST unsigned short udpERR_SOCKET_CONNECT = 32552U;
_IEC_CONST unsigned short udpERR_SOCKET_BIND = 32551U;
_IEC_CONST unsigned short udpERR_SOCKET_CREATE = 32550U;
_IEC_CONST unsigned short udpERR_INTERFACE = 32511U;
_IEC_CONST unsigned short udpERR_UNREACHABLE = 32510U;
_IEC_CONST unsigned short udpERR_ACCESS = 32509U;
_IEC_CONST unsigned short udpERR_CONNREFUSED = 32508U;
_IEC_CONST unsigned short udpERR_WOULDBLOCK = 32507U;
_IEC_CONST unsigned short udpERR_SENTLEN = 32506U;
_IEC_CONST unsigned short udpERR_NO_DATA = 32505U;
_IEC_CONST unsigned short udpERR_INVALID_IOCTL = 32504U;
_IEC_CONST unsigned short udpERR_PARAMETER = 32503U;
_IEC_CONST unsigned short udpERR_ALREADY_EXIST = 32502U;
_IEC_CONST unsigned short udpERR_NOMORE_IDENTS = 32501U;
_IEC_CONST unsigned short udpERR_INVALID_IDENT = 32500U;
#endif
/* Datatypes and datatypes of function blocks */
typedef struct udpIP_MREQ_typ
{ unsigned long pMcastAddr;
unsigned long pIfAddr;
} udpIP_MREQ_typ;
typedef struct udpSO_ADDRESS_typ
{ unsigned long pPort;
unsigned long pIpAddr;
} udpSO_ADDRESS_typ;
typedef struct UdpOpen
{
/* VAR_INPUT (analog) */
unsigned long pIfAddr;
unsigned short port;
unsigned long options;
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned long ident;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UdpOpen_typ;
typedef struct UdpClose
{
/* VAR_INPUT (analog) */
unsigned long ident;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UdpClose_typ;
typedef struct UdpConnect
{
/* VAR_INPUT (analog) */
unsigned long ident;
unsigned long pHost;
unsigned short port;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UdpConnect_typ;
typedef struct UdpDisconnect
{
/* VAR_INPUT (analog) */
unsigned long ident;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UdpDisconnect_typ;
typedef struct UdpSend
{
/* VAR_INPUT (analog) */
unsigned long ident;
unsigned long pHost;
unsigned short port;
unsigned long pData;
unsigned long datalen;
unsigned long flags;
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned long sentlen;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UdpSend_typ;
typedef struct UdpRecv
{
/* VAR_INPUT (analog) */
unsigned long ident;
unsigned long pData;
unsigned long datamax;
unsigned long flags;
unsigned long pIpAddr;
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned long recvlen;
unsigned short port;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UdpRecv_typ;
typedef struct UdpIoctl
{
/* VAR_INPUT (analog) */
unsigned long ident;
unsigned long ioctl;
unsigned long pData;
unsigned long datalen;
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned long outlen;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UdpIoctl_typ;
/* Prototyping of functions and function blocks */
void UdpOpen(struct UdpOpen* inst);
void UdpClose(struct UdpClose* inst);
void UdpConnect(struct UdpConnect* inst);
void UdpDisconnect(struct UdpDisconnect* inst);
void UdpSend(struct UdpSend* inst);
void UdpRecv(struct UdpRecv* inst);
void UdpIoctl(struct UdpIoctl* inst);
#ifdef __cplusplus
};
#endif
#endif /* _ASUDP_ */

View File

@@ -0,0 +1,268 @@
/* Automation Studio generated header file */
/* Do not edit ! */
#ifndef _ASUDP_
#define _ASUDP_
#ifdef __cplusplus
extern "C"
{
#endif
#include <bur/plctypes.h>
#include <runtime.h>
#ifndef _IEC_CONST
#define _IEC_CONST _WEAK const
#endif
/* Constants */
#ifdef _REPLACE_CONST
#define udpINVALID_IDENT 0U
#define udpIP_TOS_MINCOST 2U
#define udpIP_TOS_RELIABILITY 4U
#define udpIP_TOS_THROUGHPUT 8U
#define udpIP_TOS_LOWDELAY 16U
#define udpOPT_BROADCAST 4U
#define udpOPT_REUSEPORT 2U
#define udpOPT_REUSEADDR 1U
#define udpMSG_DONTROUTE 2U
#define udpMSG_PEEK 1U
#define udpID_MAX_GET 3002U
#define udpID_LIST_GET 3001U
#define udpIP_TTL_GET 2012U
#define udpIP_TTL_SET 2011U
#define udpIP_TOS_GET 2010U
#define udpIP_TOS_SET 2009U
#define udpIP_MULTICAST_LOOP_GET 2008U
#define udpIP_MULTICAST_LOOP_SET 2007U
#define udpIP_MULTICAST_TTL_GET 2006U
#define udpIP_MULTICAST_TTL_SET 2005U
#define udpIP_MULTICAST_IF_GET 2004U
#define udpIP_MULTICAST_IF_SET 2003U
#define udpIP_DROP_MEMBERSHIP 2002U
#define udpIP_ADD_MEMBERSHIP 2001U
#define udpSO_ADDRESS_GET 1007U
#define udpSO_RCVBUF_GET 1006U
#define udpSO_RCVBUF_SET 1005U
#define udpSO_SNDBUF_GET 1004U
#define udpSO_SNDBUF_SET 1003U
#define udpSO_BROADCAST_GET 1002U
#define udpSO_BROADCAST_SET 1001U
#define udpERR_SYSTEM 32599U
#define udpERR_SOCKET_CONNECT 32552U
#define udpERR_SOCKET_BIND 32551U
#define udpERR_SOCKET_CREATE 32550U
#define udpERR_INTERFACE 32511U
#define udpERR_UNREACHABLE 32510U
#define udpERR_ACCESS 32509U
#define udpERR_CONNREFUSED 32508U
#define udpERR_WOULDBLOCK 32507U
#define udpERR_SENTLEN 32506U
#define udpERR_NO_DATA 32505U
#define udpERR_INVALID_IOCTL 32504U
#define udpERR_PARAMETER 32503U
#define udpERR_ALREADY_EXIST 32502U
#define udpERR_NOMORE_IDENTS 32501U
#define udpERR_INVALID_IDENT 32500U
#else
_IEC_CONST unsigned long udpINVALID_IDENT = 0U;
_IEC_CONST unsigned long udpIP_TOS_MINCOST = 2U;
_IEC_CONST unsigned long udpIP_TOS_RELIABILITY = 4U;
_IEC_CONST unsigned long udpIP_TOS_THROUGHPUT = 8U;
_IEC_CONST unsigned long udpIP_TOS_LOWDELAY = 16U;
_IEC_CONST unsigned long udpOPT_BROADCAST = 4U;
_IEC_CONST unsigned long udpOPT_REUSEPORT = 2U;
_IEC_CONST unsigned long udpOPT_REUSEADDR = 1U;
_IEC_CONST unsigned long udpMSG_DONTROUTE = 2U;
_IEC_CONST unsigned long udpMSG_PEEK = 1U;
_IEC_CONST unsigned long udpID_MAX_GET = 3002U;
_IEC_CONST unsigned long udpID_LIST_GET = 3001U;
_IEC_CONST unsigned long udpIP_TTL_GET = 2012U;
_IEC_CONST unsigned long udpIP_TTL_SET = 2011U;
_IEC_CONST unsigned long udpIP_TOS_GET = 2010U;
_IEC_CONST unsigned long udpIP_TOS_SET = 2009U;
_IEC_CONST unsigned long udpIP_MULTICAST_LOOP_GET = 2008U;
_IEC_CONST unsigned long udpIP_MULTICAST_LOOP_SET = 2007U;
_IEC_CONST unsigned long udpIP_MULTICAST_TTL_GET = 2006U;
_IEC_CONST unsigned long udpIP_MULTICAST_TTL_SET = 2005U;
_IEC_CONST unsigned long udpIP_MULTICAST_IF_GET = 2004U;
_IEC_CONST unsigned long udpIP_MULTICAST_IF_SET = 2003U;
_IEC_CONST unsigned long udpIP_DROP_MEMBERSHIP = 2002U;
_IEC_CONST unsigned long udpIP_ADD_MEMBERSHIP = 2001U;
_IEC_CONST unsigned long udpSO_ADDRESS_GET = 1007U;
_IEC_CONST unsigned long udpSO_RCVBUF_GET = 1006U;
_IEC_CONST unsigned long udpSO_RCVBUF_SET = 1005U;
_IEC_CONST unsigned long udpSO_SNDBUF_GET = 1004U;
_IEC_CONST unsigned long udpSO_SNDBUF_SET = 1003U;
_IEC_CONST unsigned long udpSO_BROADCAST_GET = 1002U;
_IEC_CONST unsigned long udpSO_BROADCAST_SET = 1001U;
_IEC_CONST unsigned short udpERR_SYSTEM = 32599U;
_IEC_CONST unsigned short udpERR_SOCKET_CONNECT = 32552U;
_IEC_CONST unsigned short udpERR_SOCKET_BIND = 32551U;
_IEC_CONST unsigned short udpERR_SOCKET_CREATE = 32550U;
_IEC_CONST unsigned short udpERR_INTERFACE = 32511U;
_IEC_CONST unsigned short udpERR_UNREACHABLE = 32510U;
_IEC_CONST unsigned short udpERR_ACCESS = 32509U;
_IEC_CONST unsigned short udpERR_CONNREFUSED = 32508U;
_IEC_CONST unsigned short udpERR_WOULDBLOCK = 32507U;
_IEC_CONST unsigned short udpERR_SENTLEN = 32506U;
_IEC_CONST unsigned short udpERR_NO_DATA = 32505U;
_IEC_CONST unsigned short udpERR_INVALID_IOCTL = 32504U;
_IEC_CONST unsigned short udpERR_PARAMETER = 32503U;
_IEC_CONST unsigned short udpERR_ALREADY_EXIST = 32502U;
_IEC_CONST unsigned short udpERR_NOMORE_IDENTS = 32501U;
_IEC_CONST unsigned short udpERR_INVALID_IDENT = 32500U;
#endif
/* Datatypes and datatypes of function blocks */
typedef struct udpIP_MREQ_typ
{ unsigned long pMcastAddr;
unsigned long pIfAddr;
} udpIP_MREQ_typ;
typedef struct udpSO_ADDRESS_typ
{ unsigned long pPort;
unsigned long pIpAddr;
} udpSO_ADDRESS_typ;
typedef struct UdpOpen
{
/* VAR_INPUT (analog) */
unsigned long pIfAddr;
unsigned short port;
unsigned long options;
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned long ident;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UdpOpen_typ;
typedef struct UdpClose
{
/* VAR_INPUT (analog) */
unsigned long ident;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UdpClose_typ;
typedef struct UdpConnect
{
/* VAR_INPUT (analog) */
unsigned long ident;
unsigned long pHost;
unsigned short port;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UdpConnect_typ;
typedef struct UdpDisconnect
{
/* VAR_INPUT (analog) */
unsigned long ident;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UdpDisconnect_typ;
typedef struct UdpSend
{
/* VAR_INPUT (analog) */
unsigned long ident;
unsigned long pHost;
unsigned short port;
unsigned long pData;
unsigned long datalen;
unsigned long flags;
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned long sentlen;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UdpSend_typ;
typedef struct UdpRecv
{
/* VAR_INPUT (analog) */
unsigned long ident;
unsigned long pData;
unsigned long datamax;
unsigned long flags;
unsigned long pIpAddr;
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned long recvlen;
unsigned short port;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UdpRecv_typ;
typedef struct UdpIoctl
{
/* VAR_INPUT (analog) */
unsigned long ident;
unsigned long ioctl;
unsigned long pData;
unsigned long datalen;
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned long outlen;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UdpIoctl_typ;
/* Prototyping of functions and function blocks */
void UdpOpen(struct UdpOpen* inst);
void UdpClose(struct UdpClose* inst);
void UdpConnect(struct UdpConnect* inst);
void UdpDisconnect(struct UdpDisconnect* inst);
void UdpSend(struct UdpSend* inst);
void UdpRecv(struct UdpRecv* inst);
void UdpIoctl(struct UdpIoctl* inst);
#ifdef __cplusplus
};
#endif
#endif /* _ASUDP_ */

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=3.0.90.21 SP03?>
<Package xmlns="http://br-automation.co.at/AS/Package">
<Objects>
<Object Type="Library" Language="Binary" Description="This library contains function interfaces for IEC1131-3 operator functions. For the most part, these are mathematical and logical functions.">Operator</Object>
<Object Type="Library" Language="Binary" Description="This library contains runtime functions for IEC tasks.">Runtime</Object>
<Object Type="Library" Language="Binary" Description="The AsTime Library supports DATE_AND_TIME and TIME data types.">AsTime</Object>
<Object Type="Library" Language="Binary" Description="This library contains function interfaces for IEC 1131-3 conversion functions.">AsIecCon</Object>
<Object Type="Library" Language="Binary" Description="The BRSystem library provides the user with a number of system functions for e.g. handling permanent memory, accessing exception information, etc.">brsystem</Object>
<Object Type="Library" Language="Binary" Description="The SYS_LIB library contains functions for memory management and operating system manipulation as well as hardware-specific functions.">sys_lib</Object>
<Object Type="Library" Language="Binary" Description="The AsString Library contains FBKs for memory and character string handling.">asstring</Object>
<Object Type="Library" Language="Binary" Description="This library contains FBKs for exchanging data packets via datagram sockets (UDP).">AsUDP</Object>
<Object Type="Library" Language="Binary" Description="This library contains standard function blocks and funtions for IEC 1131-3.">standard</Object>
</Objects>
</Package>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=3.0.0.0?>
<Library xmlns="http://br-automation.co.at/AS/Library" Description="The AsString Library contains FBKs for memory and character string handling.">
<Files>
<File>asstring.fun</File>
</Files>
</Library>

View File

@@ -0,0 +1,33 @@
/* Automation Studio Generated Header File, Format Version 1.00 */
/* do not change */
#ifndef ASSTRING_H_
#define ASSTRING_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <bur/plc.h>
/* Constants */
/* Datatypes */
/* Datatypes of function blocks */
/* Prototyping of functions and function blocks */
unsigned short ftoa(float value, unsigned long pString);
unsigned short itoa(signed long value, unsigned long pString);
float atof(unsigned long pString);
signed long atoi(unsigned long pString);
#ifdef __cplusplus
};
#endif
#endif /* ASSTRING_H_ */

View File

@@ -0,0 +1,33 @@
/* Automation Studio Generated Header File, Format Version 1.00 */
/* do not change */
#ifndef ASSTRING_H_
#define ASSTRING_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <bur/plc.h>
/* Constants */
/* Datatypes */
/* Datatypes of function blocks */
/* Prototyping of functions and function blocks */
unsigned short ftoa(float value, unsigned long pString);
unsigned short itoa(signed long value, unsigned long pString);
float atof(unsigned long pString);
signed long atoi(unsigned long pString);
#ifdef __cplusplus
};
#endif
#endif /* ASSTRING_H_ */

View File

@@ -0,0 +1,33 @@
/* Automation Studio Generated Header File, Format Version 1.00 */
/* do not change */
#ifndef ASSTRING_H_
#define ASSTRING_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <bur/plc.h>
/* Constants */
/* Datatypes */
/* Datatypes of function blocks */
/* Prototyping of functions and function blocks */
unsigned short ftoa(float value, unsigned long pString);
unsigned short itoa(signed long value, unsigned long pString);
float atof(unsigned long pString);
signed long atoi(unsigned long pString);
#ifdef __cplusplus
};
#endif
#endif /* ASSTRING_H_ */

View File

@@ -0,0 +1,83 @@
(********************************************************************
* COPYRIGHT -- Bernecker + Rainer
********************************************************************
* Library: asstring
* File: asstring.fun
* Author: B+R
********************************************************************
* Functions and function blocks of library asstring
********************************************************************)
FUNCTION ftoa : UINT (*converts a REAL value into a character string*)
VAR_INPUT
value :REAL; (*REAL (FLOAT) value to be converted into a character string*)
pString :UDINT; (*pointer to the destination character string*)
END_VAR
END_FUNCTION
FUNCTION atof : REAL (*converts a character string into a REAL (FLOAT) value*)
VAR_INPUT
pString :UDINT; (*pointer to the character string to be converted*)
END_VAR
END_FUNCTION
FUNCTION itoa : UINT (*converts a DINT value into a character string*)
VAR_INPUT
value :DINT; (*numerical value to be converted into a string*)
pString :UDINT; (*pointer to the destination character string*)
END_VAR
END_FUNCTION
FUNCTION atoi : DINT (*converts a character string into a DINT value*)
VAR_INPUT
pString :UDINT; (*pointer to the character string to be converted*)
END_VAR
END_FUNCTION
FUNCTION memset : UDINT (*fills the memory area with specific values*)
VAR_INPUT
pDest :UDINT; (*pointer to the destination memory*)
value :USINT; (*initialization value*)
length :UDINT; (*number of bytes to be initialized*)
END_VAR
END_FUNCTION
FUNCTION memcpy : UDINT (*copies the memory area*)
VAR_INPUT
pDest :UDINT; (*pointer to the destination memory*)
pSrc :UDINT; (*pointer to the data to be copied*)
length :UDINT; (*size of bytes to be copied*)
END_VAR
END_FUNCTION
FUNCTION memmove : UDINT (*copies the memory area (even if the memory areas overlap)*)
VAR_INPUT
pDest :UDINT; (*pointer to the destination memory*)
pSrc :UDINT; (*pointer to the data to be copied*)
length :UDINT; (*size of bytes to be copied*)
END_VAR
END_FUNCTION
FUNCTION memcmp : DINT (*compares memory areas*)
VAR_INPUT
pMem1 :UDINT; (*pointer to the memory area 1*)
pMem2 :UDINT; (*pointer to the memory area 2*)
length :UDINT; (*size of bytes to be checked*)
END_VAR
END_FUNCTION
FUNCTION strcat : UDINT (*attaches character strings to one another*)
VAR_INPUT
pDest :UDINT; (*pointer to the destination character string*)
pSrc :UDINT; (*pointer to the source character string*)
END_VAR
END_FUNCTION
FUNCTION strlen : UINT (*provides the length of a character string*)
VAR_INPUT
pString :UDINT; (*pointer to the source character string*)
END_VAR
END_FUNCTION
FUNCTION strcpy : UDINT (*copies one character string into another*)
VAR_INPUT
pDest :UDINT; (*pointer to the destination character string*)
pSrc :UDINT; (*pointer to the source character string*)
END_VAR
END_FUNCTION
FUNCTION strcmp : DINT (*compares two character strings*)
VAR_INPUT
pString1 :UDINT; (*pointer to the first character string*)
pString2 :UDINT; (*pointer to the second character string*)
END_VAR
END_FUNCTION

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=3.0.0.0?>
<Library xmlns="http://br-automation.co.at/AS/Library" Description="The AsTime Library supports DATE_AND_TIME and TIME data types.">
<Files>
<File>astime.var</File>
<File>astime.typ</File>
<File>astime.fun</File>
</Files>
<Dependencies>
<Dependency ObjectName="runtime" />
</Dependencies>
</Library>

View File

@@ -0,0 +1,130 @@
/* Automation Studio generated header file */
/* Do not edit ! */
#ifndef _ASTIME_
#define _ASTIME_
#ifdef __cplusplus
extern "C"
{
#endif
#include <bur/plctypes.h>
#include <runtime.h>
#ifndef _IEC_CONST
#define _IEC_CONST _WEAK const
#endif
/* Constants */
#ifdef _REPLACE_CONST
#define timERR_AR 33213U
#define timERR_INVALID_DTSTRUCTURE 33212U
#define timERR_INVALID_LEN 33211U
#define timERR_INVALID_PARAMETER 33210U
#define timTIME_SERVER 2U
#define timREAL_TIME_CLOCK 1U
#define timNO_DST 3U
#define timDAYLIGHT_SAVING_TIME 2U
#define timNORMAL_TIME 1U
#define TIME_MAX 2073600000
#define TIME_MIN (-2073600000)
#define DATE_AND_TIME_MAX 4102444799U
#define timEXSETTIME_NO_OPTION 0U
#define timEXSETTIME_NO_LOGENTRY 1U
#else
_IEC_CONST unsigned short timERR_AR = 33213U;
_IEC_CONST unsigned short timERR_INVALID_DTSTRUCTURE = 33212U;
_IEC_CONST unsigned short timERR_INVALID_LEN = 33211U;
_IEC_CONST unsigned short timERR_INVALID_PARAMETER = 33210U;
_IEC_CONST unsigned char timTIME_SERVER = 2U;
_IEC_CONST unsigned char timREAL_TIME_CLOCK = 1U;
_IEC_CONST unsigned char timNO_DST = 3U;
_IEC_CONST unsigned char timDAYLIGHT_SAVING_TIME = 2U;
_IEC_CONST unsigned char timNORMAL_TIME = 1U;
_IEC_CONST signed long TIME_MAX = 2073600000;
_IEC_CONST signed long TIME_MIN = -2073600000;
_IEC_CONST unsigned long DATE_AND_TIME_MAX = 4102444799U;
_IEC_CONST unsigned char timEXSETTIME_NO_OPTION = 0U;
_IEC_CONST unsigned char timEXSETTIME_NO_LOGENTRY = 1U;
#endif
/* Datatypes and datatypes of function blocks */
typedef struct TIMEStructure
{ signed char day;
unsigned char hour;
unsigned char minute;
unsigned char second;
unsigned short millisec;
unsigned short microsec;
} TIMEStructure;
typedef struct DTStructure
{ unsigned short year;
unsigned char month;
unsigned char day;
unsigned char wday;
unsigned char hour;
unsigned char minute;
unsigned char second;
unsigned short millisec;
unsigned short microsec;
} DTStructure;
typedef struct DTExSetTime
{
/* VAR_INPUT (analog) */
plcdt DT1;
unsigned char Option;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR_INPUT (digital) */
plcbit enable;
} DTExSetTime_typ;
typedef struct DTSetTime
{
/* VAR_INPUT (analog) */
plcdt DT1;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR_INPUT (digital) */
plcbit enable;
} DTSetTime_typ;
typedef struct DTGetTime
{
/* VAR_OUTPUT (analog) */
unsigned short status;
plcdt DT1;
/* VAR_INPUT (digital) */
plcbit enable;
} DTGetTime_typ;
/* Prototyping of functions and function blocks */
void DTExSetTime(struct DTExSetTime* inst);
void DTSetTime(struct DTSetTime* inst);
void DTGetTime(struct DTGetTime* inst);
unsigned long ascTIMEStructure(unsigned long pTIMEStructure, unsigned long pStr, unsigned long len);
unsigned long ascDTStructure(unsigned long pDTStructure, unsigned long pStr, unsigned long len);
unsigned long ascTIME(plctime TIME1, unsigned long pStr, unsigned long len);
unsigned long ascDT(plcdt DT1, unsigned long pStr, unsigned long len);
plctime TIMEStructure_TO_TIME(unsigned long pTIMEStructure);
unsigned long TIME_TO_TIMEStructure(plctime TIME1, unsigned long pTIMEStructure);
plcdt DTStructure_TO_DT(unsigned long pDTStructure);
unsigned long DT_TO_DTStructure(plcdt DT1, unsigned long pDTStructure);
unsigned long DiffT(plctime TIME2, plctime TIME1);
unsigned long DiffDT(plcdt DT2, plcdt DT1);
#ifdef __cplusplus
};
#endif
#endif /* _ASTIME_ */

View File

@@ -0,0 +1,362 @@
/* Automation Studio generated header file */
/* Do not edit ! */
#ifndef _ASTIME_
#define _ASTIME_
#ifdef __cplusplus
extern "C"
{
#endif
#include <bur/plctypes.h>
#include <runtime.h>
#ifndef _IEC_CONST
#define _IEC_CONST _WEAK const
#endif
/* Constants */
#ifdef _REPLACE_CONST
#define timERR_AR 33213U
#define timERR_INVALID_DTSTRUCTURE 33212U
#define timERR_INVALID_LEN 33211U
#define timERR_INVALID_PARAMETER 33210U
#define timTIME_SERVER 2U
#define timREAL_TIME_CLOCK 1U
#define timNO_DST 3U
#define timDAYLIGHT_SAVING_TIME 2U
#define timNORMAL_TIME 1U
#define TIME_MAX 2073600000
#define TIME_MIN (-2073600000)
#define DATE_AND_TIME_MAX 4102444799U
#define timEXSETTIME_NO_OPTION 0U
#define timEXSETTIME_NO_LOGENTRY 1U
#else
_IEC_CONST unsigned short timERR_AR = 33213U;
_IEC_CONST unsigned short timERR_INVALID_DTSTRUCTURE = 33212U;
_IEC_CONST unsigned short timERR_INVALID_LEN = 33211U;
_IEC_CONST unsigned short timERR_INVALID_PARAMETER = 33210U;
_IEC_CONST unsigned char timTIME_SERVER = 2U;
_IEC_CONST unsigned char timREAL_TIME_CLOCK = 1U;
_IEC_CONST unsigned char timNO_DST = 3U;
_IEC_CONST unsigned char timDAYLIGHT_SAVING_TIME = 2U;
_IEC_CONST unsigned char timNORMAL_TIME = 1U;
_IEC_CONST signed long TIME_MAX = 2073600000;
_IEC_CONST signed long TIME_MIN = -2073600000;
_IEC_CONST unsigned long DATE_AND_TIME_MAX = 4102444799U;
_IEC_CONST unsigned char timEXSETTIME_NO_OPTION = 0U;
_IEC_CONST unsigned char timEXSETTIME_NO_LOGENTRY = 1U;
#endif
/* Datatypes and datatypes of function blocks */
typedef struct TIMEStructure
{ signed char day;
unsigned char hour;
unsigned char minute;
unsigned char second;
unsigned short millisec;
unsigned short microsec;
} TIMEStructure;
typedef struct DTStructure
{ unsigned short year;
unsigned char month;
unsigned char day;
unsigned char wday;
unsigned char hour;
unsigned char minute;
unsigned char second;
unsigned short millisec;
unsigned short microsec;
} DTStructure;
typedef struct DTExSetTime
{
/* VAR_INPUT (analog) */
plcdt DT1;
unsigned char Option;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR_INPUT (digital) */
plcbit enable;
} DTExSetTime_typ;
typedef struct DTSetTime
{
/* VAR_INPUT (analog) */
plcdt DT1;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR_INPUT (digital) */
plcbit enable;
} DTSetTime_typ;
typedef struct DTGetTime
{
/* VAR_OUTPUT (analog) */
unsigned short status;
plcdt DT1;
/* VAR_INPUT (digital) */
plcbit enable;
} DTGetTime_typ;
typedef struct UtcDTGetTime
{
/* VAR_OUTPUT (analog) */
unsigned short status;
plcdt DT1;
/* VAR_INPUT (digital) */
plcbit enable;
} UtcDTGetTime_typ;
typedef struct UtcDTSetTime
{
/* VAR_INPUT (analog) */
plcdt DT1;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UtcDTSetTime_typ;
typedef struct UtcDTExSetTime
{
/* VAR_INPUT (analog) */
plcdt DT1;
unsigned char Option;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UtcDTExSetTime_typ;
typedef struct DTStructureGetTime
{
/* VAR_INPUT (analog) */
unsigned long pDTStructure;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR_INPUT (digital) */
plcbit enable;
} DTStructureGetTime_typ;
typedef struct DTStructureSetTime
{
/* VAR_INPUT (analog) */
unsigned long pDTStructure;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR_INPUT (digital) */
plcbit enable;
} DTStructureSetTime_typ;
typedef struct DTStructureExSetTime
{
/* VAR_INPUT (analog) */
unsigned long pDTStructure;
unsigned char Option;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR_INPUT (digital) */
plcbit enable;
} DTStructureExSetTime_typ;
typedef struct UtcDTStructureGetTime
{
/* VAR_INPUT (analog) */
unsigned long pDTStructure;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR_INPUT (digital) */
plcbit enable;
} UtcDTStructureGetTime_typ;
typedef struct UtcDTStructureSetTime
{
/* VAR_INPUT (analog) */
unsigned long pDTStructure;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UtcDTStructureSetTime_typ;
typedef struct UtcDTStructureExSetTime
{
/* VAR_INPUT (analog) */
unsigned long pDTStructure;
unsigned char Option;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UtcDTStructureExSetTime_typ;
typedef struct UtcDT_TO_LocalDTStructure
{
/* VAR_INPUT (analog) */
plcdt DT1;
unsigned long pDTStructure;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UtcDT_TO_LocalDTStructure_typ;
typedef struct LocalDT_TO_UtcDTStructure
{
/* VAR_INPUT (analog) */
plcdt DT1;
unsigned long pDTStructure;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} LocalDT_TO_UtcDTStructure_typ;
typedef struct UtcDTStructure_TO_LocalDT
{
/* VAR_INPUT (analog) */
unsigned long pDTStructure;
/* VAR_OUTPUT (analog) */
plcdt DT1;
unsigned short status;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} UtcDTStructure_TO_LocalDT_typ;
typedef struct LocalDTStructure_TO_UtcDT
{
/* VAR_INPUT (analog) */
unsigned long pDTStructure;
/* VAR_OUTPUT (analog) */
plcdt DT1;
unsigned short status;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} LocalDTStructure_TO_UtcDT_typ;
typedef struct TimeDeviceGetInfo
{
/* VAR_INPUT (analog) */
unsigned long pServer;
unsigned char len;
/* VAR_OUTPUT (analog) */
unsigned char timeDevice;
float avgDeviation;
unsigned short status;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} TimeDeviceGetInfo_typ;
typedef struct DstGetInfo
{
/* VAR_INPUT (analog) */
unsigned long pDTStructure;
/* VAR_OUTPUT (analog) */
unsigned char dstState;
unsigned short status;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} DstGetInfo_typ;
typedef struct DstGetInfoDT
{
/* VAR_INPUT (analog) */
plcdt DT1;
/* VAR_OUTPUT (analog) */
unsigned char dstState;
unsigned short status;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} DstGetInfoDT_typ;
/* Prototyping of functions and function blocks */
void DTExSetTime(struct DTExSetTime* inst);
void DTSetTime(struct DTSetTime* inst);
void DTGetTime(struct DTGetTime* inst);
void UtcDTGetTime(struct UtcDTGetTime* inst);
void UtcDTSetTime(struct UtcDTSetTime* inst);
void UtcDTExSetTime(struct UtcDTExSetTime* inst);
void DTStructureGetTime(struct DTStructureGetTime* inst);
void DTStructureSetTime(struct DTStructureSetTime* inst);
void DTStructureExSetTime(struct DTStructureExSetTime* inst);
void UtcDTStructureGetTime(struct UtcDTStructureGetTime* inst);
void UtcDTStructureSetTime(struct UtcDTStructureSetTime* inst);
void UtcDTStructureExSetTime(struct UtcDTStructureExSetTime* inst);
void UtcDT_TO_LocalDTStructure(struct UtcDT_TO_LocalDTStructure* inst);
void LocalDT_TO_UtcDTStructure(struct LocalDT_TO_UtcDTStructure* inst);
void UtcDTStructure_TO_LocalDT(struct UtcDTStructure_TO_LocalDT* inst);
void LocalDTStructure_TO_UtcDT(struct LocalDTStructure_TO_UtcDT* inst);
void TimeDeviceGetInfo(struct TimeDeviceGetInfo* inst);
void DstGetInfo(struct DstGetInfo* inst);
void DstGetInfoDT(struct DstGetInfoDT* inst);
plctime clock_ms();
unsigned long ascTIMEStructure(unsigned long pTIMEStructure, unsigned long pStr, unsigned long len);
unsigned long ascDTStructure(unsigned long pDTStructure, unsigned long pStr, unsigned long len);
unsigned long ascTIME(plctime TIME1, unsigned long pStr, unsigned long len);
unsigned long ascDT(plcdt DT1, unsigned long pStr, unsigned long len);
plctime TIMEStructure_TO_TIME(unsigned long pTIMEStructure);
unsigned long TIME_TO_TIMEStructure(plctime TIME1, unsigned long pTIMEStructure);
plcdt DTStructure_TO_DT(unsigned long pDTStructure);
unsigned long DT_TO_DTStructure(plcdt DT1, unsigned long pDTStructure);
unsigned long DiffT(plctime TIME2, plctime TIME1);
unsigned long DiffDT(plcdt DT2, plcdt DT1);
#ifdef __cplusplus
};
#endif
#endif /* _ASTIME_ */

View File

@@ -0,0 +1,130 @@
/* Automation Studio generated header file */
/* Do not edit ! */
#ifndef _ASTIME_
#define _ASTIME_
#ifdef __cplusplus
extern "C"
{
#endif
#include <bur/plctypes.h>
#include <runtime.h>
#ifndef _IEC_CONST
#define _IEC_CONST _WEAK const
#endif
/* Constants */
#ifdef _REPLACE_CONST
#define timERR_AR 33213U
#define timERR_INVALID_DTSTRUCTURE 33212U
#define timERR_INVALID_LEN 33211U
#define timERR_INVALID_PARAMETER 33210U
#define timTIME_SERVER 2U
#define timREAL_TIME_CLOCK 1U
#define timNO_DST 3U
#define timDAYLIGHT_SAVING_TIME 2U
#define timNORMAL_TIME 1U
#define TIME_MAX 2073600000
#define TIME_MIN (-2073600000)
#define DATE_AND_TIME_MAX 4102444799U
#define timEXSETTIME_NO_OPTION 0U
#define timEXSETTIME_NO_LOGENTRY 1U
#else
_IEC_CONST unsigned short timERR_AR = 33213U;
_IEC_CONST unsigned short timERR_INVALID_DTSTRUCTURE = 33212U;
_IEC_CONST unsigned short timERR_INVALID_LEN = 33211U;
_IEC_CONST unsigned short timERR_INVALID_PARAMETER = 33210U;
_IEC_CONST unsigned char timTIME_SERVER = 2U;
_IEC_CONST unsigned char timREAL_TIME_CLOCK = 1U;
_IEC_CONST unsigned char timNO_DST = 3U;
_IEC_CONST unsigned char timDAYLIGHT_SAVING_TIME = 2U;
_IEC_CONST unsigned char timNORMAL_TIME = 1U;
_IEC_CONST signed long TIME_MAX = 2073600000;
_IEC_CONST signed long TIME_MIN = -2073600000;
_IEC_CONST unsigned long DATE_AND_TIME_MAX = 4102444799U;
_IEC_CONST unsigned char timEXSETTIME_NO_OPTION = 0U;
_IEC_CONST unsigned char timEXSETTIME_NO_LOGENTRY = 1U;
#endif
/* Datatypes and datatypes of function blocks */
typedef struct TIMEStructure
{ signed char day;
unsigned char hour;
unsigned char minute;
unsigned char second;
unsigned short millisec;
unsigned short microsec;
} TIMEStructure;
typedef struct DTStructure
{ unsigned short year;
unsigned char month;
unsigned char day;
unsigned char wday;
unsigned char hour;
unsigned char minute;
unsigned char second;
unsigned short millisec;
unsigned short microsec;
} DTStructure;
typedef struct DTExSetTime
{
/* VAR_INPUT (analog) */
plcdt DT1;
unsigned char Option;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR_INPUT (digital) */
plcbit enable;
} DTExSetTime_typ;
typedef struct DTSetTime
{
/* VAR_INPUT (analog) */
plcdt DT1;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR_INPUT (digital) */
plcbit enable;
} DTSetTime_typ;
typedef struct DTGetTime
{
/* VAR_OUTPUT (analog) */
unsigned short status;
plcdt DT1;
/* VAR_INPUT (digital) */
plcbit enable;
} DTGetTime_typ;
/* Prototyping of functions and function blocks */
void DTExSetTime(struct DTExSetTime* inst);
void DTSetTime(struct DTSetTime* inst);
void DTGetTime(struct DTGetTime* inst);
unsigned long ascTIMEStructure(unsigned long pTIMEStructure, unsigned long pStr, unsigned long len);
unsigned long ascDTStructure(unsigned long pDTStructure, unsigned long pStr, unsigned long len);
unsigned long ascTIME(plctime TIME1, unsigned long pStr, unsigned long len);
unsigned long ascDT(plcdt DT1, unsigned long pStr, unsigned long len);
plctime TIMEStructure_TO_TIME(unsigned long pTIMEStructure);
unsigned long TIME_TO_TIMEStructure(plctime TIME1, unsigned long pTIMEStructure);
plcdt DTStructure_TO_DT(unsigned long pDTStructure);
unsigned long DT_TO_DTStructure(plcdt DT1, unsigned long pDTStructure);
unsigned long DiffT(plctime TIME2, plctime TIME1);
unsigned long DiffDT(plcdt DT2, plcdt DT1);
#ifdef __cplusplus
};
#endif
#endif /* _ASTIME_ */

View File

@@ -0,0 +1,342 @@
(********************************************************************
* COPYRIGHT -- Bernecker + Rainer
********************************************************************
* Library: astime
* File: astime.fun
* Author: B+R
********************************************************************
* Functions and function blocks of library astime
********************************************************************)
FUNCTION_BLOCK DTExSetTime (*sets the current time using the DATE_AND_TIME data type*)
VAR_INPUT
enable :BOOL; (*enables execution*)
DT1 :DATE_AND_TIME; (*date and time to be written*)
Option :USINT; (*additional option: timEXSETTIME_NO_OPTION, timEXSETTIME_NO_LOGENTRY*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK DTSetTime (*sets current time in DATE_AND_TIME data type*)
VAR_INPUT
enable :BOOL; (*enables execution*)
DT1 :DATE_AND_TIME; (*date and time to be written*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK DTGetTime (*reads the current time in the DATE_AND_TIME data type*)
VAR_INPUT
enable :BOOL; (*enables execution*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
DT1 :DATE_AND_TIME; (*date and time read*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION clock_ms : TIME (*provides a continuous millisecond counter in the TIME data type*)
END_FUNCTION
FUNCTION_BLOCK UtcDTGetTime (*reads the current UTC-time in the DATE_AND_TIME data type*)
VAR_INPUT
enable :BOOL; (*enables execution*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
DT1 :DATE_AND_TIME; (*UTC date and time read*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK UtcDTSetTime (*sets current UTC-time in DATE_AND_TIME data type*)
VAR_INPUT
enable :BOOL; (*enables execution*)
DT1 :DATE_AND_TIME; (*UTC date and time to be written*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
END_VAR
VAR
i_state : UINT; (*internal variable*)
i_result : UINT; (*internal variable*)
i_tmp : UDINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK UtcDTExSetTime (*sets current UTC-time in DATE_AND_TIME data type*)
VAR_INPUT
enable :BOOL; (*enables execution*)
DT1 :DATE_AND_TIME; (*UTC date and time to be written*)
Option :USINT; (*additional option: timEXSETTIME_NO_OPTION, timEXSETTIME_NO_LOGENTRY*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
END_VAR
VAR
i_state : UINT; (*internal variable*)
i_result : UINT; (*internal variable*)
i_tmp : UDINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK DTStructureGetTime (*reads the current time in the calendar structure*)
VAR_INPUT
enable :BOOL; (*enables execution*)
pDTStructure :UDINT; (*address of the calendar structure*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK DTStructureSetTime (*sets current time in calendar structure*)
VAR_INPUT
enable :BOOL; (*enables execution*)
pDTStructure :UDINT; (*address of the calendar structure*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK DTStructureExSetTime (*sets current time in calendar structure*)
VAR_INPUT
enable :BOOL; (*enables execution*)
pDTStructure :UDINT; (*address of the calendar structure*)
Option :USINT; (*additional option: timEXSETTIME_NO_OPTION, timEXSETTIME_NO_LOGENTRY*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK UtcDTStructureGetTime (*reads the UTC time in the calendar structure*)
VAR_INPUT
enable :BOOL; (*enables execution*)
pDTStructure :UDINT; (*address of the calendar structure*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK UtcDTStructureSetTime (*sets UTC time in calendar structure*)
VAR_INPUT
enable :BOOL; (*enables execution*)
pDTStructure :UDINT; (*address of the calendar structure*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
END_VAR
VAR
i_state : UINT; (*internal variable*)
i_result : UINT; (*internal variable*)
i_tmp : UDINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK UtcDTStructureExSetTime (*sets UTC time in calendar structure*)
VAR_INPUT
enable :BOOL; (*enables execution*)
pDTStructure :UDINT; (*address of the calendar structure*)
Option :USINT; (*additional option: timEXSETTIME_NO_OPTION, timEXSETTIME_NO_LOGENTRY*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
END_VAR
VAR
i_state : UINT; (*internal variable*)
i_result : UINT; (*internal variable*)
i_tmp : UDINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK UtcDT_TO_LocalDTStructure (*sets current UTC-time in DATE_AND_TIME data type*)
VAR_INPUT
enable :BOOL; (*enables execution*)
DT1 :DATE_AND_TIME; (*UTC date and time*)
pDTStructure :UDINT; (*address of the calendar structure*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
END_VAR
VAR
i_state : UINT; (*internal variable*)
i_result : UINT; (*internal variable*)
i_tmp : UDINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK LocalDT_TO_UtcDTStructure (*sets current UTC-time in DATE_AND_TIME data type*)
VAR_INPUT
enable :BOOL; (*enables execution*)
DT1 :DATE_AND_TIME; (*Local date and time*)
pDTStructure :UDINT; (*address of the calendar structure*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
END_VAR
VAR
i_state : UINT; (*internal variable*)
i_result : UINT; (*internal variable*)
i_tmp : UDINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK UtcDTStructure_TO_LocalDT (*sets current UTC-time in DATE_AND_TIME data type*)
VAR_INPUT
enable :BOOL; (*enables execution*)
pDTStructure :UDINT; (*address of the calendar structure*)
END_VAR
VAR_OUTPUT
DT1 :DATE_AND_TIME; (*Local date and time*)
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
END_VAR
VAR
i_state : UINT; (*internal variable*)
i_result : UINT; (*internal variable*)
i_tmp : UDINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK LocalDTStructure_TO_UtcDT (*sets current UTC-time in DATE_AND_TIME data type*)
VAR_INPUT
enable :BOOL; (*enables execution*)
pDTStructure :UDINT; (*address of the calendar structure*)
END_VAR
VAR_OUTPUT
DT1 :DATE_AND_TIME; (*UTC date and time*)
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
END_VAR
VAR
i_state : UINT; (*internal variable*)
i_result : UINT; (*internal variable*)
i_tmp : UDINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION ascTIMEStructure : UDINT (*converts a "time" structure to a character string in the format "15:14:13\0"*)
VAR_INPUT
pTIMEStructure :UDINT; (*address of the time structure*)
pStr :UDINT; (*address of the character field*)
len :UDINT; (*length of the character field *)
END_VAR
END_FUNCTION
FUNCTION ascDTStructure : UDINT (*converts a "date" structure to a character string in the format "Sun Jan 3 15:14:13 1988\0"*)
VAR_INPUT
pDTStructure :UDINT; (*address of the calendar structure *)
pStr :UDINT; (*address of the character field*)
len :UDINT; (*length of the character field*)
END_VAR
END_FUNCTION
FUNCTION ascTIME : UDINT (*converts the TIME data type to a character string in the format "15:14:13\0"*)
VAR_INPUT
TIME1 :TIME; (*time*)
pStr :UDINT; (*address of the character field*)
len :UDINT; (*length of the character field*)
END_VAR
END_FUNCTION
FUNCTION ascDT : UDINT (*converts the DATE_AND_TIME data type to character string in the format "Sun Jan 3 15:14:13 1988\0"*)
VAR_INPUT
DT1 :DATE_AND_TIME; (*date and time*)
pStr :UDINT; (*address of the character field*)
len :UDINT; (*length of the character field*)
END_VAR
END_FUNCTION
FUNCTION TIMEStructure_TO_TIME : TIME (*converts a "time" structure to the TIME data type*)
VAR_INPUT
pTIMEStructure :UDINT; (*address of the time structure*)
END_VAR
END_FUNCTION
FUNCTION TIME_TO_TIMEStructure : UDINT (*converts the TIME data type to a "time" structure*)
VAR_INPUT
TIME1 :TIME; (*time*)
pTIMEStructure :UDINT; (*address of the calendar structure*)
END_VAR
END_FUNCTION
FUNCTION DTStructure_TO_DT : DATE_AND_TIME (*converts a "date" structure to the DATE_AND_TIME data type*)
VAR_INPUT
pDTStructure :UDINT; (*address of the calendar structure*)
END_VAR
END_FUNCTION
FUNCTION DT_TO_DTStructure : UDINT (*converts the DATE_AND_TIME data type to a "date" structure*)
VAR_INPUT
DT1 :DATE_AND_TIME; (*date and time*)
pDTStructure :UDINT; (*address of the calendar structure*)
END_VAR
END_FUNCTION
FUNCTION DiffT : UDINT (*shows the difference between two times (TIME data type) expressed in milliseconds*)
VAR_INPUT
TIME2 :TIME; (*time 2*)
TIME1 :TIME; (*time 1*)
END_VAR
END_FUNCTION
FUNCTION DiffDT : UDINT (*shows the difference between two times (DATE_AND_TIME data type) expressed in seconds*)
VAR_INPUT
DT2 :DATE_AND_TIME; (*date and time 2*)
DT1 :DATE_AND_TIME; (*date and time 1*)
END_VAR
END_FUNCTION
FUNCTION_BLOCK TimeDeviceGetInfo (*read information about time device*)
VAR_INPUT
enable :BOOL; (*enables execution*)
pServer :UDINT; (*Pointer to string*)
len :USINT; (*length of pServer*)
END_VAR
VAR_OUTPUT
timeDevice :USINT; (*sntpREAL_TIME_CLOCK or sntpTIME_SERVER*)
avgDeviation :REAL; (*average deviation between software time and time device*)
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
END_VAR
VAR
i_state :UINT; (*internal variable*)
i_result :UINT; (*internal variable*)
i_tmp :UDINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK DstGetInfo (*read information about time device*)
VAR_INPUT
enable :BOOL; (*enables execution*)
pDTStructure :UDINT; (*Pointer to DTStructure*)
END_VAR
VAR_OUTPUT
dstState :USINT; (*timDAYLIGHT_SAVING_TIME, timNORMAL_TIME or timNO_DST*)
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
END_VAR
VAR
i_state :UINT; (*internal variable*)
i_result :UINT; (*internal variable*)
i_tmp :UDINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK DstGetInfoDT (*read information about time device*)
VAR_INPUT
enable :BOOL; (*enables execution*)
DT1 :DATE_AND_TIME; (*date and time in UTC*)
END_VAR
VAR_OUTPUT
dstState :USINT; (*timDAYLIGHT_SAVING_TIME, timNORMAL_TIME or timNO_DST*)
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
END_VAR
VAR
i_state :UINT; (*internal variable*)
i_result :UINT; (*internal variable*)
i_tmp :UDINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK

View File

@@ -0,0 +1,31 @@
(********************************************************************
* COPYRIGHT -- Bernecker + Rainer
********************************************************************
* Library: astime
* File: astime.typ
* Author: B+R
********************************************************************
* Data types of library astime
********************************************************************)
TYPE
TIMEStructure : STRUCT (*time structure*)
day : SINT ; (*day (1-31)*)
hour : USINT ; (*hours (0-23)*)
minute : USINT ; (*minutes (0-59)*)
second : USINT ; (*seconds (0-59)*)
millisec : UINT ; (*milliseconds (0-999)*)
microsec : UINT ; (*microseconds (0-999)*)
END_STRUCT;
DTStructure : STRUCT (*date structure*)
year : UINT ; (*year*)
month : USINT ; (*month (1-12)*)
day : USINT ; (*day (1-31)*)
wday : USINT ; (*day of the week (0-6), e.g. 0 = Sunday, 6 = Saturday*)
hour : USINT ; (*hours (0-23)*)
minute : USINT ; (*minutes (0-59)*)
second : USINT ; (*seconds (0-59)*)
millisec : UINT ; (*milliseconds (0-999)*)
microsec : UINT ; (*microseconds (0-999)*)
END_STRUCT;
END_TYPE

View File

@@ -0,0 +1,26 @@
(********************************************************************
* COPYRIGHT -- Bernecker + Rainer
********************************************************************
* Library: astime
* File: astime.var
* Author: B+R
********************************************************************
* Local variables of library astime
********************************************************************)
VAR CONSTANT
timEXSETTIME_NO_LOGENTRY : USINT := 1;
timEXSETTIME_NO_OPTION : USINT := 0;
DATE_AND_TIME_MAX : UDINT := 4102444799;
TIME_MIN : DINT := -2073600000;
TIME_MAX : DINT := 2073600000;
timNORMAL_TIME : USINT := 1;
timDAYLIGHT_SAVING_TIME : USINT := 2;
timNO_DST : USINT := 3;
timREAL_TIME_CLOCK : USINT := 1;
timTIME_SERVER : USINT := 2;
timERR_INVALID_PARAMETER : UINT := 33210;
timERR_INVALID_LEN : UINT := 33211;
timERR_INVALID_DTSTRUCTURE : UINT := 33212;
timERR_AR : UINT := 33213;
END_VAR

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=3.0.0.0?>
<Library xmlns="http://br-automation.co.at/AS/Library" Description="The BRSystem library provides the user with a number of system functions for e.g. handling permanent memory, accessing exception information, etc.">
<Files>
<File>brsystem.var</File>
<File>brsystem.fun</File>
</Files>
<Dependencies>
<Dependency ObjectName="runtime" />
</Dependencies>
</Library>

View File

@@ -0,0 +1,271 @@
/* Automation Studio generated header file */
/* Do not edit ! */
#ifndef _BRSYSTEM_
#define _BRSYSTEM_
#ifdef __cplusplus
extern "C"
{
#endif
#include <bur/plctypes.h>
#include <runtime.h>
#ifndef _IEC_CONST
#define _IEC_CONST _WEAK const
#endif
/* Constants */
#ifdef _REPLACE_CONST
#define brX2X 10U
#define brPP 255U
#define brCPU 1U
#define brKEY 8U
#define brDRAM 0U
#define br2003 2U
#define br2005 1U
#define br2010 0U
#define brC200 9U
#define brC300 8U
#define brADDON 7U
#define brPANEL 6U
#define brGLOBAL_REMANENT_PV 5U
#define brLOCAL_REMANENT_PV 4U
#define brUSRROM 3U
#define brSYSROM 2U
#define brUSRRAM 1U
#define brACOPOS 7U
#define brCAN_IO 5U
#define brBASE_IO 3U
#define brPRODUCT 0U
#define brETHER_IO 6U
#define brNO_FAMILY 255U
#define brREMOTE_IO 4U
#define brBATTERY_OK 1U
#define brPOWERPANEL 5U
#define brBATTERY_LOW 0U
#define brLOGICSCANNER 3U
#define brPLUGIN_MODULE 10U
#define brSYSTEM_MODULE 2U
#define brBATTERY_NOTEST 2U
#define TARGET_BIG_ENDIAN 2U
#define brBATTERY_MISSING 3U
#define INIT_REASON_UNKNOWN (-1)
#define INIT_REASON_DOWNLOAD 3
#define TARGET_LITTLE_ENDIAN 1U
#define brAUTOMATION_RUNTIME 4U
#define brERR_INVALID_DEVICE 27250U
#define INIT_REASON_COLDSTART 2
#define INIT_REASON_WARMSTART 1
#define brSYSCONF_SET_VOLATILE 0
#define brERR_INVALID_PARAMETER 27251U
#define brSYSCONF_SET_NON_VOLATILE 1
#else
_IEC_CONST unsigned char brX2X = 10U;
_IEC_CONST unsigned char brPP = 255U;
_IEC_CONST unsigned char brCPU = 1U;
_IEC_CONST unsigned char brKEY = 8U;
_IEC_CONST unsigned long brDRAM = 0U;
_IEC_CONST unsigned char br2003 = 2U;
_IEC_CONST unsigned char br2005 = 1U;
_IEC_CONST unsigned char br2010 = 0U;
_IEC_CONST unsigned char brC200 = 9U;
_IEC_CONST unsigned char brC300 = 8U;
_IEC_CONST unsigned char brADDON = 7U;
_IEC_CONST unsigned char brPANEL = 6U;
_IEC_CONST unsigned long brGLOBAL_REMANENT_PV = 5U;
_IEC_CONST unsigned long brLOCAL_REMANENT_PV = 4U;
_IEC_CONST unsigned long brUSRROM = 3U;
_IEC_CONST unsigned long brSYSROM = 2U;
_IEC_CONST unsigned long brUSRRAM = 1U;
_IEC_CONST unsigned char brACOPOS = 7U;
_IEC_CONST unsigned char brCAN_IO = 5U;
_IEC_CONST unsigned char brBASE_IO = 3U;
_IEC_CONST unsigned char brPRODUCT = 0U;
_IEC_CONST unsigned char brETHER_IO = 6U;
_IEC_CONST unsigned char brNO_FAMILY = 255U;
_IEC_CONST unsigned char brREMOTE_IO = 4U;
_IEC_CONST unsigned char brBATTERY_OK = 1U;
_IEC_CONST unsigned char brPOWERPANEL = 5U;
_IEC_CONST unsigned char brBATTERY_LOW = 0U;
_IEC_CONST unsigned char brLOGICSCANNER = 3U;
_IEC_CONST unsigned char brPLUGIN_MODULE = 10U;
_IEC_CONST unsigned char brSYSTEM_MODULE = 2U;
_IEC_CONST unsigned char brBATTERY_NOTEST = 2U;
_IEC_CONST unsigned char TARGET_BIG_ENDIAN = 2U;
_IEC_CONST unsigned char brBATTERY_MISSING = 3U;
_IEC_CONST signed char INIT_REASON_UNKNOWN = -1;
_IEC_CONST signed char INIT_REASON_DOWNLOAD = 3;
_IEC_CONST unsigned char TARGET_LITTLE_ENDIAN = 1U;
_IEC_CONST unsigned char brAUTOMATION_RUNTIME = 4U;
_IEC_CONST unsigned short brERR_INVALID_DEVICE = 27250U;
_IEC_CONST signed char INIT_REASON_COLDSTART = 2;
_IEC_CONST signed char INIT_REASON_WARMSTART = 1;
_IEC_CONST plcbit brSYSCONF_SET_VOLATILE = 0;
_IEC_CONST unsigned short brERR_INVALID_PARAMETER = 27251U;
_IEC_CONST plcbit brSYSCONF_SET_NON_VOLATILE = 1;
#endif
/* Datatypes and datatypes of function blocks */
typedef struct MEMInfo
{
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned long FreeUSR_Ram;
unsigned long FreeSYSTEM;
unsigned long FreeUSR_Prom;
unsigned long FreeSYS_Prom;
unsigned long FreeFIX_Ram;
unsigned long FreeTMP_Ram;
unsigned long FreeMEMCARD;
/* VAR_INPUT (digital) */
plcbit enable;
} MEMInfo_typ;
typedef struct SysInfo
{
/* VAR_OUTPUT (analog) */
unsigned char init_reason;
unsigned char init_count;
unsigned long tick_count;
unsigned long version;
/* VAR_INPUT (digital) */
plcbit enable;
} SysInfo_typ;
typedef struct RTInfo
{
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned long cycle_time;
signed char init_reason;
signed char task_class;
/* VAR_INPUT (digital) */
plcbit enable;
} RTInfo_typ;
typedef struct TARGETInfo
{
/* VAR_INPUT (analog) */
unsigned long pOSVersion;
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned char DataFormat;
/* VAR_INPUT (digital) */
plcbit enable;
} TARGETInfo_typ;
typedef struct HWInfo
{
/* VAR_INPUT (analog) */
unsigned long pName;
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned char family;
unsigned char usetype;
unsigned long module_typ;
unsigned char master_no;
unsigned char slave_no;
unsigned char module_adr;
unsigned char slot_no;
/* VAR (analog) */
unsigned long next_vw_p;
unsigned long last_modul_p;
unsigned long next_entry_p;
unsigned char next_entry_ix;
unsigned char next_slot_ix;
unsigned char last_rio_master;
/* VAR_INPUT (digital) */
plcbit enable;
plcbit first;
} HWInfo_typ;
typedef struct BatteryInfo
{
/* VAR_INPUT (analog) */
unsigned long pDevice;
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned char state;
/* VAR_INPUT (digital) */
plcbit enable;
} BatteryInfo_typ;
typedef struct EXCInfo
{
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned long task_class;
unsigned long task_ident;
/* VAR_INPUT (digital) */
plcbit enable;
} EXCInfo_typ;
typedef struct ZYKVLenable
{
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR_INPUT (digital) */
plcbit enable;
plcbit mode;
} ZYKVLenable_typ;
typedef struct PMemGet
{
/* VAR_INPUT (analog) */
unsigned long offset;
unsigned long len;
unsigned long adress;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR_INPUT (digital) */
plcbit enable;
} PMemGet_typ;
typedef struct PMemPut
{
/* VAR_INPUT (analog) */
unsigned long offset;
unsigned long len;
unsigned long adress;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR_INPUT (digital) */
plcbit enable;
} PMemPut_typ;
typedef struct PMemSize
{
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned long size;
/* VAR_INPUT (digital) */
plcbit enable;
} PMemSize_typ;
/* Prototyping of functions and function blocks */
void MEMInfo(struct MEMInfo* inst);
void SysInfo(struct SysInfo* inst);
void RTInfo(struct RTInfo* inst);
void TARGETInfo(struct TARGETInfo* inst);
void HWInfo(struct HWInfo* inst);
void BatteryInfo(struct BatteryInfo* inst);
void EXCInfo(struct EXCInfo* inst);
void ZYKVLenable(struct ZYKVLenable* inst);
void PMemGet(struct PMemGet* inst);
void PMemPut(struct PMemPut* inst);
void PMemSize(struct PMemSize* inst);
#ifdef __cplusplus
};
#endif
#endif /* _BRSYSTEM_ */

View File

@@ -0,0 +1,258 @@
/* Automation Studio generated header file */
/* Do not edit ! */
#ifndef _BRSYSTEM_
#define _BRSYSTEM_
#ifdef __cplusplus
extern "C"
{
#endif
#include <bur/plctypes.h>
#include <runtime.h>
#ifndef _IEC_CONST
#define _IEC_CONST _WEAK const
#endif
/* Constants */
#ifdef _REPLACE_CONST
#define brX2X 10U
#define brPP 255U
#define brCPU 1U
#define brKEY 8U
#define brDRAM 0U
#define br2003 2U
#define br2005 1U
#define br2010 0U
#define brC200 9U
#define brC300 8U
#define brADDON 7U
#define brPANEL 6U
#define brGLOBAL_REMANENT_PV 5U
#define brLOCAL_REMANENT_PV 4U
#define brUSRROM 3U
#define brSYSROM 2U
#define brUSRRAM 1U
#define brACOPOS 7U
#define brCAN_IO 5U
#define brBASE_IO 3U
#define brPRODUCT 0U
#define brETHER_IO 6U
#define brNO_FAMILY 255U
#define brREMOTE_IO 4U
#define brBATTERY_OK 1U
#define brPOWERPANEL 5U
#define brBATTERY_LOW 0U
#define brLOGICSCANNER 3U
#define brPLUGIN_MODULE 10U
#define brSYSTEM_MODULE 2U
#define brBATTERY_NOTEST 2U
#define TARGET_BIG_ENDIAN 2U
#define brBATTERY_MISSING 3U
#define INIT_REASON_UNKNOWN (-1)
#define INIT_REASON_DOWNLOAD 3
#define TARGET_LITTLE_ENDIAN 1U
#define brAUTOMATION_RUNTIME 4U
#define brERR_INVALID_DEVICE 27250U
#define INIT_REASON_COLDSTART 2
#define INIT_REASON_WARMSTART 1
#define brSYSCONF_SET_VOLATILE 0
#define brERR_INVALID_PARAMETER 27251U
#define brSYSCONF_SET_NON_VOLATILE 1
#else
_IEC_CONST unsigned char brX2X = 10U;
_IEC_CONST unsigned char brPP = 255U;
_IEC_CONST unsigned char brCPU = 1U;
_IEC_CONST unsigned char brKEY = 8U;
_IEC_CONST unsigned long brDRAM = 0U;
_IEC_CONST unsigned char br2003 = 2U;
_IEC_CONST unsigned char br2005 = 1U;
_IEC_CONST unsigned char br2010 = 0U;
_IEC_CONST unsigned char brC200 = 9U;
_IEC_CONST unsigned char brC300 = 8U;
_IEC_CONST unsigned char brADDON = 7U;
_IEC_CONST unsigned char brPANEL = 6U;
_IEC_CONST unsigned long brGLOBAL_REMANENT_PV = 5U;
_IEC_CONST unsigned long brLOCAL_REMANENT_PV = 4U;
_IEC_CONST unsigned long brUSRROM = 3U;
_IEC_CONST unsigned long brSYSROM = 2U;
_IEC_CONST unsigned long brUSRRAM = 1U;
_IEC_CONST unsigned char brACOPOS = 7U;
_IEC_CONST unsigned char brCAN_IO = 5U;
_IEC_CONST unsigned char brBASE_IO = 3U;
_IEC_CONST unsigned char brPRODUCT = 0U;
_IEC_CONST unsigned char brETHER_IO = 6U;
_IEC_CONST unsigned char brNO_FAMILY = 255U;
_IEC_CONST unsigned char brREMOTE_IO = 4U;
_IEC_CONST unsigned char brBATTERY_OK = 1U;
_IEC_CONST unsigned char brPOWERPANEL = 5U;
_IEC_CONST unsigned char brBATTERY_LOW = 0U;
_IEC_CONST unsigned char brLOGICSCANNER = 3U;
_IEC_CONST unsigned char brPLUGIN_MODULE = 10U;
_IEC_CONST unsigned char brSYSTEM_MODULE = 2U;
_IEC_CONST unsigned char brBATTERY_NOTEST = 2U;
_IEC_CONST unsigned char TARGET_BIG_ENDIAN = 2U;
_IEC_CONST unsigned char brBATTERY_MISSING = 3U;
_IEC_CONST signed char INIT_REASON_UNKNOWN = -1;
_IEC_CONST signed char INIT_REASON_DOWNLOAD = 3;
_IEC_CONST unsigned char TARGET_LITTLE_ENDIAN = 1U;
_IEC_CONST unsigned char brAUTOMATION_RUNTIME = 4U;
_IEC_CONST unsigned short brERR_INVALID_DEVICE = 27250U;
_IEC_CONST signed char INIT_REASON_COLDSTART = 2;
_IEC_CONST signed char INIT_REASON_WARMSTART = 1;
_IEC_CONST plcbit brSYSCONF_SET_VOLATILE = 0;
_IEC_CONST unsigned short brERR_INVALID_PARAMETER = 27251U;
_IEC_CONST plcbit brSYSCONF_SET_NON_VOLATILE = 1;
#endif
/* Datatypes and datatypes of function blocks */
typedef struct MEMInfo
{
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned long FreeUSR_Ram;
unsigned long FreeSYSTEM;
unsigned long FreeUSR_Prom;
unsigned long FreeSYS_Prom;
unsigned long FreeFIX_Ram;
unsigned long FreeTMP_Ram;
unsigned long FreeMEMCARD;
/* VAR_INPUT (digital) */
plcbit enable;
} MEMInfo_typ;
typedef struct MEMxInfo
{
/* VAR_INPUT (analog) */
unsigned long mem_typ;
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned long MemSize;
unsigned long FreeMemSize;
unsigned long BiggestFreeBlockSize;
/* VAR (analog) */
unsigned short i_state;
unsigned short i_result;
unsigned long i_tmp;
/* VAR_INPUT (digital) */
plcbit enable;
} MEMxInfo_typ;
typedef struct SysInfo
{
/* VAR_OUTPUT (analog) */
unsigned char init_reason;
unsigned char init_count;
unsigned long tick_count;
unsigned long version;
/* VAR_INPUT (digital) */
plcbit enable;
} SysInfo_typ;
typedef struct RTInfo
{
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned long cycle_time;
signed char init_reason;
signed char task_class;
/* VAR_INPUT (digital) */
plcbit enable;
} RTInfo_typ;
typedef struct TARGETInfo
{
/* VAR_INPUT (analog) */
unsigned long pOSVersion;
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned char DataFormat;
/* VAR_INPUT (digital) */
plcbit enable;
} TARGETInfo_typ;
typedef struct HWInfo
{
/* VAR_INPUT (analog) */
unsigned long pName;
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned char family;
unsigned char usetype;
unsigned long module_typ;
unsigned char master_no;
unsigned char slave_no;
unsigned char module_adr;
unsigned char slot_no;
/* VAR (analog) */
unsigned long next_vw_p;
unsigned long last_modul_p;
unsigned long next_entry_p;
unsigned char next_entry_ix;
unsigned char next_slot_ix;
unsigned char last_rio_master;
/* VAR_INPUT (digital) */
plcbit enable;
plcbit first;
} HWInfo_typ;
typedef struct SysconfInfo
{
/* VAR_INPUT (analog) */
unsigned long pEntry;
unsigned long pValue;
unsigned long value_len;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR_INPUT (digital) */
plcbit enable;
} SysconfInfo_typ;
typedef struct SysconfSet
{
/* VAR_INPUT (analog) */
unsigned long pEntry;
unsigned long pNewValue;
unsigned char option;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR_INPUT (digital) */
plcbit enable;
} SysconfSet_typ;
typedef struct BatteryInfo
{
/* VAR_INPUT (analog) */
unsigned long pDevice;
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned char state;
/* VAR_INPUT (digital) */
plcbit enable;
} BatteryInfo_typ;
/* Prototyping of functions and function blocks */
void MEMInfo(struct MEMInfo* inst);
void MEMxInfo(struct MEMxInfo* inst);
void SysInfo(struct SysInfo* inst);
void RTInfo(struct RTInfo* inst);
void TARGETInfo(struct TARGETInfo* inst);
void HWInfo(struct HWInfo* inst);
void SysconfInfo(struct SysconfInfo* inst);
void SysconfSet(struct SysconfSet* inst);
void BatteryInfo(struct BatteryInfo* inst);
#ifdef __cplusplus
};
#endif
#endif /* _BRSYSTEM_ */

View File

@@ -0,0 +1,238 @@
/* Automation Studio generated header file */
/* Do not edit ! */
#ifndef _BRSYSTEM_
#define _BRSYSTEM_
#ifdef __cplusplus
extern "C"
{
#endif
#include <bur/plctypes.h>
#include <runtime.h>
#ifndef _IEC_CONST
#define _IEC_CONST _WEAK const
#endif
/* Constants */
#ifdef _REPLACE_CONST
#define brX2X 10U
#define brPP 255U
#define brCPU 1U
#define brKEY 8U
#define brDRAM 0U
#define br2003 2U
#define br2005 1U
#define br2010 0U
#define brC200 9U
#define brC300 8U
#define brADDON 7U
#define brPANEL 6U
#define brGLOBAL_REMANENT_PV 5U
#define brLOCAL_REMANENT_PV 4U
#define brUSRROM 3U
#define brSYSROM 2U
#define brUSRRAM 1U
#define brACOPOS 7U
#define brCAN_IO 5U
#define brBASE_IO 3U
#define brPRODUCT 0U
#define brETHER_IO 6U
#define brNO_FAMILY 255U
#define brREMOTE_IO 4U
#define brBATTERY_OK 1U
#define brPOWERPANEL 5U
#define brBATTERY_LOW 0U
#define brLOGICSCANNER 3U
#define brPLUGIN_MODULE 10U
#define brSYSTEM_MODULE 2U
#define brBATTERY_NOTEST 2U
#define TARGET_BIG_ENDIAN 2U
#define brBATTERY_MISSING 3U
#define INIT_REASON_UNKNOWN (-1)
#define INIT_REASON_DOWNLOAD 3
#define TARGET_LITTLE_ENDIAN 1U
#define brAUTOMATION_RUNTIME 4U
#define brERR_INVALID_DEVICE 27250U
#define INIT_REASON_COLDSTART 2
#define INIT_REASON_WARMSTART 1
#define brSYSCONF_SET_VOLATILE 0
#define brERR_INVALID_PARAMETER 27251U
#define brSYSCONF_SET_NON_VOLATILE 1
#else
_IEC_CONST unsigned char brX2X = 10U;
_IEC_CONST unsigned char brPP = 255U;
_IEC_CONST unsigned char brCPU = 1U;
_IEC_CONST unsigned char brKEY = 8U;
_IEC_CONST unsigned long brDRAM = 0U;
_IEC_CONST unsigned char br2003 = 2U;
_IEC_CONST unsigned char br2005 = 1U;
_IEC_CONST unsigned char br2010 = 0U;
_IEC_CONST unsigned char brC200 = 9U;
_IEC_CONST unsigned char brC300 = 8U;
_IEC_CONST unsigned char brADDON = 7U;
_IEC_CONST unsigned char brPANEL = 6U;
_IEC_CONST unsigned long brGLOBAL_REMANENT_PV = 5U;
_IEC_CONST unsigned long brLOCAL_REMANENT_PV = 4U;
_IEC_CONST unsigned long brUSRROM = 3U;
_IEC_CONST unsigned long brSYSROM = 2U;
_IEC_CONST unsigned long brUSRRAM = 1U;
_IEC_CONST unsigned char brACOPOS = 7U;
_IEC_CONST unsigned char brCAN_IO = 5U;
_IEC_CONST unsigned char brBASE_IO = 3U;
_IEC_CONST unsigned char brPRODUCT = 0U;
_IEC_CONST unsigned char brETHER_IO = 6U;
_IEC_CONST unsigned char brNO_FAMILY = 255U;
_IEC_CONST unsigned char brREMOTE_IO = 4U;
_IEC_CONST unsigned char brBATTERY_OK = 1U;
_IEC_CONST unsigned char brPOWERPANEL = 5U;
_IEC_CONST unsigned char brBATTERY_LOW = 0U;
_IEC_CONST unsigned char brLOGICSCANNER = 3U;
_IEC_CONST unsigned char brPLUGIN_MODULE = 10U;
_IEC_CONST unsigned char brSYSTEM_MODULE = 2U;
_IEC_CONST unsigned char brBATTERY_NOTEST = 2U;
_IEC_CONST unsigned char TARGET_BIG_ENDIAN = 2U;
_IEC_CONST unsigned char brBATTERY_MISSING = 3U;
_IEC_CONST signed char INIT_REASON_UNKNOWN = -1;
_IEC_CONST signed char INIT_REASON_DOWNLOAD = 3;
_IEC_CONST unsigned char TARGET_LITTLE_ENDIAN = 1U;
_IEC_CONST unsigned char brAUTOMATION_RUNTIME = 4U;
_IEC_CONST unsigned short brERR_INVALID_DEVICE = 27250U;
_IEC_CONST signed char INIT_REASON_COLDSTART = 2;
_IEC_CONST signed char INIT_REASON_WARMSTART = 1;
_IEC_CONST plcbit brSYSCONF_SET_VOLATILE = 0;
_IEC_CONST unsigned short brERR_INVALID_PARAMETER = 27251U;
_IEC_CONST plcbit brSYSCONF_SET_NON_VOLATILE = 1;
#endif
/* Datatypes and datatypes of function blocks */
typedef struct MEMInfo
{
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned long FreeUSR_Ram;
unsigned long FreeSYSTEM;
unsigned long FreeUSR_Prom;
unsigned long FreeSYS_Prom;
unsigned long FreeFIX_Ram;
unsigned long FreeTMP_Ram;
unsigned long FreeMEMCARD;
/* VAR_INPUT (digital) */
plcbit enable;
} MEMInfo_typ;
typedef struct SysInfo
{
/* VAR_OUTPUT (analog) */
unsigned char init_reason;
unsigned char init_count;
unsigned long tick_count;
unsigned long version;
/* VAR_INPUT (digital) */
plcbit enable;
} SysInfo_typ;
typedef struct RTInfo
{
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned long cycle_time;
signed char init_reason;
signed char task_class;
/* VAR_INPUT (digital) */
plcbit enable;
} RTInfo_typ;
typedef struct TARGETInfo
{
/* VAR_INPUT (analog) */
unsigned long pOSVersion;
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned char DataFormat;
/* VAR_INPUT (digital) */
plcbit enable;
} TARGETInfo_typ;
typedef struct HWInfo
{
/* VAR_INPUT (analog) */
unsigned long pName;
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned char family;
unsigned char usetype;
unsigned long module_typ;
unsigned char master_no;
unsigned char slave_no;
unsigned char module_adr;
unsigned char slot_no;
/* VAR (analog) */
unsigned long next_vw_p;
unsigned long last_modul_p;
unsigned long next_entry_p;
unsigned char next_entry_ix;
unsigned char next_slot_ix;
unsigned char last_rio_master;
/* VAR_INPUT (digital) */
plcbit enable;
plcbit first;
} HWInfo_typ;
typedef struct PMemGet
{
/* VAR_INPUT (analog) */
unsigned long offset;
unsigned long len;
unsigned long adress;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR_INPUT (digital) */
plcbit enable;
} PMemGet_typ;
typedef struct PMemPut
{
/* VAR_INPUT (analog) */
unsigned long offset;
unsigned long len;
unsigned long adress;
/* VAR_OUTPUT (analog) */
unsigned short status;
/* VAR_INPUT (digital) */
plcbit enable;
} PMemPut_typ;
typedef struct PMemSize
{
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned long size;
/* VAR_INPUT (digital) */
plcbit enable;
} PMemSize_typ;
/* Prototyping of functions and function blocks */
void MEMInfo(struct MEMInfo* inst);
void SysInfo(struct SysInfo* inst);
void RTInfo(struct RTInfo* inst);
void TARGETInfo(struct TARGETInfo* inst);
void HWInfo(struct HWInfo* inst);
void PMemGet(struct PMemGet* inst);
void PMemPut(struct PMemPut* inst);
void PMemSize(struct PMemSize* inst);
#ifdef __cplusplus
};
#endif
#endif /* _BRSYSTEM_ */

View File

@@ -0,0 +1,194 @@
(********************************************************************
* COPYRIGHT -- Bernecker + Rainer
********************************************************************
* Library: brsystem
* File: brsystem.fun
* Author: B+R
********************************************************************
* Functions and function blocks of library brsystem
********************************************************************)
FUNCTION_BLOCK MEMInfo (*returns information about the memory areas available on the system*)
VAR_INPUT
enable :BOOL; (*enables execution*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
FreeUSR_Ram :UDINT; (*SG3: free memory in USER RAM SG4: free memory in SRAM (Userram)*)
FreeSYSTEM :UDINT; (*SG3: free system memory SG4: not used, always 0*)
FreeUSR_Prom :UDINT; (*SG3: free memory in USER PROM SG4: free memory of HD where RPSHD is located*)
FreeSYS_Prom :UDINT; (*SG3: free memory in system PROM SG4: free memory of HD where RPSHD is located*)
FreeFIX_Ram :UDINT; (*SG3: free memory in FIX RAM SG4: not used, always 0*)
FreeTMP_Ram :UDINT; (*SG3: free temporary memory in RAM SG4: free memory in DRAM*)
FreeMEMCARD :UDINT; (*SG3: free memory on MEMCARD SG4: not used, always 0*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK MEMxInfo (*returns information about the memory areas available in the system; asynchronous execution*)
VAR_INPUT
enable :BOOL; (*enables execution*)
mem_typ :UDINT; (*memory type: brDRAM, brUSRRAM, brSYSROM, brUSRROM*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
MemSize :UDINT; (*total memory size in bytes*)
FreeMemSize :UDINT; (*size of available memory in bytes*)
BiggestFreeBlockSize :UDINT; (*size of the largest available block in memory in bytes*)
END_VAR
VAR
i_state :UINT; (*internal variable*)
i_result :UINT; (*internal variable*)
i_tmp :UDINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK SysInfo (*returns information about the target system*)
VAR_INPUT
enable :BOOL; (*enables execution*)
END_VAR
VAR_OUTPUT
init_reason :USINT; (*reason for initialization*)
init_count :USINT; (*SG3: the value is increased by every INIT (warm restart) SG4: not used, always 0*)
tick_count :UDINT; (*tick count*)
version :UDINT; (*operating system version of the target system*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK RTInfo (*returns runtime information about the software object*)
VAR_INPUT
enable :BOOL; (*enables execution*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
cycle_time :UDINT; (*cycle time in microsec*)
init_reason :SINT; (*reason for initialization*)
task_class :SINT; (*task class (SG3: #1 - #4 SG4: #1 - #8)*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK TARGETInfo (*returns information about the target system used*)
VAR_INPUT
enable :BOOL; (*enables execution*)
pOSVersion :UDINT; (*string given as a pointer (min. 7 char), where the os version is written*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
DataFormat :USINT; (*wether "big endian" or "little endian" ("TARGET_BIG_ENDIAN"/"TARGET_LITTLE_ENDIAN")*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK HWInfo (*returns information about the hardware configuration*)
VAR_INPUT
enable :BOOL; (*enables execution*)
first :BOOL; (*determines the hardware module on which the FUB is used 0/1 next/first*)
pName :UDINT; (*string given as a pointer, where the name of the module is written*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
family :USINT; (*family designation*)
usetype :USINT; (*hardware type*)
module_typ :UDINT; (*module type*)
master_no :USINT; (*logical number of the IO master, RIO master, CAN bus with CANIO*)
slave_no :USINT; (*slave number*)
module_adr :USINT; (*hardware module address (decimal)*)
slot_no :USINT; (*slot of the first submodule found (decimal)*)
END_VAR
VAR
next_vw_p :UDINT; (*internal variable*)
last_modul_p :UDINT; (*internal variable*)
next_entry_p :UDINT; (*internal variable*)
next_entry_ix :USINT; (*internal variable*)
next_slot_ix :USINT; (*internal variable*)
last_rio_master :USINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK SysconfInfo (*returns the parameters for a sysconf entry*)
VAR_INPUT
enable :BOOL; (*enables execution*)
pEntry :UDINT; (*string given as a pointer, where the name of the entry is written*)
pValue :UDINT; (*string given as a pointer, where the value of the entry is copied*)
value_len :UDINT; (*length of the "value-string"*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK SysconfSet (*sets the parameters for a sysconf entry*)
VAR_INPUT
enable :BOOL; (*enables execution*)
pEntry :UDINT; (*string given as a pointer, where the name of the entry is written*)
pNewValue :UDINT; (*string given as a pointer, where the new value of the entry is written*)
option :USINT; (*sets the parameter volatile/permanent ("brSYSCONF_SET_VOLATILE"/"brSYSCONF_SET_NON_VOLATILE")*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK BatteryInfo (*returns the state of the battery*)
VAR_INPUT
enable :BOOL; (*enables execution*)
pDevice :UDINT; (*device name given as a pointer*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
state :USINT; (*state of the battery*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK EXCInfo (*returns information about the software object that triggered the exception*)
VAR_INPUT
enable :BOOL; (*enables execution*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
task_class :UDINT; (*task class in which the exception was triggered*)
task_ident :UDINT; (*ID number of the software object that triggered the exception*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK ZYKVLenable (*enables/disables the cycle time monitoring of software objects*)
VAR_INPUT
enable :BOOL; (*enables execution*)
mode :BOOL; (*0/1 monitoring off/on*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK PMemGet (*reads data of len byte from the permanent memeory area beginning at offset*)
VAR_INPUT
enable :BOOL; (*enables execution*)
offset :UDINT; (*offset within the permanent memory area*)
len :UDINT; (*length of data area to be read*)
adress :UDINT; (*address where the read data is copied*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK PMemPut (*writes len bytes to the permanent memory area beginning at offset*)
VAR_INPUT
enable :BOOL; (*enables execution*)
offset :UDINT; (*offset within the permanent memory area*)
len :UDINT; (*length of data area to be written*)
adress :UDINT; (*address of the data to be written to the permanent memory area*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK PMemSize (*determines the size of permanent memory area in its existing configuration*)
VAR_INPUT
enable :BOOL; (*enables execution*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
size :UDINT; (*size of permanent memory area*)
END_VAR
END_FUNCTION_BLOCK

View File

@@ -0,0 +1,55 @@
(********************************************************************
* COPYRIGHT -- Bernecker + Rainer
********************************************************************
* Library: brsystem
* File: brsystem.var
* Author: B+R
********************************************************************
* Local variables of library brsystem
********************************************************************)
VAR CONSTANT
brSYSCONF_SET_NON_VOLATILE : BOOL := TRUE; (*set permanent value*)
brERR_INVALID_PARAMETER : UINT := 27251; (*invalid parameter transferred*)
brSYSCONF_SET_VOLATILE : BOOL := FALSE; (*set non-permanent value*)
INIT_REASON_WARMSTART : SINT := 1; (*warm restart boot information*)
INIT_REASON_COLDSTART : SINT := 2; (*cold restart boot information*)
brERR_INVALID_DEVICE : UINT := 27250; (*battery monitoring*)
brAUTOMATION_RUNTIME : USINT := 4; (*series recognition*)
TARGET_LITTLE_ENDIAN : USINT := 1; (*formatSpec*)
INIT_REASON_DOWNLOAD : SINT := 3; (*download boot information*)
INIT_REASON_UNKNOWN : SINT := -1; (*unknown boot information*)
brBATTERY_MISSING : USINT := 3; (*battery monitoring*)
TARGET_BIG_ENDIAN : USINT := 2; (*formatSpec*)
brBATTERY_NOTEST : USINT := 2; (*battery monitoring*)
brSYSTEM_MODULE : USINT := 2; (*usage recognition*)
brPLUGIN_MODULE : USINT := 10; (*usage recognition*)
brLOGICSCANNER : USINT := 3; (*series recognition*)
brBATTERY_LOW : USINT := 0; (*battery monitoring*)
brPOWERPANEL : USINT := 5; (*series recognition*)
brBATTERY_OK : USINT := 1; (*battery monitoring*)
brREMOTE_IO : USINT := 4; (*usage recognition*)
brNO_FAMILY : USINT := 255; (*series recognition*)
brETHER_IO : USINT := 6; (*usage recognition*)
brPRODUCT : USINT := 0; (*usage recognition*)
brBASE_IO : USINT := 3; (*usage recognition*)
brCAN_IO : USINT := 5; (*usage recognition*)
brACOPOS : USINT := 7; (*usage recognition*)
brUSRRAM : UDINT := 1; (*USRRAM memory type*)
brSYSROM : UDINT := 2; (*SYSROM memory type*)
brUSRROM : UDINT := 3; (*USRROM memory type*)
brLOCAL_REMANENT_PV : UDINT := 4; (*local REMMEM memory type*)
brGLOBAL_REMANENT_PV : UDINT := 5; (*global REMMEM memory type*)
brPANEL : USINT := 6; (*series recognition*)
brADDON : USINT := 7; (*series recognition*)
brC300 : USINT := 8; (*series recognition*)
brC200 : USINT := 9; (*series recognition*)
br2010 : USINT := 0; (*series recognition*)
br2005 : USINT := 1; (*series recognition*)
br2003 : USINT := 2; (*series recognition*)
brDRAM : UDINT := 0; (*DRAM memory type*)
brKEY : USINT := 8; (*usage recognition*)
brCPU : USINT := 1; (*usage recognition*)
brPP : USINT := 255; (*usage recognition*)
brX2X : USINT := 10; (*series recognition*)
END_VAR

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=3.0.0.0?>
<Library xmlns="http://br-automation.co.at/AS/Library" Description="This library contains function interfaces for IEC1131-3 operator functions. For the most part, these are mathematical and logical functions.">
<Files>
<File>operator.fun</File>
</Files>
</Library>

View File

@@ -0,0 +1,11 @@
/****************************************************************************/
/* */
/* operator.h */
/* */
/* Automation Studio */
/* Copyright Bernecker&Rainer 1998-1999 */
/* */
/****************************************************************************/
/* This library does not contain C code */

View File

@@ -0,0 +1,11 @@
/****************************************************************************/
/* */
/* operator.h */
/* */
/* Automation Studio */
/* Copyright Bernecker&Rainer 1998-1999 */
/* */
/****************************************************************************/
/* This library does not contain C code */

View File

@@ -0,0 +1,11 @@
/****************************************************************************/
/* */
/* operator.h */
/* */
/* Automation Studio */
/* Copyright Bernecker&Rainer 1998-1999 */
/* */
/****************************************************************************/
/* This library does not contain C code */

View File

@@ -0,0 +1,231 @@
(********************************************************************
* COPYRIGHT -- Bernecker + Rainer
********************************************************************
* Library: operator
* File: operator.fun
* Author: B+R
********************************************************************
* Functions and function blocks of library operator
********************************************************************)
FUNCTION SIZEOF : UDINT (*determines the size of a variable in bytes*)
VAR_INPUT
in :ANY; (*input value*)
END_VAR
END_FUNCTION
FUNCTION ADR : UDINT (*determines the address of a data point*)
VAR_INPUT
in :ANY; (*input value*)
END_VAR
END_FUNCTION
FUNCTION SHR : ANY (*shifts bitwise to the right*)
VAR_INPUT
IN :ANY; (*input value*)
N :SINT; (*number of bits to be shifted*)
END_VAR
END_FUNCTION
FUNCTION ROR : ANY (*rotates bitwise to the right*)
VAR_INPUT
IN :ANY; (*input value*)
N :SINT; (*number of bits to be rotated*)
END_VAR
END_FUNCTION
FUNCTION ROL : ANY (*rotates bitwise to the left*)
VAR_INPUT
IN :ANY; (*input value*)
N :SINT; (*number of bits to be rotated*)
END_VAR
END_FUNCTION
FUNCTION SHL : ANY (*shifts bitwise to the left*)
VAR_INPUT
IN :ANY; (*input value*)
N :SINT; (*number of bits to be shifted*)
END_VAR
END_FUNCTION
FUNCTION AND : ANY (*makes a bitwise AND relation for 2 or more variables*)
VAR_INPUT
INx :ANY; (*input value*)
END_VAR
END_FUNCTION
FUNCTION XOR : ANY (*makes a bitwise XOR relation for 2 or more variables*)
VAR_INPUT
INx :ANY; (*input values*)
END_VAR
END_FUNCTION
FUNCTION OR : ANY (*makes a bitwise OR relation for 2 or more variables*)
VAR_INPUT
INx :ANY; (*input values*)
END_VAR
END_FUNCTION
FUNCTION NOT : ANY (*makes a bitwise inversion of variables*)
VAR_INPUT
IN :ANY; (*input value*)
END_VAR
END_FUNCTION
FUNCTION ADD : ANY (*adds 2 or more variables*)
VAR_INPUT
INx :ANY; (*input values*)
END_VAR
END_FUNCTION
FUNCTION MUL : ANY_NUM (*multiplies 2 or more variables*)
VAR_INPUT
INx :ANY_NUM; (*input values*)
END_VAR
END_FUNCTION
FUNCTION SUB : ANY (*subtracts one or more variables from another variable*)
VAR_INPUT
IN1 :ANY; (*value 1*)
IN2 :ANY; (*value 2*)
END_VAR
END_FUNCTION
FUNCTION DIV : ANY_NUM (*divides a variable by one or more variables*)
VAR_INPUT
IN1 :ANY_NUM; (*dividend*)
IN2 :ANY_NUM; (*divisor*)
END_VAR
END_FUNCTION
FUNCTION MOD : ANY_INT (*makes a remainder when dividing a variable by another variable*)
VAR_INPUT
IN1 :ANY_INT; (*dividend*)
IN2 :ANY_INT; (*divisor*)
END_VAR
END_FUNCTION
FUNCTION MOVE : ANY (*copies the contents of the input variables to the corresponding output variables*)
VAR_INPUT
IN :ANY; (*input variable*)
END_VAR
END_FUNCTION
FUNCTION MAX : ANY (*determines the maximum value of two or more values*)
VAR_INPUT
IN1 :ANY; (*input value 1*)
IN2 :ANY; (*input value 2*)
END_VAR
END_FUNCTION
FUNCTION MIN : ANY (*determines the lowest value of two or more values*)
VAR_INPUT
IN1 :ANY; (*input value 1*)
IN2 :ANY; (*input value 2*)
END_VAR
END_FUNCTION
FUNCTION LIMIT : ANY (*limits a value to within maximum and minimum boundaries*)
VAR_INPUT
MN :ANY; (*minimum value*)
IN :ANY; (*input value*)
MX :ANY; (*maximum value*)
END_VAR
END_FUNCTION
FUNCTION SEL : ANY (*selects one value from two values*)
VAR_INPUT
G :BOOL; (*selection variable*)
IN0 :ANY; (*input value for FALSE*)
IN1 :ANY; (*input value for TRUE*)
END_VAR
END_FUNCTION
FUNCTION MUX : ANY (*selects a value from several values*)
VAR_INPUT
K :SINT; (*selection variable*)
INx :ANY; (*input values*)
END_VAR
END_FUNCTION
FUNCTION GE : BOOL (*checks if the input values are in decreasing order*)
VAR_INPUT
IN1 :ANY; (*comparison value 1*)
IN2 :ANY; (*comparison value 2*)
END_VAR
END_FUNCTION
FUNCTION EQ : BOOL (*compares two or more values whether they are equal*)
VAR_INPUT
IN1 :ANY; (*comparison value 1*)
IN2 :ANY; (*comparison value 2*)
END_VAR
END_FUNCTION
FUNCTION GT : BOOL (*checks if the input values are in decreasing order*)
VAR_INPUT
IN1 :ANY; (*comparison value 1*)
IN2 :ANY; (*comparison value 2*)
END_VAR
END_FUNCTION
FUNCTION LE : BOOL (*checks if the input values are in increasing order*)
VAR_INPUT
IN1 :ANY; (*comparison value 1*)
IN2 :ANY; (*comparison value 2*)
END_VAR
END_FUNCTION
FUNCTION LT : BOOL (*checks if the input values are in increasing order*)
VAR_INPUT
IN1 :ANY; (*comparison value 1*)
IN2 :ANY; (*comparison value 2*)
END_VAR
END_FUNCTION
FUNCTION NE : BOOL (*compares two values whether they are not equal*)
VAR_INPUT
IN1 :ANY; (*comparison value 1*)
IN2 :ANY; (*comparison value 2*)
END_VAR
END_FUNCTION
FUNCTION ABS : ANY_NUM (*returns the absolute value of a number*)
VAR_INPUT
IN :ANY_NUM; (*input value*)
END_VAR
END_FUNCTION
FUNCTION SQRT : ANY_REAL (*returns the square root of a number*)
VAR_INPUT
IN :ANY_REAL; (*input value*)
END_VAR
END_FUNCTION
FUNCTION LN : ANY_REAL (*returns the result of a natural logarithm*)
VAR_INPUT
IN :ANY_REAL; (*input value*)
END_VAR
END_FUNCTION
FUNCTION LOG : ANY_REAL (*returns the result of a base 10 logarithm*)
VAR_INPUT
IN :ANY_REAL; (*input value*)
END_VAR
END_FUNCTION
FUNCTION EXP : ANY_REAL (*returns the result of a natural exponential function*)
VAR_INPUT
IN :ANY_REAL; (*input value*)
END_VAR
END_FUNCTION
FUNCTION SIN : ANY_REAL (*returns the sine of a number (calculated in radian)*)
VAR_INPUT
IN :ANY_REAL; (*input value in radian*)
END_VAR
END_FUNCTION
FUNCTION COS : ANY_REAL (*returns the cosine of a number (calculated in radian)*)
VAR_INPUT
IN :ANY_REAL; (*input value in radian*)
END_VAR
END_FUNCTION
FUNCTION TAN : ANY_REAL (*returns the tangent of a number (calculated in radian)*)
VAR_INPUT
IN :ANY_REAL; (*input value in radian*)
END_VAR
END_FUNCTION
FUNCTION ASIN : ANY_REAL (*returns the arc sine (inverse function of sine) of a number (calculated in radian)*)
VAR_INPUT
IN :ANY_REAL; (*input value*)
END_VAR
END_FUNCTION
FUNCTION ACOS : ANY_REAL (*returns the arc cosine (inverse function of cosine) of a number (calculated in radian)*)
VAR_INPUT
IN :ANY_REAL; (*input value*)
END_VAR
END_FUNCTION
FUNCTION ATAN : ANY_REAL (*returns the arc tangent (inverse function of tangent) of a number (calculated in radian)*)
VAR_INPUT
IN :ANY_REAL; (*input value*)
END_VAR
END_FUNCTION
FUNCTION EXPT : REAL (*raises one variable to the power of another*)
VAR_INPUT
IN1 :REAL; (*base*)
IN2 :ANY_NUM; (*exponent*)
END_VAR
END_FUNCTION
FUNCTION TRUNC : INT (*converts from type REAL to type INT (number is always rounded down)*)
VAR_INPUT
IN :ANY_REAL; (*input value*)
END_VAR
END_FUNCTION

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=3.0.0.0?>
<Library xmlns="http://br-automation.co.at/AS/Library" Description="This library contains runtime functions for IEC tasks.">
<Files>
<File>runtime.var</File>
<File>runtime.typ</File>
<File>runtime.fun</File>
</Files>
</Library>

View File

@@ -0,0 +1,80 @@
/* Automation Studio generated header file */
/* Do not edit ! */
#ifndef _RUNTIME_
#define _RUNTIME_
#ifdef __cplusplus
extern "C" {
#endif
#include <bur/plctypes.h>
#ifndef _IEC_CONST
#define _IEC_CONST _WEAK const
#endif
/* Constants */
#ifdef _REPLACE_CONST
#define ERR_OK 0
#define ERR_NOTIMPLEMENTED 9999
#define ERR_FUB_ENABLE_FALSE 0xFFFE
#define ERR_FUB_BUSY 0xFFFF
/* IEC 61131-3 Datentypen */
#define IEC_DATATYPE_BOOL 1
#define IEC_DATATYPE_SINT 2
#define IEC_DATATYPE_INT 3
#define IEC_DATATYPE_DINT 4
#define IEC_DATATYPE_USINT 5
#define IEC_DATATYPE_UINT 6
#define IEC_DATATYPE_UDINT 7
#define IEC_DATATYPE_REAL 8
#define IEC_DATATYPE_STRING 9
#define IEC_DATATYPE_ULINT 10
#define IEC_DATATYPE_DATE_AND_TIME 11
#define IEC_DATATYPE_TIME 12
#define IEC_DATATYPE_DATE 13
#define IEC_DATATYPE_LREAL 14
#define IEC_DATATYPE_TIME_OF_DAY 16
#define IEC_DATATYPE_BYTE 17
#define IEC_DATATYPE_WORD 18
#define IEC_DATATYPE_DWORD 19
#define IEC_DATATYPE_LWORD 20
#define IEC_DATATYPE_WSTRING 21
#define IEC_DATATYPE_LINT 23
#else
_IEC_CONST unsigned short ERR_OK = 0U;
_IEC_CONST unsigned short ERR_NOTIMPLEMENTED = 9999U;
_IEC_CONST unsigned short ERR_FUB_ENABLE_FALSE = 0xFFFEU;
_IEC_CONST unsigned short ERR_FUB_BUSY = 0xFFFFU;
/* IEC 61131-3 Datentypen */
_IEC_CONST unsigned short IEC_DATATYPE_BOOL = 1;
_IEC_CONST unsigned short IEC_DATATYPE_SINT = 2;
_IEC_CONST unsigned short IEC_DATATYPE_INT = 3;
_IEC_CONST unsigned short IEC_DATATYPE_DINT = 4;
_IEC_CONST unsigned short IEC_DATATYPE_USINT = 5;
_IEC_CONST unsigned short IEC_DATATYPE_UINT = 6;
_IEC_CONST unsigned short IEC_DATATYPE_UDINT = 7;
_IEC_CONST unsigned short IEC_DATATYPE_REAL = 8;
_IEC_CONST unsigned short IEC_DATATYPE_STRING = 9;
_IEC_CONST unsigned short IEC_DATATYPE_ULINT = 10;
_IEC_CONST unsigned short IEC_DATATYPE_DATE_AND_TIME = 11;
_IEC_CONST unsigned short IEC_DATATYPE_TIME = 12;
_IEC_CONST unsigned short IEC_DATATYPE_DATE = 13;
_IEC_CONST unsigned short IEC_DATATYPE_LREAL = 14;
_IEC_CONST unsigned short IEC_DATATYPE_TIME_OF_DAY = 16;
_IEC_CONST unsigned short IEC_DATATYPE_BYTE = 17;
_IEC_CONST unsigned short IEC_DATATYPE_WORD = 18;
_IEC_CONST unsigned short IEC_DATATYPE_DWORD = 19;
_IEC_CONST unsigned short IEC_DATATYPE_LWORD = 20;
_IEC_CONST unsigned short IEC_DATATYPE_WSTRING = 21;
_IEC_CONST unsigned short IEC_DATATYPE_LINT = 23;
#endif
#ifdef __cplusplus
};
#endif
#endif /* _RUNTIME_ */

View File

@@ -0,0 +1,80 @@
/* Automation Studio generated header file */
/* Do not edit ! */
#ifndef _RUNTIME_
#define _RUNTIME_
#ifdef __cplusplus
extern "C" {
#endif
#include <bur/plctypes.h>
#ifndef _IEC_CONST
#define _IEC_CONST _WEAK const
#endif
/* Constants */
#ifdef _REPLACE_CONST
#define ERR_OK 0
#define ERR_NOTIMPLEMENTED 9999
#define ERR_FUB_ENABLE_FALSE 0xFFFE
#define ERR_FUB_BUSY 0xFFFF
/* IEC 61131-3 Datentypen */
#define IEC_DATATYPE_BOOL 1
#define IEC_DATATYPE_SINT 2
#define IEC_DATATYPE_INT 3
#define IEC_DATATYPE_DINT 4
#define IEC_DATATYPE_USINT 5
#define IEC_DATATYPE_UINT 6
#define IEC_DATATYPE_UDINT 7
#define IEC_DATATYPE_REAL 8
#define IEC_DATATYPE_STRING 9
#define IEC_DATATYPE_ULINT 10
#define IEC_DATATYPE_DATE_AND_TIME 11
#define IEC_DATATYPE_TIME 12
#define IEC_DATATYPE_DATE 13
#define IEC_DATATYPE_LREAL 14
#define IEC_DATATYPE_TIME_OF_DAY 16
#define IEC_DATATYPE_BYTE 17
#define IEC_DATATYPE_WORD 18
#define IEC_DATATYPE_DWORD 19
#define IEC_DATATYPE_LWORD 20
#define IEC_DATATYPE_WSTRING 21
#define IEC_DATATYPE_LINT 23
#else
_IEC_CONST unsigned short ERR_OK = 0U;
_IEC_CONST unsigned short ERR_NOTIMPLEMENTED = 9999U;
_IEC_CONST unsigned short ERR_FUB_ENABLE_FALSE = 0xFFFEU;
_IEC_CONST unsigned short ERR_FUB_BUSY = 0xFFFFU;
/* IEC 61131-3 Datentypen */
_IEC_CONST unsigned short IEC_DATATYPE_BOOL = 1;
_IEC_CONST unsigned short IEC_DATATYPE_SINT = 2;
_IEC_CONST unsigned short IEC_DATATYPE_INT = 3;
_IEC_CONST unsigned short IEC_DATATYPE_DINT = 4;
_IEC_CONST unsigned short IEC_DATATYPE_USINT = 5;
_IEC_CONST unsigned short IEC_DATATYPE_UINT = 6;
_IEC_CONST unsigned short IEC_DATATYPE_UDINT = 7;
_IEC_CONST unsigned short IEC_DATATYPE_REAL = 8;
_IEC_CONST unsigned short IEC_DATATYPE_STRING = 9;
_IEC_CONST unsigned short IEC_DATATYPE_ULINT = 10;
_IEC_CONST unsigned short IEC_DATATYPE_DATE_AND_TIME = 11;
_IEC_CONST unsigned short IEC_DATATYPE_TIME = 12;
_IEC_CONST unsigned short IEC_DATATYPE_DATE = 13;
_IEC_CONST unsigned short IEC_DATATYPE_LREAL = 14;
_IEC_CONST unsigned short IEC_DATATYPE_TIME_OF_DAY = 16;
_IEC_CONST unsigned short IEC_DATATYPE_BYTE = 17;
_IEC_CONST unsigned short IEC_DATATYPE_WORD = 18;
_IEC_CONST unsigned short IEC_DATATYPE_DWORD = 19;
_IEC_CONST unsigned short IEC_DATATYPE_LWORD = 20;
_IEC_CONST unsigned short IEC_DATATYPE_WSTRING = 21;
_IEC_CONST unsigned short IEC_DATATYPE_LINT = 23;
#endif
#ifdef __cplusplus
};
#endif
#endif /* _RUNTIME_ */

View File

@@ -0,0 +1,80 @@
/* Automation Studio generated header file */
/* Do not edit ! */
#ifndef _RUNTIME_
#define _RUNTIME_
#ifdef __cplusplus
extern "C" {
#endif
#include <bur/plctypes.h>
#ifndef _IEC_CONST
#define _IEC_CONST _WEAK const
#endif
/* Constants */
#ifdef _REPLACE_CONST
#define ERR_OK 0
#define ERR_NOTIMPLEMENTED 9999
#define ERR_FUB_ENABLE_FALSE 0xFFFE
#define ERR_FUB_BUSY 0xFFFF
/* IEC 61131-3 Datentypen */
#define IEC_DATATYPE_BOOL 1
#define IEC_DATATYPE_SINT 2
#define IEC_DATATYPE_INT 3
#define IEC_DATATYPE_DINT 4
#define IEC_DATATYPE_USINT 5
#define IEC_DATATYPE_UINT 6
#define IEC_DATATYPE_UDINT 7
#define IEC_DATATYPE_REAL 8
#define IEC_DATATYPE_STRING 9
#define IEC_DATATYPE_ULINT 10
#define IEC_DATATYPE_DATE_AND_TIME 11
#define IEC_DATATYPE_TIME 12
#define IEC_DATATYPE_DATE 13
#define IEC_DATATYPE_LREAL 14
#define IEC_DATATYPE_TIME_OF_DAY 16
#define IEC_DATATYPE_BYTE 17
#define IEC_DATATYPE_WORD 18
#define IEC_DATATYPE_DWORD 19
#define IEC_DATATYPE_LWORD 20
#define IEC_DATATYPE_WSTRING 21
#define IEC_DATATYPE_LINT 23
#else
_IEC_CONST unsigned short ERR_OK = 0U;
_IEC_CONST unsigned short ERR_NOTIMPLEMENTED = 9999U;
_IEC_CONST unsigned short ERR_FUB_ENABLE_FALSE = 0xFFFEU;
_IEC_CONST unsigned short ERR_FUB_BUSY = 0xFFFFU;
/* IEC 61131-3 Datentypen */
_IEC_CONST unsigned short IEC_DATATYPE_BOOL = 1;
_IEC_CONST unsigned short IEC_DATATYPE_SINT = 2;
_IEC_CONST unsigned short IEC_DATATYPE_INT = 3;
_IEC_CONST unsigned short IEC_DATATYPE_DINT = 4;
_IEC_CONST unsigned short IEC_DATATYPE_USINT = 5;
_IEC_CONST unsigned short IEC_DATATYPE_UINT = 6;
_IEC_CONST unsigned short IEC_DATATYPE_UDINT = 7;
_IEC_CONST unsigned short IEC_DATATYPE_REAL = 8;
_IEC_CONST unsigned short IEC_DATATYPE_STRING = 9;
_IEC_CONST unsigned short IEC_DATATYPE_ULINT = 10;
_IEC_CONST unsigned short IEC_DATATYPE_DATE_AND_TIME = 11;
_IEC_CONST unsigned short IEC_DATATYPE_TIME = 12;
_IEC_CONST unsigned short IEC_DATATYPE_DATE = 13;
_IEC_CONST unsigned short IEC_DATATYPE_LREAL = 14;
_IEC_CONST unsigned short IEC_DATATYPE_TIME_OF_DAY = 16;
_IEC_CONST unsigned short IEC_DATATYPE_BYTE = 17;
_IEC_CONST unsigned short IEC_DATATYPE_WORD = 18;
_IEC_CONST unsigned short IEC_DATATYPE_DWORD = 19;
_IEC_CONST unsigned short IEC_DATATYPE_LWORD = 20;
_IEC_CONST unsigned short IEC_DATATYPE_WSTRING = 21;
_IEC_CONST unsigned short IEC_DATATYPE_LINT = 23;
#endif
#ifdef __cplusplus
};
#endif
#endif /* _RUNTIME_ */

View File

@@ -0,0 +1,189 @@
(********************************************************************
* COPYRIGHT -- Bernecker + Rainer
********************************************************************
* Library: runtime
* File: runtime.fun
* Author: B+R
********************************************************************
* Functions and function blocks of library runtime
********************************************************************)
FUNCTION_BLOCK r_trig (*for internal use only - do not use this function in user programs*)
VAR_INPUT
CLK :BOOL;
END_VAR
VAR_OUTPUT
Q :BOOL;
END_VAR
VAR
M :BOOL;
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK f_trig (*for internal use only - do not use this function in user programs*)
VAR_INPUT
CLK :BOOL;
END_VAR
VAR_OUTPUT
Q :BOOL;
END_VAR
VAR
M :BOOL;
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK rf_trig (*for internal use only - do not use this function in user programs*)
VAR_INPUT
CLK :BOOL;
END_VAR
VAR_OUTPUT
Q :BOOL;
END_VAR
VAR
M :BOOL;
END_VAR
END_FUNCTION_BLOCK
FUNCTION GetTime : TIME (*for internal use only - do not use this function in user programs*)
END_FUNCTION
FUNCTION_BLOCK SFCActionControl (*for internal use only - do not use this function in user programs*)
VAR_INPUT
N :BOOL;
R0 :BOOL;
S0 :BOOL;
L :BOOL;
D :BOOL;
P :BOOL;
SD :BOOL;
DS :BOOL;
SL :BOOL;
T :TIME;
END_VAR
VAR_OUTPUT
Q :BOOL;
END_VAR
VAR
S_FF_SET :USINT;
S_FF_R1 :USINT;
S_FF_Q :USINT;
dummy1 :USINT;
L_TMR_PT :TIME;
L_TMR_ET :TIME;
L_TMR_STAR :TIME;
L_TMR_IN :USINT;
L_TMR_Q :USINT;
L_TMR_M :USINT;
dummy2 :USINT;
D_TMR_PT :TIME;
D_TMR_ET :TIME;
D_TMR_STAR :TIME;
D_TMR_IN :USINT;
D_TMR_Q :USINT;
D_TMR_M :USINT;
dummy3 :USINT;
P_TRIG_CLK :USINT;
P_TRIG_Q :USINT;
P_TRIG_M :USINT;
dummy4 :USINT;
SD_TMR_PT :TIME;
SD_TMR_ET :TIME;
SD_TMR_STA :TIME;
SD_TMR_IN :USINT;
SD_TMR_Q :USINT;
SD_TMR_M :USINT;
dummy5 :USINT;
SD_FF_SET :USINT;
SD_FF_R1 :USINT;
SD_FF_Q :USINT;
DS_FF_SET :USINT;
DS_FF_R1 :USINT;
DS_FF_Q :USINT;
DS_TMR_PT :TIME;
DS_TMR_ET :TIME;
DS_TMR_STA :TIME;
DS_TMR_IN :USINT;
DS_TMR_Q :USINT;
DS_TMR_M :USINT;
dummy6 :USINT;
SL_FF_SET :USINT;
SL_FF_R1 :USINT;
SL_FF_Q :USINT;
dummy7 :USINT;
SL_TMR_PT :TIME;
SL_TMR_ET :TIME;
SL_TMR_STA :TIME;
SL_TMR_IN :USINT;
SL_TMR_Q :USINT;
SL_TMR_M :USINT;
dummy8 :USINT;
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK SFCAC2 (*for internal use only - do not use this function in user programs*)
VAR_INPUT
N :BOOL;
R0 :BOOL;
S0 :BOOL;
L :BOOL;
D :BOOL;
P :BOOL;
P1 :BOOL;
P0 :BOOL;
SD :BOOL;
DS :BOOL;
SL :BOOL;
T :TIME;
END_VAR
VAR_OUTPUT
Q :BOOL;
A :BOOL;
END_VAR
VAR
S_FF_SET :USINT;
S_FF_R1 :USINT;
S_FF_Q :USINT;
L_TMR_PT :TIME;
L_TMR_ET :TIME;
L_TMR_STAR :TIME;
L_TMR_IN :USINT;
L_TMR_Q :USINT;
L_TMR_M :USINT;
D_TMR_PT :TIME;
D_TMR_ET :TIME;
D_TMR_STAR :TIME;
D_TMR_IN :USINT;
D_TMR_Q :USINT;
D_TMR_M :USINT;
SD_TMR_PT :TIME;
SD_TMR_ET :TIME;
SD_TMR_STA :TIME;
SD_TMR_IN :USINT;
SD_TMR_Q :USINT;
SD_TMR_M :USINT;
SD_FF_SET :USINT;
SD_FF_R1 :USINT;
SD_FF_Q1 :USINT;
DS_FF_SET :USINT;
DS_FF_R1 :USINT;
DS_FF_Q1 :USINT;
DS_TMR_PT :TIME;
DS_TMR_ET :TIME;
DS_TMR_STA :TIME;
DS_TMR_IN :USINT;
DS_TMR_Q :USINT;
DS_TMR_M :USINT;
SL_FF_SET :USINT;
SL_FF_R1 :USINT;
SL_FF_Q :USINT;
SL_TMR_PT :TIME;
SL_TMR_ET :TIME;
SL_TMR_STA :TIME;
SL_TMR_IN :USINT;
SL_TMR_Q :USINT;
SL_TMR_M :USINT;
P_TRIG_Q :USINT;
P_TRIG_M :USINT;
Q_TRIG_Q :USINT;
Q_TRIG_M :USINT;
P1_TRIG_Q :USINT;
P1_TRIG_M :USINT;
P0_TRIG_Q :USINT;
P0_TRIG_M :USINT;
END_VAR
END_FUNCTION_BLOCK

View File

@@ -0,0 +1,78 @@
(********************************************************************
* COPYRIGHT -- Bernecker + Rainer
********************************************************************
* Library: runtime
* File: runtime.typ
* Author: B+R
********************************************************************
* Data types of library runtime
********************************************************************)
TYPE
SFCActionType : STRUCT (*internal use*)
x : BOOL ;
_x : BOOL ;
t : TIME ;
_t : TIME ;
AC : SFCActionControl;
END_STRUCT;
SFCActionType2 : STRUCT (*internal use*)
x : BOOL ;
_x : BOOL ;
AC : SFCAC2 ;
END_STRUCT;
SFCActionCType : STRUCT (*internal use*)
x : BOOL ;
_x : BOOL ;
force : BOOL ;
_force : BOOL ;
active : BOOL ;
_active : BOOL ;
AC : SFCActionControl ;
END_STRUCT;
SFCActionCType2 : STRUCT (*internal use*)
x : BOOL ;
_x : BOOL ;
force : BOOL ;
_force : BOOL ;
active : BOOL ;
_active : BOOL ;
AC : SFCAC2 ;
END_STRUCT;
SFCStepType : STRUCT (*internal use*)
x : BOOL ;
t : TIME ;
_x : BOOL ;
_t : TIME ;
END_STRUCT;
SFCStepCType : STRUCT (*internal use*)
t : TIME ;
_t : TIME ;
inactive_actions : UDINT ;
_inactive_actions : UDINT ;
x : BOOL ;
_x : BOOL ;
force : BOOL ;
_force : BOOL ;
active : BOOL ;
_active : BOOL ;
error : BOOL ;
END_STRUCT;
SFCSimpleStepCType : STRUCT (*internal use*)
t : TIME ;
_t : TIME ;
x : BOOL ;
_x : BOOL ;
force : BOOL ;
_force : BOOL ;
active : BOOL ;
_active : BOOL ;
error : BOOL ;
END_STRUCT;
SFCTransitionCType : STRUCT (*internal use*)
force : BOOL ;
_force : BOOL ;
active : BOOL ;
_active : BOOL ;
END_STRUCT;
END_TYPE

View File

@@ -0,0 +1,42 @@
(********************************************************************
* COPYRIGHT -- Bernecker + Rainer
********************************************************************
* Library: runtime
* File: runtime.var
* Author: B+R
********************************************************************
* Local variables of library runtime
********************************************************************)
(*Common Functionblock Status*)
VAR CONSTANT
ERR_OK : UINT := 0; (*no error*)
ERR_NOTIMPLEMENTED : UINT := 9999; (*function or function block not implemented*)
ERR_FUB_ENABLE_FALSE : UINT := 16#FFFE; (*function block parameter "enable" is FALSE*)
ERR_FUB_BUSY : UINT := 16#FFFF; (*function block still working*)
END_VAR
(*IEC 61131-3 Datatypes*)
VAR CONSTANT
IEC_DATATYPE_BOOL : UINT := 1; (*8 Bit containing a boolean value FALSE=0 or TRUE=1*)
IEC_DATATYPE_SINT : UINT := 2; (*8 Bit signed integer*)
IEC_DATATYPE_INT : UINT := 3; (*16 Bit signed integer*)
IEC_DATATYPE_DINT : UINT := 4; (*32 Bit signed integer*)
IEC_DATATYPE_USINT : UINT := 5; (*8 Bit unsigned integer*)
IEC_DATATYPE_UINT : UINT := 6; (*16 Bit unsigned integer*)
IEC_DATATYPE_UDINT : UINT := 7; (*32 Bit unsigned integer*)
IEC_DATATYPE_REAL : UINT := 8; (*32 Bit floating point number*)
IEC_DATATYPE_STRING : UINT := 9; (*Variable-length single-byte character string*)
IEC_DATATYPE_ULINT : UINT := 10; (*64 Bit unsigned integer*)
IEC_DATATYPE_DATE_AND_TIME : UINT := 11; (*32 Bit of Date in Seconds since 01.01.1970 00:00:00*)
IEC_DATATYPE_TIME : UINT := 12; (*32 Bit of Time in ms*)
IEC_DATATYPE_DATE : UINT := 13; (*32 Bit of Date (only)*)
IEC_DATATYPE_LREAL : UINT := 14; (*64 Bit floating point number*)
IEC_DATATYPE_TIME_OF_DAY: UINT := 16; (*32 Bit Time of day (only)*)
IEC_DATATYPE_BYTE : UINT := 17; (*Bit string of length 8*)
IEC_DATATYPE_WORD : UINT := 18; (*Bit string of length 16*)
IEC_DATATYPE_DWORD : UINT := 19; (*Bit string of length 32*)
IEC_DATATYPE_LWORD : UINT := 20; (*Bit string of length 64*)
IEC_DATATYPE_WSTRING : UINT := 21; (*Variable-length double-byte character string*)
IEC_DATATYPE_LINT : UINT := 23; (*64 Bit signed integer*)
END_VAR

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=3.0.0.0?>
<Library xmlns="http://br-automation.co.at/AS/Library" Description="This library contains standard function blocks and funtions for IEC 1131-3.">
<Files>
<File>standard.fun</File>
</Files>
</Library>

View File

@@ -0,0 +1,262 @@
/* Automation Studio Generated Header File, Format Version 1.00 */
/* do not change */
#ifndef STANDARD_H_
#define STANDARD_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <bur/plc.h>
#define TP_10mstyp TP_10ms_typ
#define TOF_10mstyp TOF_10ms_typ
#define TON_10mstyp TON_10ms_typ
#define TPtyp TP_typ
#define TOFtyp TOF_typ
#define TONtyp TON_typ
#define SEMAtyp SEMA_typ
#define RStyp RS_typ
#define SRtyp SR_typ
#define R_TRIGtyp R_TRIG_typ
#define F_TRIGtyp F_TRIG_typ
#define CTUtyp CTU_typ
#define CTDtyp CTD_typ
#define CTUDtyp CTUD_typ
#define RF_TRIGtyp RF_TRIG_typ
/* Constants */
/* Datatypes */
/* Datatypes of function blocks */
typedef struct TP_10ms
{
/* VAR_INPUT (analogous) */
unsigned long PT;
/* VAR_OUTPUT (analogous) */
unsigned long ET;
/* VAR (analogous) */
unsigned long StartTime;
/* VAR_INPUT (digital) */
plcbit IN;
/* VAR_OUTPUT (digital) */
plcbit Q;
} TP_10ms_typ;
typedef struct TOF_10ms
{
/* VAR_INPUT (analogous) */
unsigned long PT;
/* VAR_OUTPUT (analogous) */
unsigned long ET;
/* VAR (analogous) */
unsigned long StartTime;
/* VAR_INPUT (digital) */
plcbit IN;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} TOF_10ms_typ;
typedef struct TON_10ms
{
/* VAR_INPUT (analogous) */
unsigned long PT;
/* VAR_OUTPUT (analogous) */
unsigned long ET;
/* VAR (analogous) */
unsigned long StartTime;
/* VAR_INPUT (digital) */
plcbit IN;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} TON_10ms_typ;
typedef struct TP
{
/* VAR_INPUT (analogous) */
plctime PT;
/* VAR_OUTPUT (analogous) */
plctime ET;
/* VAR (analogous) */
plctime StartTime;
unsigned long Restart;
/* VAR_INPUT (digital) */
plcbit IN;
/* VAR_OUTPUT (digital) */
plcbit Q;
} TP_typ;
typedef struct TOF
{
/* VAR_INPUT (analogous) */
plctime PT;
/* VAR_OUTPUT (analogous) */
plctime ET;
/* VAR (analogous) */
plctime StartTime;
unsigned long Restart;
/* VAR_INPUT (digital) */
plcbit IN;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} TOF_typ;
typedef struct TON
{
/* VAR_INPUT (analogous) */
plctime PT;
/* VAR_OUTPUT (analogous) */
plctime ET;
/* VAR (analogous) */
plctime StartTime;
unsigned long Restart;
/* VAR_INPUT (digital) */
plcbit IN;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} TON_typ;
typedef struct SEMA
{
/* VAR_INPUT (digital) */
plcbit CLAIM;
plcbit RELEASE;
/* VAR_OUTPUT (digital) */
plcbit BUSY;
/* VAR (digital) */
plcbit X;
} SEMA_typ;
typedef struct RS
{
/* VAR_INPUT (digital) */
plcbit SET;
plcbit RESET1;
/* VAR_OUTPUT (digital) */
plcbit Q1;
} RS_typ;
typedef struct SR
{
/* VAR_INPUT (digital) */
plcbit SET1;
plcbit RESET;
/* VAR_OUTPUT (digital) */
plcbit Q1;
} SR_typ;
typedef struct R_TRIG
{
/* VAR_INPUT (digital) */
plcbit CLK;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} R_TRIG_typ;
typedef struct F_TRIG
{
/* VAR_INPUT (digital) */
plcbit CLK;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} F_TRIG_typ;
typedef struct CTU
{
/* VAR_INPUT (analogous) */
unsigned short PV;
/* VAR_OUTPUT (analogous) */
unsigned short CV;
/* VAR_INPUT (digital) */
plcbit CU;
plcbit RESET;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} CTU_typ;
typedef struct CTD
{
/* VAR_INPUT (analogous) */
unsigned short PV;
/* VAR_OUTPUT (analogous) */
unsigned short CV;
/* VAR_INPUT (digital) */
plcbit CD;
plcbit LOAD;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} CTD_typ;
typedef struct CTUD
{
/* VAR_INPUT (analogous) */
signed short PV;
/* VAR_OUTPUT (analogous) */
signed short CV;
/* VAR_INPUT (digital) */
plcbit CU;
plcbit CD;
plcbit RESET;
plcbit LOAD;
/* VAR_OUTPUT (digital) */
plcbit QU;
plcbit QD;
/* VAR (digital) */
plcbit MU;
plcbit MD;
} CTUD_typ;
typedef struct RF_TRIG
{
/* VAR_INPUT (digital) */
plcbit CLK;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} RF_TRIG_typ;
/* Prototyping of functions and function blocks */
void TP_10ms(TP_10ms_typ* inst);
void TOF_10ms(TOF_10ms_typ* inst);
void TON_10ms(TON_10ms_typ* inst);
void TP(TP_typ* inst);
void TOF(TOF_typ* inst);
void TON(TON_typ* inst);
void SEMA(SEMA_typ* inst);
void RS(RS_typ* inst);
void SR(SR_typ* inst);
void R_TRIG(R_TRIG_typ* inst);
void F_TRIG(F_TRIG_typ* inst);
void CTU(CTU_typ* inst);
void CTD(CTD_typ* inst);
void CTUD(CTUD_typ* inst);
void RF_TRIG(RF_TRIG_typ* inst);
#ifdef __cplusplus
};
#endif
#endif /* STANDARD_H_ */

View File

@@ -0,0 +1,262 @@
/* Automation Studio Generated Header File, Format Version 1.00 */
/* do not change */
#ifndef STANDARD_H_
#define STANDARD_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <bur/plc.h>
#define TP_10mstyp TP_10ms_typ
#define TOF_10mstyp TOF_10ms_typ
#define TON_10mstyp TON_10ms_typ
#define TPtyp TP_typ
#define TOFtyp TOF_typ
#define TONtyp TON_typ
#define SEMAtyp SEMA_typ
#define RStyp RS_typ
#define SRtyp SR_typ
#define R_TRIGtyp R_TRIG_typ
#define F_TRIGtyp F_TRIG_typ
#define CTUtyp CTU_typ
#define CTDtyp CTD_typ
#define CTUDtyp CTUD_typ
#define RF_TRIGtyp RF_TRIG_typ
/* Constants */
/* Datatypes */
/* Datatypes of function blocks */
typedef struct TP_10ms
{
/* VAR_INPUT (analogous) */
unsigned long PT;
/* VAR_OUTPUT (analogous) */
unsigned long ET;
/* VAR (analogous) */
unsigned long StartTime;
/* VAR_INPUT (digital) */
plcbit IN;
/* VAR_OUTPUT (digital) */
plcbit Q;
} TP_10ms_typ;
typedef struct TOF_10ms
{
/* VAR_INPUT (analogous) */
unsigned long PT;
/* VAR_OUTPUT (analogous) */
unsigned long ET;
/* VAR (analogous) */
unsigned long StartTime;
/* VAR_INPUT (digital) */
plcbit IN;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} TOF_10ms_typ;
typedef struct TON_10ms
{
/* VAR_INPUT (analogous) */
unsigned long PT;
/* VAR_OUTPUT (analogous) */
unsigned long ET;
/* VAR (analogous) */
unsigned long StartTime;
/* VAR_INPUT (digital) */
plcbit IN;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} TON_10ms_typ;
typedef struct TP
{
/* VAR_INPUT (analogous) */
plctime PT;
/* VAR_OUTPUT (analogous) */
plctime ET;
/* VAR (analogous) */
plctime StartTime;
unsigned long Restart;
/* VAR_INPUT (digital) */
plcbit IN;
/* VAR_OUTPUT (digital) */
plcbit Q;
} TP_typ;
typedef struct TOF
{
/* VAR_INPUT (analogous) */
plctime PT;
/* VAR_OUTPUT (analogous) */
plctime ET;
/* VAR (analogous) */
plctime StartTime;
unsigned long Restart;
/* VAR_INPUT (digital) */
plcbit IN;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} TOF_typ;
typedef struct TON
{
/* VAR_INPUT (analogous) */
plctime PT;
/* VAR_OUTPUT (analogous) */
plctime ET;
/* VAR (analogous) */
plctime StartTime;
unsigned long Restart;
/* VAR_INPUT (digital) */
plcbit IN;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} TON_typ;
typedef struct SEMA
{
/* VAR_INPUT (digital) */
plcbit CLAIM;
plcbit RELEASE;
/* VAR_OUTPUT (digital) */
plcbit BUSY;
/* VAR (digital) */
plcbit X;
} SEMA_typ;
typedef struct RS
{
/* VAR_INPUT (digital) */
plcbit SET;
plcbit RESET1;
/* VAR_OUTPUT (digital) */
plcbit Q1;
} RS_typ;
typedef struct SR
{
/* VAR_INPUT (digital) */
plcbit SET1;
plcbit RESET;
/* VAR_OUTPUT (digital) */
plcbit Q1;
} SR_typ;
typedef struct R_TRIG
{
/* VAR_INPUT (digital) */
plcbit CLK;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} R_TRIG_typ;
typedef struct F_TRIG
{
/* VAR_INPUT (digital) */
plcbit CLK;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} F_TRIG_typ;
typedef struct CTU
{
/* VAR_INPUT (analogous) */
unsigned short PV;
/* VAR_OUTPUT (analogous) */
unsigned short CV;
/* VAR_INPUT (digital) */
plcbit CU;
plcbit RESET;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} CTU_typ;
typedef struct CTD
{
/* VAR_INPUT (analogous) */
unsigned short PV;
/* VAR_OUTPUT (analogous) */
unsigned short CV;
/* VAR_INPUT (digital) */
plcbit CD;
plcbit LOAD;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} CTD_typ;
typedef struct CTUD
{
/* VAR_INPUT (analogous) */
signed short PV;
/* VAR_OUTPUT (analogous) */
signed short CV;
/* VAR_INPUT (digital) */
plcbit CU;
plcbit CD;
plcbit RESET;
plcbit LOAD;
/* VAR_OUTPUT (digital) */
plcbit QU;
plcbit QD;
/* VAR (digital) */
plcbit MU;
plcbit MD;
} CTUD_typ;
typedef struct RF_TRIG
{
/* VAR_INPUT (digital) */
plcbit CLK;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} RF_TRIG_typ;
/* Prototyping of functions and function blocks */
void TP_10ms(TP_10ms_typ* inst);
void TOF_10ms(TOF_10ms_typ* inst);
void TON_10ms(TON_10ms_typ* inst);
void TP(TP_typ* inst);
void TOF(TOF_typ* inst);
void TON(TON_typ* inst);
void SEMA(SEMA_typ* inst);
void RS(RS_typ* inst);
void SR(SR_typ* inst);
void R_TRIG(R_TRIG_typ* inst);
void F_TRIG(F_TRIG_typ* inst);
void CTU(CTU_typ* inst);
void CTD(CTD_typ* inst);
void CTUD(CTUD_typ* inst);
void RF_TRIG(RF_TRIG_typ* inst);
#ifdef __cplusplus
};
#endif
#endif /* STANDARD_H_ */

View File

@@ -0,0 +1,262 @@
/* Automation Studio Generated Header File, Format Version 1.00 */
/* do not change */
#ifndef STANDARD_H_
#define STANDARD_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <bur/plc.h>
#define TP_10mstyp TP_10ms_typ
#define TOF_10mstyp TOF_10ms_typ
#define TON_10mstyp TON_10ms_typ
#define TPtyp TP_typ
#define TOFtyp TOF_typ
#define TONtyp TON_typ
#define SEMAtyp SEMA_typ
#define RStyp RS_typ
#define SRtyp SR_typ
#define R_TRIGtyp R_TRIG_typ
#define F_TRIGtyp F_TRIG_typ
#define CTUtyp CTU_typ
#define CTDtyp CTD_typ
#define CTUDtyp CTUD_typ
#define RF_TRIGtyp RF_TRIG_typ
/* Constants */
/* Datatypes */
/* Datatypes of function blocks */
typedef struct TP_10ms
{
/* VAR_INPUT (analogous) */
unsigned long PT;
/* VAR_OUTPUT (analogous) */
unsigned long ET;
/* VAR (analogous) */
unsigned long StartTime;
/* VAR_INPUT (digital) */
plcbit IN;
/* VAR_OUTPUT (digital) */
plcbit Q;
} TP_10ms_typ;
typedef struct TOF_10ms
{
/* VAR_INPUT (analogous) */
unsigned long PT;
/* VAR_OUTPUT (analogous) */
unsigned long ET;
/* VAR (analogous) */
unsigned long StartTime;
/* VAR_INPUT (digital) */
plcbit IN;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} TOF_10ms_typ;
typedef struct TON_10ms
{
/* VAR_INPUT (analogous) */
unsigned long PT;
/* VAR_OUTPUT (analogous) */
unsigned long ET;
/* VAR (analogous) */
unsigned long StartTime;
/* VAR_INPUT (digital) */
plcbit IN;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} TON_10ms_typ;
typedef struct TP
{
/* VAR_INPUT (analogous) */
plctime PT;
/* VAR_OUTPUT (analogous) */
plctime ET;
/* VAR (analogous) */
plctime StartTime;
unsigned long Restart;
/* VAR_INPUT (digital) */
plcbit IN;
/* VAR_OUTPUT (digital) */
plcbit Q;
} TP_typ;
typedef struct TOF
{
/* VAR_INPUT (analogous) */
plctime PT;
/* VAR_OUTPUT (analogous) */
plctime ET;
/* VAR (analogous) */
plctime StartTime;
unsigned long Restart;
/* VAR_INPUT (digital) */
plcbit IN;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} TOF_typ;
typedef struct TON
{
/* VAR_INPUT (analogous) */
plctime PT;
/* VAR_OUTPUT (analogous) */
plctime ET;
/* VAR (analogous) */
plctime StartTime;
unsigned long Restart;
/* VAR_INPUT (digital) */
plcbit IN;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} TON_typ;
typedef struct SEMA
{
/* VAR_INPUT (digital) */
plcbit CLAIM;
plcbit RELEASE;
/* VAR_OUTPUT (digital) */
plcbit BUSY;
/* VAR (digital) */
plcbit X;
} SEMA_typ;
typedef struct RS
{
/* VAR_INPUT (digital) */
plcbit SET;
plcbit RESET1;
/* VAR_OUTPUT (digital) */
plcbit Q1;
} RS_typ;
typedef struct SR
{
/* VAR_INPUT (digital) */
plcbit SET1;
plcbit RESET;
/* VAR_OUTPUT (digital) */
plcbit Q1;
} SR_typ;
typedef struct R_TRIG
{
/* VAR_INPUT (digital) */
plcbit CLK;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} R_TRIG_typ;
typedef struct F_TRIG
{
/* VAR_INPUT (digital) */
plcbit CLK;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} F_TRIG_typ;
typedef struct CTU
{
/* VAR_INPUT (analogous) */
unsigned short PV;
/* VAR_OUTPUT (analogous) */
unsigned short CV;
/* VAR_INPUT (digital) */
plcbit CU;
plcbit RESET;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} CTU_typ;
typedef struct CTD
{
/* VAR_INPUT (analogous) */
unsigned short PV;
/* VAR_OUTPUT (analogous) */
unsigned short CV;
/* VAR_INPUT (digital) */
plcbit CD;
plcbit LOAD;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} CTD_typ;
typedef struct CTUD
{
/* VAR_INPUT (analogous) */
signed short PV;
/* VAR_OUTPUT (analogous) */
signed short CV;
/* VAR_INPUT (digital) */
plcbit CU;
plcbit CD;
plcbit RESET;
plcbit LOAD;
/* VAR_OUTPUT (digital) */
plcbit QU;
plcbit QD;
/* VAR (digital) */
plcbit MU;
plcbit MD;
} CTUD_typ;
typedef struct RF_TRIG
{
/* VAR_INPUT (digital) */
plcbit CLK;
/* VAR_OUTPUT (digital) */
plcbit Q;
/* VAR (digital) */
plcbit M;
} RF_TRIG_typ;
/* Prototyping of functions and function blocks */
void TP_10ms(TP_10ms_typ* inst);
void TOF_10ms(TOF_10ms_typ* inst);
void TON_10ms(TON_10ms_typ* inst);
void TP(TP_typ* inst);
void TOF(TOF_typ* inst);
void TON(TON_typ* inst);
void SEMA(SEMA_typ* inst);
void RS(RS_typ* inst);
void SR(SR_typ* inst);
void R_TRIG(R_TRIG_typ* inst);
void F_TRIG(F_TRIG_typ* inst);
void CTU(CTU_typ* inst);
void CTD(CTD_typ* inst);
void CTUD(CTUD_typ* inst);
void RF_TRIG(RF_TRIG_typ* inst);
#ifdef __cplusplus
};
#endif
#endif /* STANDARD_H_ */

View File

@@ -0,0 +1,262 @@
(********************************************************************
* COPYRIGHT -- Bernecker + Rainer
********************************************************************
* Library: standard
* File: standard.fun
* Author: B+R
********************************************************************
* Functions and function blocks of library standard
********************************************************************)
FUNCTION_BLOCK RF_TRIG (*recognizes both edges of BOOL values*)
VAR_INPUT
CLK :BOOL; (*input signal of the edge to be recognized*)
END_VAR
VAR_OUTPUT
Q :BOOL; (*TRUE if the input signal was FALSE on the last call and is now TRUE*)
END_VAR
VAR
M :BOOL; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK CTUD (*counts upward or downward*)
VAR_INPUT
CU :BOOL; (*counter CV is increased by 1 by CU when the edge is rising*)
CD :BOOL; (*counter CV is reduced by 1 by CD when the edge is rising*)
RESET :BOOL; (*counter CV is set to 0 if RESET is TRUE*)
LOAD :BOOL; (*if LOAD is TRUE, then counter CV is initialized with the starting value PV*)
PV :INT; (*start value*)
END_VAR
VAR_OUTPUT
QU :BOOL; (*is TRUE if CV is greater than or equal to PV*)
QD :BOOL; (*is TRUE if CV equals 0*)
CV :INT; (*counter*)
END_VAR
VAR
MU :BOOL; (*internal variable*)
MD :BOOL; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK CTD (*counts downward*)
VAR_INPUT
CD :BOOL; (*counter CV is reduced by 1 by CD when the edge is rising*)
LOAD :BOOL; (*if LOAD is TRUE, then counter CV is initialized with the starting value PV*)
PV :UINT; (*start value*)
END_VAR
VAR_OUTPUT
Q :BOOL; (*is TRUE if CV equals 0*)
CV :UINT; (*counter*)
END_VAR
VAR
M :BOOL; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK CTU (*counts upward*)
VAR_INPUT
CU :BOOL; (*counter CV is increased by 1 by CU when the edge is rising*)
RESET :BOOL; (*counter CV is set to 0 if RESET is TRUE*)
PV :UINT; (*comparison variable*)
END_VAR
VAR_OUTPUT
Q :BOOL; (*is TRUE if counter CV is greater than or equal to the PV comparison variable*)
CV :UINT; (*counter*)
END_VAR
VAR
M :BOOL; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK F_TRIG (*recognizes falling edges from BOOL values*)
VAR_INPUT
CLK :BOOL; (*input signal whose edge should be detected*)
END_VAR
VAR_OUTPUT
Q :BOOL; (*is set to TRUE if the input signal was TRUE during the last call and is now FALSE*)
END_VAR
VAR
M :BOOL; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK R_TRIG (*recognizes rising edges from BOOL values*)
VAR_INPUT
CLK :BOOL; (*input signal whose edge should be detected*)
END_VAR
VAR_OUTPUT
Q :BOOL; (*is set to TRUE if the input signal was FALSE during the last call and is now TRUE*)
END_VAR
VAR
M :BOOL; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK SR (*sets or resets the output (set has priority)*)
VAR_INPUT
SET1 :BOOL; (*sets output Q1 (priority)*)
RESET :BOOL; (*resets output Q1*)
END_VAR
VAR_OUTPUT
Q1 :BOOL; (*output value *)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK RS (*sets or resets the output (reset has priority)*)
VAR_INPUT
SET :BOOL; (*sets output Q1*)
RESET1 :BOOL; (*resets output Q1 (priority)*)
END_VAR
VAR_OUTPUT
Q1 :BOOL; (*output value*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK SEMA (*blocks access within the same task class (simple semaphore)*)
VAR_INPUT
CLAIM :BOOL; (*locks semaphore*)
RELEASE :BOOL; (*releases semaphore*)
END_VAR
VAR_OUTPUT
BUSY :BOOL; (*TRUE if the semaphore was already locked*)
END_VAR
VAR
X :BOOL; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK TON (*implements a switch on delay*)
VAR_INPUT
IN :BOOL; (*input signal*)
PT :TIME; (*delay time*)
END_VAR
VAR_OUTPUT
Q :BOOL; (*rising edge of the input signal is delayed by PT*)
ET :TIME; (*elapsed time*)
END_VAR
VAR
StartTime :TIME; (*internal variable*)
M :BOOL; (*internal variable*)
Restart :UDINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK TOF (*implements a switch off delay*)
VAR_INPUT
IN :BOOL; (*input signal*)
PT :TIME; (*delay time*)
END_VAR
VAR_OUTPUT
Q :BOOL; (*falling edge of the input signal is delayed by PT*)
ET :TIME; (*elapsed time*)
END_VAR
VAR
M :BOOL; (*internal variable*)
StartTime :TIME; (*internal variable*)
Restart :UDINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK TP (*implements a pulse generator*)
VAR_INPUT
IN :BOOL; (*input signal*)
PT :TIME; (*pulse time*)
END_VAR
VAR_OUTPUT
Q :BOOL; (*output signal*)
ET :TIME; (*elapsed time*)
END_VAR
VAR
StartTime :TIME; (*internal variable*)
Restart :UDINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK TON_10ms (*implements a switch on delay based on 10 ms steps*)
VAR_INPUT
IN :BOOL; (*input signal*)
PT :UDINT; (*delay time in 10 ms steps*)
END_VAR
VAR_OUTPUT
Q :BOOL; (*output signal, the rising edge of the input signal is delayed by PT*)
ET :UDINT; (*elapsed time in 10 ms increments*)
END_VAR
VAR
StartTime :UDINT; (*internal variable*)
M :BOOL; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK TOF_10ms (*implements a switch off delay based on 10 ms steps*)
VAR_INPUT
IN :BOOL; (*input signal*)
PT :UDINT; (*delay time in 10 ms steps*)
END_VAR
VAR_OUTPUT
Q :BOOL; (*output signal, the falling edge of the input signal is delayed by PT*)
ET :UDINT; (*elapsed time in 10 ms increments*)
END_VAR
VAR
M :BOOL; (*internal variable*)
StartTime :UDINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK TP_10ms (*implements a pulse using 10 ms steps*)
VAR_INPUT
IN :BOOL; (*input signal*)
PT :UDINT; (*pulse time in 10 ms steps*)
END_VAR
VAR_OUTPUT
Q :BOOL; (*output signal*)
ET :UDINT; (*elapsed time in 10 ms increments*)
END_VAR
VAR
StartTime :UDINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION LEN : INT (*calculates the length of a string*)
VAR_INPUT
IN :STRING[32767]; (*input string*)
END_VAR
END_FUNCTION
FUNCTION LEFT : STRING[255] (*extracts a certain amount (L) of leftmost characters from a string*)
VAR_INPUT
IN :STRING[32767]; (*input string*)
L :INT; (*number of characters*)
END_VAR
END_FUNCTION
FUNCTION RIGHT : STRING[255] (*extracts a certain amount (L) of rightmost characters from a string*)
VAR_INPUT
IN :STRING[32767]; (*input string*)
L :INT; (*number of characters*)
END_VAR
END_FUNCTION
FUNCTION MID : STRING[255] (*extracts L number of characters out of string beginning with position P*)
VAR_INPUT
IN :STRING[32767]; (*string which should be extracted from*)
L :INT; (*number of characters*)
P :INT; (*position of the first character which should be extracted*)
END_VAR
END_FUNCTION
FUNCTION CONCAT : STRING[255] (*attaches strings to one another*)
VAR_INPUT
IN1 :STRING[32767]; (*first input string*)
IN2 :STRING[32767]; (*second input string*)
END_VAR
END_FUNCTION
FUNCTION INSERT : STRING[255] (*inserts a string into a string*)
VAR_INPUT
IN1 :STRING[32767]; (*string which should be inserted into*)
IN2 :STRING[32767]; (*string which should be inserted*)
P :INT; (*position where insertion should take place*)
END_VAR
END_FUNCTION
FUNCTION DELETE : STRING[255] (*deletes L number of characters from the IN string beginning with the Pth character position*)
VAR_INPUT
IN :STRING[32767]; (*input string*)
L :INT; (*number of characters to be deleted*)
P :INT; (*starting position of characters to be deleted*)
END_VAR
END_FUNCTION
FUNCTION REPLACE : STRING[255] (*replaces characters in a string*)
VAR_INPUT
IN1 :STRING[32767]; (*string which should have characters replaced*)
IN2 :STRING[32767]; (*string used for the replacement*)
L :INT; (*length of the area to be replaced*)
P :INT; (*starting position of replacement*)
END_VAR
END_FUNCTION
FUNCTION FIND : INT (*determines the position of a string inside a string*)
VAR_INPUT
IN1 :STRING[32767]; (*string which should be looked through*)
IN2 :STRING[32767]; (*string which should be looked for*)
END_VAR
END_FUNCTION

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=3.0.0.0?>
<Library xmlns="http://br-automation.co.at/AS/Library" Description="The SYS_LIB library contains functions for memory management and operating system manipulation as well as hardware-specific functions.">
<Files>
<File>sys_lib.var</File>
<File>sys_lib.typ</File>
<File>sys_lib.fun</File>
</Files>
<Dependencies>
<Dependency ObjectName="runtime" />
</Dependencies>
</Library>

View File

@@ -0,0 +1,683 @@
/****************************************************************************/
/* */
/* sys_lib.h */
/* Declarations and Prototypes for libsys_lib.a */
/* */
/* Automation Studio */
/* Copyright Bernecker&Rainer 1998 */
/* */
/****************************************************************************/
#ifndef _SYS_LIB_H_
#define _SYS_LIB_H_
#ifdef __cplusplus
extern "C"
{
#endif
#include <bur/plctypes.h>
#include <runtime.h>
#define TMP_MODE 0x8000 /* temporary suspend/resume for */
/* PLC and user task */
/* Error codes of the BURTRAP/SYS_LIB services */
#define ERR_BUR_WRROW 2061 /* illegal row */
#define ERR_BUR_WRCOL 2062 /* illegal column */
#define ERR_BUR_WR_CHAR 2063 /* invalid ASCII character */
#define ERR_BUR_NORTC 2073 /* RTC not existing or uninitialized */
#define ERR_BUR_NOMEM 3030 /* out of memory */
#define ERR_BUR_MEMVWBUSY 3035 /* memory management busy */
#define ERR_BUR_ILLPTR 3104 /* illegal data pointer in MEM_free */
#define ERR_BUR_PSOS_BASE 3300 /* base number of pSOS errors */
#define ERR_BUR_ILLTKNR 3300 /* illegal task-class number */
#define ERR_BUR_WROFFSET 3301 /* illegal offset */
#define ERR_BUR_ILLSTATE 3302 /* illegal state of object */
#define ERR_BUR_NOMSG 3303 /* no message sent/received */
#define ERR_BUR_DUPOBJ 3305 /* object exists */
#define ERR_BUR_TIMEOUT 3304 /* timeout error */
#define ERR_BUR_EXISTS 3306 /* entry exists */
#define ERR_BUR_LCOUNT 3307 /* Linkcnt <> 0 in AVT_cancel () */
#define ERR_BUR_BURNING 3308 /* error burning module */
#define ERR_BUR_INVALIDMBX 3309 /* invalid mailbox */
#define ERR_BUR_ILLBPTR 3310 /* invalid base pointer */
#define ERR_BUR_ILLTYP 3311 /* invalid I/O type */
#define ERR_BUR_ILLEXT 3312 /* invalid ext. bit */
#define ERR_BUR_ILLVER 3313 /* invalid version */
/* e.g. BURTRAP V1.10 to SPSSW V1.05 */
#define ERR_BUR_ILLLEN 3314 /* invalid data length */
#define ERR_BUR_MAX_LCOUNT 3315 /* AVT_attach: LCOUNT > 127 */
#define ERR_BUR_AVT_FREE 3316 /* AVT_release:LCOUNT = 0 */
#define ERR_BUR_ILLPAR 3317 /* illegal parameter */
#define ERR_BUR_INSTALL 3318 /* error install datamodule */
#define ERR_BUR_WRONG_MODTYP 3319 /* wrong Moduletype */
#define ERR_BUR_OBJDEL 3320 /* object already deleted */
#define ERR_BUR_ILLOBJ 3324 /* object does not exist */
#define ERR_BUR_ILLOBJTYP 3328 /* invalid object type */
#define ERR_BUR_NOENTRY 3332 /* no entry */
#define ERR_BUR_TOOLONG_PVNAME 3333 /* too long PV name */
#define ERR_BUR_ILLIDENT 3336 /* illegal ident */
#define ERR_BUR_NOSMBUF 3560 /* no more semaphore buffers */
#define ERR_BUR_NOSM 3564 /* semaphore not available */
#define ERR_BUR_SMDEL 3568 /* semaphore deleted */
#define ERR_BUR_NOTIME 3584 /* time not available */
#define ERR_BUR_ILLDATE 3588 /* date : out of range */
#define ERR_BUR_ILLTIME 3592 /* time : out of range */
#define ERR_BUR_ILLTICKS 3596 /* ticks : out of range */
#define ERR_BUR_MEM_ALLOC 3600 /* not enough continuous memory */
#define ERR_BUR_TMP_ALLOC 3601 /* not enough continuous memory */
#define ERR_BUR_MEM_FREE 3700 /* invalid pointer/length */
#define ERR_BUR_TMP_FREE 3701 /* invalid pointer/length */
/* State for object PLC task */
#define Z_ST_created 1
#define Z_ST_running 2
#define Z_ST_blocked 3
#define Z_ST_exist 0x00
#define Z_ST_installed 0x82
#define Z_ST_PVinstalled 0x83
#define Z_ST_IOinstalled 0x84
#define Z_ST_IOdeinstalled 0x85
#define Z_ST_PVdeinstalled 0x86
#define Z_ST_delete 0x87
#define Z_ST_stdebug 0x88
#define Z_ST_tmp_suspended 0x90
/* PV data types */
#define PB_DT_STRUCT 0 /* structure */
#define PB_DT_BOOL 1 /* boolean */
#define PB_DT_INT8 2 /* integer8 */
#define PB_DT_INT16 3 /* integer16 */
#define PB_DT_INT32 4 /* integer32 */
#define PB_DT_BYTE 5 /* unsigned integer8 */
#define PB_DT_WORD 6 /* unsigned integer16 */
#define PB_DT_LONG 7 /* unsigned integer32 */
#define PB_DT_FLOAT 8 /* floating point */
#define PB_DT_VIS 9 /* visible string*/
#define PB_DT_OCTET 10 /* octet string */
#define PB_DT_DATE 11 /* date */
#define PB_DT_TIME 12 /* time of day */
#define PB_DT_DIFF 13 /* time difference */
#define PB_DT_BIT 14 /* bit string */
#define PB_DT_ARRAY 15 /* array */
/* memory types */
#define SYS_RAM 1 /* RAM */
#define USER_ROM1 2 /* EPROM */
#define FIX_RAM 5 /* fixed RAM */
typedef struct RTCtime_typ {
/* 1. UDINT */
UINT year; /* year, starting with zero */
USINT month; /* month: 1 - 12 */
USINT day; /* day: 1 - 31 */
/* 2. UDINT */
USINT reserve;
USINT hour; /* hour: 0 - 23 */
USINT minute; /* minute: 0 - 59 */
USINT second; /* second: 0 - 59 */
/* 3. UDINT */
UINT millisec; /* millisecond: 0 - 999 */
UINT microsec; /* microsecond: 0 - 999 */
} RTCtime_typ;
/* structure for SYSxinfo */
typedef struct SYSxinfo_typ {
char aws_name[6];
char aws_type[2];
UDINT cpu_info;
UINT ma_globl_len;
UINT md_globl_len;
UDINT os_len;
UDINT user_len;
UDINT tmp_len;
UDINT eprom_len;
UDINT fix_ram_len;
} SYSxinfo_typ;
/* structure for MO_list */
typedef struct MO_List_typ {
char name[14]; /* name of the module (ASCII) */
USINT grp; /* groups */
USINT type; /* module type */
USINT state; /* state of the module */
USINT reserve;
UDINT adress; /* physical address of the module */
UDINT memtype; /* memory type (0=OTP,1=RAM,2=EPROM,3=FLASH */
} MO_List_typ; /* 5=FIXRAM) */
/* structure for MO_info */
typedef struct MO_info
{
/* VAR_INPUT (analog) */
unsigned long pName;
unsigned char grp;
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned char type;
unsigned char state;
unsigned long memType;
unsigned long address;
unsigned long size;
unsigned char version[10];
struct RTCtime_typ date;
/* VAR_INPUT (digital) */
plcbit enable;
} MO_info_typ;
/* structure for PV_list */
typedef struct PV_List_typ {
char name[14]; /* name of the PV (ASCII) */
USINT tcnr; /* PV task class */
USINT grp; /* PV group */
UDINT ident; /* PV identifier */
UDINT adress; /* physical address of the PV */
} PV_List_typ;
/* structue for PV_xlist */
typedef struct PV_xList_typ {
char name[33]; /* name of PV (ASCII) */
USINT data_typ; /* data type of PV */
UDINT data_len; /* data length of PV */
UDINT dimension; /* dimension of PV */
UDINT adress; /* physical address of PV */
}PV_xList_typ;
/* structure for ERR_read */
typedef struct ERR_typ {
UINT err_nr; /* error number */
UDINT err_info; /* additional information */
char t_name[5]; /* name of the running task */
USINT err_type; /* error type (1=fatal, 2=warning, 3=info) */
UINT err_year; /* time of the error in RTC format */
USINT err_month;
USINT err_day;
USINT err_reserve;
USINT err_hour;
USINT err_minute;
USINT err_second;
UINT err_millisec;
UINT err_microsec;
} ERR_typ;
/* structure for ERR_xread */
typedef struct ERR_xtyp {
UINT err_nr; /* error number */
UDINT err_info; /* additional information */
char t_name[5]; /* name of the running task */
USINT err_type; /* error type (1=Fatal, 2=Warning, 3=Info) */
UINT err_year; /* time of the error in RTC format */
USINT err_month;
USINT err_day;
USINT err_reserve;
USINT err_hour;
USINT err_minute;
USINT err_second;
UINT err_millisec;
UINT err_microsec;
USINT err_string[34]; /* 32 byte string with 0 termination */
} ERR_xtyp;
/* structure for MO_ver */
typedef struct MoVerStruc_typ {
USINT version[10]; /* Version of the BR Module */
UINT year;
USINT month;
USINT day;
USINT reserve;
USINT hour;
USINT minute;
USINT second;
} MoVerStruc_typ;
/* structure for the FUB Bit2Byte */
typedef struct Bit2Byte {
/* non boolean input parameter */
UDINT bitadr;
UINT length;
/* non boolean output parameter*/
UDINT byteadr;
/* non boolean static local */
USINT byte_00;
USINT byte_01;
USINT byte_02;
USINT byte_03;
USINT byte_04;
USINT byte_05;
USINT byte_06;
USINT byte_07;
USINT byte_08;
USINT byte_09;
USINT byte_10;
USINT byte_11;
USINT byte_12;
USINT byte_13;
USINT byte_14;
USINT byte_15;
/* boolean input parameter */
/* boolean output parameter */
/* boolean static local */
BOOL bmem000;
BOOL bmem001;
BOOL bmem002;
BOOL bmem003;
BOOL bmem004;
BOOL bmem005;
BOOL bmem006;
BOOL bmem007;
BOOL bmem008;
BOOL bmem009;
BOOL bmem010;
BOOL bmem011;
BOOL bmem012;
BOOL bmem013;
BOOL bmem014;
BOOL bmem015;
BOOL bmem016;
BOOL bmem017;
BOOL bmem018;
BOOL bmem019;
BOOL bmem020;
BOOL bmem021;
BOOL bmem022;
BOOL bmem023;
BOOL bmem024;
BOOL bmem025;
BOOL bmem026;
BOOL bmem027;
BOOL bmem028;
BOOL bmem029;
BOOL bmem030;
BOOL bmem031;
BOOL bmem032;
BOOL bmem033;
BOOL bmem034;
BOOL bmem035;
BOOL bmem036;
BOOL bmem037;
BOOL bmem038;
BOOL bmem039;
BOOL bmem040;
BOOL bmem041;
BOOL bmem042;
BOOL bmem043;
BOOL bmem044;
BOOL bmem045;
BOOL bmem046;
BOOL bmem047;
BOOL bmem048;
BOOL bmem049;
BOOL bmem050;
BOOL bmem051;
BOOL bmem052;
BOOL bmem053;
BOOL bmem054;
BOOL bmem055;
BOOL bmem056;
BOOL bmem057;
BOOL bmem058;
BOOL bmem059;
BOOL bmem060;
BOOL bmem061;
BOOL bmem062;
BOOL bmem063;
BOOL bmem064;
BOOL bmem065;
BOOL bmem066;
BOOL bmem067;
BOOL bmem068;
BOOL bmem069;
BOOL bmem070;
BOOL bmem071;
BOOL bmem072;
BOOL bmem073;
BOOL bmem074;
BOOL bmem075;
BOOL bmem076;
BOOL bmem077;
BOOL bmem078;
BOOL bmem079;
BOOL bmem080;
BOOL bmem081;
BOOL bmem082;
BOOL bmem083;
BOOL bmem084;
BOOL bmem085;
BOOL bmem086;
BOOL bmem087;
BOOL bmem088;
BOOL bmem089;
BOOL bmem090;
BOOL bmem091;
BOOL bmem092;
BOOL bmem093;
BOOL bmem094;
BOOL bmem095;
BOOL bmem096;
BOOL bmem097;
BOOL bmem098;
BOOL bmem099;
BOOL bmem100;
BOOL bmem101;
BOOL bmem102;
BOOL bmem103;
BOOL bmem104;
BOOL bmem105;
BOOL bmem106;
BOOL bmem107;
BOOL bmem108;
BOOL bmem109;
BOOL bmem110;
BOOL bmem111;
BOOL bmem112;
BOOL bmem113;
BOOL bmem114;
BOOL bmem115;
BOOL bmem116;
BOOL bmem117;
BOOL bmem118;
BOOL bmem119;
BOOL bmem120;
BOOL bmem121;
BOOL bmem122;
BOOL bmem123;
BOOL bmem124;
BOOL bmem125;
BOOL bmem126;
BOOL bmem127;
BOOL bmem128;
BOOL bmem129;
BOOL bmem130;
BOOL bmem131;
BOOL bmem132;
BOOL bmem133;
BOOL bmem134;
BOOL bmem135;
BOOL bmem136;
BOOL bmem137;
BOOL bmem138;
BOOL bmem139;
} Bit2Byte_typ;
/* structure for the FUB Byte2Bit */
typedef struct Byte2Bit {
/* non boolean input parameter */
UDINT byteadr;
UINT length;
/* non boolean output parameter*/
UDINT bitadr;
/* non boolean static local */
/* boolean input parameter */
/* boolean output parameter */
/* boolean static local */
BOOL bmem000;
BOOL bmem001;
BOOL bmem002;
BOOL bmem003;
BOOL bmem004;
BOOL bmem005;
BOOL bmem006;
BOOL bmem007;
BOOL bmem008;
BOOL bmem009;
BOOL bmem010;
BOOL bmem011;
BOOL bmem012;
BOOL bmem013;
BOOL bmem014;
BOOL bmem015;
BOOL bmem016;
BOOL bmem017;
BOOL bmem018;
BOOL bmem019;
BOOL bmem020;
BOOL bmem021;
BOOL bmem022;
BOOL bmem023;
BOOL bmem024;
BOOL bmem025;
BOOL bmem026;
BOOL bmem027;
BOOL bmem028;
BOOL bmem029;
BOOL bmem030;
BOOL bmem031;
BOOL bmem032;
BOOL bmem033;
BOOL bmem034;
BOOL bmem035;
BOOL bmem036;
BOOL bmem037;
BOOL bmem038;
BOOL bmem039;
BOOL bmem040;
BOOL bmem041;
BOOL bmem042;
BOOL bmem043;
BOOL bmem044;
BOOL bmem045;
BOOL bmem046;
BOOL bmem047;
BOOL bmem048;
BOOL bmem049;
BOOL bmem050;
BOOL bmem051;
BOOL bmem052;
BOOL bmem053;
BOOL bmem054;
BOOL bmem055;
BOOL bmem056;
BOOL bmem057;
BOOL bmem058;
BOOL bmem059;
BOOL bmem060;
BOOL bmem061;
BOOL bmem062;
BOOL bmem063;
BOOL bmem064;
BOOL bmem065;
BOOL bmem066;
BOOL bmem067;
BOOL bmem068;
BOOL bmem069;
BOOL bmem070;
BOOL bmem071;
BOOL bmem072;
BOOL bmem073;
BOOL bmem074;
BOOL bmem075;
BOOL bmem076;
BOOL bmem077;
BOOL bmem078;
BOOL bmem079;
BOOL bmem080;
BOOL bmem081;
BOOL bmem082;
BOOL bmem083;
BOOL bmem084;
BOOL bmem085;
BOOL bmem086;
BOOL bmem087;
BOOL bmem088;
BOOL bmem089;
BOOL bmem090;
BOOL bmem091;
BOOL bmem092;
BOOL bmem093;
BOOL bmem094;
BOOL bmem095;
BOOL bmem096;
BOOL bmem097;
BOOL bmem098;
BOOL bmem099;
BOOL bmem100;
BOOL bmem101;
BOOL bmem102;
BOOL bmem103;
BOOL bmem104;
BOOL bmem105;
BOOL bmem106;
BOOL bmem107;
BOOL bmem108;
BOOL bmem109;
BOOL bmem110;
BOOL bmem111;
BOOL bmem112;
BOOL bmem113;
BOOL bmem114;
BOOL bmem115;
BOOL bmem116;
BOOL bmem117;
BOOL bmem118;
BOOL bmem119;
BOOL bmem120;
BOOL bmem121;
BOOL bmem122;
BOOL bmem123;
BOOL bmem124;
BOOL bmem125;
BOOL bmem126;
BOOL bmem127;
BOOL bmem128;
BOOL bmem129;
BOOL bmem130;
BOOL bmem131;
BOOL bmem132;
BOOL bmem133;
BOOL bmem134;
BOOL bmem135;
BOOL bmem136;
BOOL bmem137;
BOOL bmem138;
BOOL bmem139;
} Byte2Bit_typ;
/***************/
/* Prototyping */
/***************/
UINT PV_ident (char *pv_name_p, USINT pv_tcnr, USINT pv_grpnr,
UDINT *pv_ident);
UINT PV_setval (UDINT pv_ident, UDINT value);
UINT PV_getval (UDINT pv_ident, UDINT *value);
UINT PV_getadr (char *pv_name_p, USINT pv_tcnr, USINT pv_grpnr,
UDINT *pv_adresse);
UINT PV_xgetadr (char *pv_name, UDINT *pv_adresse, UDINT *data_len);
UINT PV_xsetval (UDINT pv_ident, UINT subindex, void *data_p,
USINT data_len);
UINT PV_xgetval (UDINT pv_ident, UINT subindex, void *data_p,
USINT data_len);
UINT PV_info (UDINT pv_ident, UDINT *data_type, UDINT *data_len,
UINT *dimension);
UINT PV_list (UINT prev_index, UINT *index, PV_List_typ *pvl_p);
UINT PV_xlist (UINT prev_index, UINT *index, PV_xList_typ *pvl_p);
UINT PV_item (char *pv_name, UINT index, char *itemname);
UINT PV_ninfo (char *pv_name, UDINT *data_typ_p, UDINT *data_len_p,
UINT *dimension_p);
UINT SYS_info (UDINT *sg_init_cnt, UDINT *sg_initdescr, UDINT *sg_tickcnt,
UDINT *sg_version, UDINT *sg_ov_version);
UINT SYSxinfo (SYSxinfo_typ *sx_p);
UINT SYSreset (BOOL enable, USINT mode);
USINT SYS_battery (void);
UINT MO_list (UINT prev_index, UINT *index, MO_List_typ *mol_p);
void MO_info (struct MO_info* pInst);
UINT KEY_enadis (BOOL mode);
UINT KEY_read (USINT keys[4]);
UINT FORCE_info (USINT tcnr, BOOL *force);
UINT ST_ident (char *st_name_p, USINT st_grp, UDINT *st_ident);
UINT ST_suspend (UDINT st_ident);
UINT ST_resume (UDINT st_ident);
UINT ST_tmp_suspend (UDINT st_ident);
UINT ST_tmp_resume (UDINT st_ident);
UINT ST_allsuspend (void);
UINT ST_info (UDINT st_ident, USINT *state, SINT *tcnr);
UINT ST_name (UDINT st_ident, char *st_name_p, USINT *st_grp);
UINT UT_ident (char *ut_name_p, USINT ut_grp, USINT ut_proc, char *ut_sps_p,UDINT *ut_ident);
UINT UT_suspend (UDINT ut_ident);
UINT UT_resume (UDINT ut_ident);
UINT UT_sleep (UDINT tickcount);
UINT UT_sendmsg (UDINT ut_ident, void *msg, UDINT msglng, UDINT flags);
UINT UT_recmsg (UDINT *ut_ident, void **msg, UDINT *msglng, UDINT flags);
UINT UT_freemsg (UDINT msglng, void *msg);
UINT UT_exit (UDINT exitinfo);
UINT AVT_create (char *name_p, USINT grupid, UDINT av_info, UDINT *av_ident);
UINT AVT_cancel (UDINT av_ident);
UINT AVT_ident (char *name_p, USINT grupid, UDINT *av_ident);
UINT AVT_attach (UDINT av_ident, UDINT *av_info);
UINT AVT_release (UDINT av_ident);
UINT AVT_info (UDINT av_ident, USINT *av_linkcount);
UINT MEM_alloc (UDINT memlng, void **memptr);
UINT MEM_free (UDINT memlng, void *memptr);
UINT TMP_alloc (UDINT memlng, void **memptr);
UINT TMP_free (UDINT memlng, void *memptr);
UINT RTC_gettime (RTCtime_typ *rtctime);
UINT RTC_settime (RTCtime_typ *rtctime);
UINT SW_gettime (RTCtime_typ *rtctime);
UINT SW_settime (RTCtime_typ *rtctime);
UINT TIM_musec (void);
UINT TIM_ticks (void);
UINT SM_create (char *sm_name, USINT sm_count, UDINT *sm_ident);
UINT SM_ident (char *sm_name, UDINT *sm_ident);
UINT SM_delete (UDINT sm_ident);
UINT SM_attach (UDINT sm_ident, UDINT timeout, UDINT flags);
UINT SM_release (UDINT sm_ident);
UINT ERR_warning (UINT errornr, UDINT errorinfo);
UINT ERR_fatal (UINT errornr, UDINT errorinfo);
UINT ERR_read (UINT entry_nr, ERR_typ *err_p);
UINT ERRxwarning (UINT errornr, UDINT errorinfo, char* errorstring);
UINT ERRxread (UINT entry_nr, ERR_xtyp *err_p);
UINT ERRxfatal (UINT errornr, UDINT errorinfo, char* errorstring);
UINT DIS_str (UDINT row, UDINT col, char *string);
UINT DIS_chr (UDINT row, UDINT col, char character);
UINT DIS_clr (void);
UINT DA_create (char *name_p, USINT grp, UINT spooladr, UDINT data_len,
void *data_p, void **mo_data_p, UDINT *mo_ident);
UINT DA_write (UDINT mo_ident, void *data_p,UDINT data_len,
UDINT mo_data_offset);
UINT DA_read (UDINT mo_ident, void *data_p,UDINT data_len,
UDINT mo_data_offset);
UINT DA_ident (char *name_p, USINT grp, UDINT *mo_ident);
UINT DA_delete (UDINT mo_ident);
UINT DA_burn (UDINT mo_ident);
UINT DA_fix (UDINT mo_ident);
UINT DA_info (UDINT mo_ident, void **moduldata_adr, UDINT *moduldata_lng,
USINT *memorytype);
UINT DA_copy (UDINT mo_ident, char *new_name, USINT mem_typ, UDINT *da_ident,
UDINT *daten_p, UDINT *daten_len);
UINT DA_store (UDINT mo_ident, USINT mem_typ, UDINT* daten_p, UDINT* daten_len);
UINT MO_ver (STRING *pName, USINT grp, MoVerStruc_typ* pMoVerStruc);
void Bit2Byte (Bit2Byte_typ* Bit2Byte_ptr);
void Byte2Bit (Byte2Bit_typ* Byte2Bit_ptr);
#ifdef __cplusplus
};
#endif
#endif /* _SYS_LIB_H_ */

View File

@@ -0,0 +1,685 @@
/****************************************************************************/
/* */
/* sys_lib.h */
/* Declarations and Prototypes for libsys_lib.a */
/* */
/* Automation Studio */
/* Copyright Bernecker&Rainer 1998 */
/* */
/****************************************************************************/
#ifndef _SYS_LIB_H_
#define _SYS_LIB_H_
#ifdef __cplusplus
extern "C"
{
#endif
#include <bur/plctypes.h>
#include <runtime.h>
#define TMP_MODE 0x8000 /* temporary suspend/resume for */
/* PLC and user task */
/* Error codes of the BURTRAP/SYS_LIB services */
#define ERR_BUR_WRROW 2061 /* illegal row */
#define ERR_BUR_WRCOL 2062 /* illegal column */
#define ERR_BUR_WR_CHAR 2063 /* invalid ASCII character */
#define ERR_BUR_NORTC 2073 /* RTC not existing or uninitialized */
#define ERR_BUR_NOMEM 3030 /* out of memory */
#define ERR_BUR_MEMVWBUSY 3035 /* memory management busy */
#define ERR_BUR_ILLPTR 3104 /* illegal data pointer in MEM_free */
#define ERR_BUR_PSOS_BASE 3300 /* base number of pSOS errors */
#define ERR_BUR_ILLTKNR 3300 /* illegal task-class number */
#define ERR_BUR_WROFFSET 3301 /* illegal offset */
#define ERR_BUR_ILLSTATE 3302 /* illegal state of object */
#define ERR_BUR_NOMSG 3303 /* no message sent/received */
#define ERR_BUR_DUPOBJ 3305 /* object exists */
#define ERR_BUR_TIMEOUT 3304 /* timeout error */
#define ERR_BUR_EXISTS 3306 /* entry exists */
#define ERR_BUR_LCOUNT 3307 /* Linkcnt <> 0 in AVT_cancel () */
#define ERR_BUR_BURNING 3308 /* error burning module */
#define ERR_BUR_INVALIDMBX 3309 /* invalid mailbox */
#define ERR_BUR_ILLBPTR 3310 /* invalid base pointer */
#define ERR_BUR_ILLTYP 3311 /* invalid I/O type */
#define ERR_BUR_ILLEXT 3312 /* invalid ext. bit */
#define ERR_BUR_ILLVER 3313 /* invalid version */
/* e.g. BURTRAP V1.10 to SPSSW V1.05 */
#define ERR_BUR_ILLLEN 3314 /* invalid data length */
#define ERR_BUR_MAX_LCOUNT 3315 /* AVT_attach: LCOUNT > 127 */
#define ERR_BUR_AVT_FREE 3316 /* AVT_release:LCOUNT = 0 */
#define ERR_BUR_ILLPAR 3317 /* illegal parameter */
#define ERR_BUR_INSTALL 3318 /* error install datamodule */
#define ERR_BUR_WRONG_MODTYP 3319 /* wrong Moduletype */
#define ERR_BUR_OBJDEL 3320 /* object already deleted */
#define ERR_BUR_ILLOBJ 3324 /* object does not exist */
#define ERR_BUR_ILLOBJTYP 3328 /* invalid object type */
#define ERR_BUR_NOENTRY 3332 /* no entry */
#define ERR_BUR_TOOLONG_PVNAME 3333 /* too long PV name */
#define ERR_BUR_ILLIDENT 3336 /* illegal ident */
#define ERR_BUR_NOSMBUF 3560 /* no more semaphore buffers */
#define ERR_BUR_NOSM 3564 /* semaphore not available */
#define ERR_BUR_SMDEL 3568 /* semaphore deleted */
#define ERR_BUR_NOTIME 3584 /* time not available */
#define ERR_BUR_ILLDATE 3588 /* date : out of range */
#define ERR_BUR_ILLTIME 3592 /* time : out of range */
#define ERR_BUR_ILLTICKS 3596 /* ticks : out of range */
#define ERR_BUR_MEM_ALLOC 3600 /* not enough continuous memory */
#define ERR_BUR_TMP_ALLOC 3601 /* not enough continuous memory */
#define ERR_BUR_MEM_FREE 3700 /* invalid pointer/length */
#define ERR_BUR_TMP_FREE 3701 /* invalid pointer/length */
/* State for object PLC task */
#define Z_ST_created 1
#define Z_ST_running 2
#define Z_ST_blocked 3
#define Z_ST_exist 0x00
#define Z_ST_installed 0x82
#define Z_ST_PVinstalled 0x83
#define Z_ST_IOinstalled 0x84
#define Z_ST_IOdeinstalled 0x85
#define Z_ST_PVdeinstalled 0x86
#define Z_ST_delete 0x87
#define Z_ST_stdebug 0x88
#define Z_ST_tmp_suspended 0x90
/* PV data types */
#define PB_DT_STRUCT 0 /* structure */
#define PB_DT_BOOL 1 /* boolean */
#define PB_DT_INT8 2 /* integer8 */
#define PB_DT_INT16 3 /* integer16 */
#define PB_DT_INT32 4 /* integer32 */
#define PB_DT_BYTE 5 /* unsigned integer8 */
#define PB_DT_WORD 6 /* unsigned integer16 */
#define PB_DT_LONG 7 /* unsigned integer32 */
#define PB_DT_FLOAT 8 /* floating point */
#define PB_DT_VIS 9 /* visible string*/
#define PB_DT_OCTET 10 /* octet string */
#define PB_DT_DATE 11 /* date */
#define PB_DT_TIME 12 /* time of day */
#define PB_DT_DIFF 13 /* time difference */
#define PB_DT_BIT 14 /* bit string */
#define PB_DT_ARRAY 15 /* array */
/* memory types */
#define SYS_RAM 1 /* RAM */
#define USER_ROM1 2 /* EPROM */
#define FIX_RAM 5 /* fixed RAM */
typedef struct RTCtime_typ {
/* 1. UDINT */
UINT year; /* year, starting with zero */
USINT month; /* month: 1 - 12 */
USINT day; /* day: 1 - 31 */
/* 2. UDINT */
USINT reserve;
USINT hour; /* hour: 0 - 23 */
USINT minute; /* minute: 0 - 59 */
USINT second; /* second: 0 - 59 */
/* 3. UDINT */
UINT millisec; /* millisecond: 0 - 999 */
UINT microsec; /* microsecond: 0 - 999 */
} RTCtime_typ;
/* structure for SYSxinfo */
typedef struct SYSxinfo_typ {
char aws_name[6];
char aws_type[2];
UDINT cpu_info;
UINT ma_globl_len;
UINT md_globl_len;
UDINT os_len;
UDINT user_len;
UDINT tmp_len;
UDINT eprom_len;
UDINT fix_ram_len;
} SYSxinfo_typ;
/* structure for MO_list */
typedef struct MO_List_typ {
char name[14]; /* name of the module (ASCII) */
USINT grp; /* groups */
USINT type; /* module type */
USINT state; /* state of the module */
USINT reserve;
UDINT adress; /* physical address of the module */
UDINT memtype; /* memory type (0=OTP,1=RAM,2=EPROM,3=FLASH */
} MO_List_typ; /* 5=FIXRAM) */
/* structure for MO_info */
typedef struct MO_info
{
/* VAR_INPUT (analog) */
unsigned long pName;
unsigned char grp;
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned char type;
unsigned char state;
unsigned long memType;
unsigned long address;
unsigned long size;
unsigned char version[10];
struct RTCtime_typ date;
/* VAR_INPUT (digital) */
plcbit enable;
} MO_info_typ;
/* structure for PV_list */
typedef struct PV_List_typ {
char name[14]; /* name of the PV (ASCII) */
USINT tcnr; /* PV task class */
USINT grp; /* PV group */
UDINT ident; /* PV identifier */
UDINT adress; /* physical address of the PV */
} PV_List_typ;
/* structue for PV_xlist */
typedef struct PV_xList_typ {
char name[33]; /* name of PV (ASCII) */
USINT data_typ; /* data type of PV */
UDINT data_len; /* data length of PV */
UDINT dimension; /* dimension of PV */
UDINT adress; /* physical address of PV */
}PV_xList_typ;
/* structure for ERR_read */
typedef struct ERR_typ {
UINT err_nr; /* error number */
UDINT err_info; /* additional information */
char t_name[5]; /* name of the running task */
USINT err_type; /* error type (1=fatal, 2=warning, 3=info) */
UINT err_year; /* time of the error in RTC format */
USINT err_month;
USINT err_day;
USINT err_reserve;
USINT err_hour;
USINT err_minute;
USINT err_second;
UINT err_millisec;
UINT err_microsec;
} ERR_typ;
/* structure for ERR_xread */
typedef struct ERR_xtyp {
UINT err_nr; /* error number */
UDINT err_info; /* additional information */
char t_name[5]; /* name of the running task */
USINT err_type; /* error type (1=Fatal, 2=Warning, 3=Info) */
UINT err_year; /* time of the error in RTC format */
USINT err_month;
USINT err_day;
USINT err_reserve;
USINT err_hour;
USINT err_minute;
USINT err_second;
UINT err_millisec;
UINT err_microsec;
USINT err_string[34]; /* 32 byte string with 0 termination */
} ERR_xtyp;
/* structure for MO_ver */
typedef struct MoVerStruc_typ {
USINT version[10]; /* Version of the BR Module */
UINT year;
USINT month;
USINT day;
USINT reserve;
USINT hour;
USINT minute;
USINT second;
} MoVerStruc_typ;
/* structure for the FUB Bit2Byte */
typedef struct Bit2Byte {
/* non boolean input parameter */
UDINT bitadr;
UINT length;
/* non boolean output parameter*/
UDINT byteadr;
/* non boolean static local */
USINT byte_00;
USINT byte_01;
USINT byte_02;
USINT byte_03;
USINT byte_04;
USINT byte_05;
USINT byte_06;
USINT byte_07;
USINT byte_08;
USINT byte_09;
USINT byte_10;
USINT byte_11;
USINT byte_12;
USINT byte_13;
USINT byte_14;
USINT byte_15;
/* boolean input parameter */
/* boolean output parameter */
/* boolean static local */
BOOL bmem000;
BOOL bmem001;
BOOL bmem002;
BOOL bmem003;
BOOL bmem004;
BOOL bmem005;
BOOL bmem006;
BOOL bmem007;
BOOL bmem008;
BOOL bmem009;
BOOL bmem010;
BOOL bmem011;
BOOL bmem012;
BOOL bmem013;
BOOL bmem014;
BOOL bmem015;
BOOL bmem016;
BOOL bmem017;
BOOL bmem018;
BOOL bmem019;
BOOL bmem020;
BOOL bmem021;
BOOL bmem022;
BOOL bmem023;
BOOL bmem024;
BOOL bmem025;
BOOL bmem026;
BOOL bmem027;
BOOL bmem028;
BOOL bmem029;
BOOL bmem030;
BOOL bmem031;
BOOL bmem032;
BOOL bmem033;
BOOL bmem034;
BOOL bmem035;
BOOL bmem036;
BOOL bmem037;
BOOL bmem038;
BOOL bmem039;
BOOL bmem040;
BOOL bmem041;
BOOL bmem042;
BOOL bmem043;
BOOL bmem044;
BOOL bmem045;
BOOL bmem046;
BOOL bmem047;
BOOL bmem048;
BOOL bmem049;
BOOL bmem050;
BOOL bmem051;
BOOL bmem052;
BOOL bmem053;
BOOL bmem054;
BOOL bmem055;
BOOL bmem056;
BOOL bmem057;
BOOL bmem058;
BOOL bmem059;
BOOL bmem060;
BOOL bmem061;
BOOL bmem062;
BOOL bmem063;
BOOL bmem064;
BOOL bmem065;
BOOL bmem066;
BOOL bmem067;
BOOL bmem068;
BOOL bmem069;
BOOL bmem070;
BOOL bmem071;
BOOL bmem072;
BOOL bmem073;
BOOL bmem074;
BOOL bmem075;
BOOL bmem076;
BOOL bmem077;
BOOL bmem078;
BOOL bmem079;
BOOL bmem080;
BOOL bmem081;
BOOL bmem082;
BOOL bmem083;
BOOL bmem084;
BOOL bmem085;
BOOL bmem086;
BOOL bmem087;
BOOL bmem088;
BOOL bmem089;
BOOL bmem090;
BOOL bmem091;
BOOL bmem092;
BOOL bmem093;
BOOL bmem094;
BOOL bmem095;
BOOL bmem096;
BOOL bmem097;
BOOL bmem098;
BOOL bmem099;
BOOL bmem100;
BOOL bmem101;
BOOL bmem102;
BOOL bmem103;
BOOL bmem104;
BOOL bmem105;
BOOL bmem106;
BOOL bmem107;
BOOL bmem108;
BOOL bmem109;
BOOL bmem110;
BOOL bmem111;
BOOL bmem112;
BOOL bmem113;
BOOL bmem114;
BOOL bmem115;
BOOL bmem116;
BOOL bmem117;
BOOL bmem118;
BOOL bmem119;
BOOL bmem120;
BOOL bmem121;
BOOL bmem122;
BOOL bmem123;
BOOL bmem124;
BOOL bmem125;
BOOL bmem126;
BOOL bmem127;
BOOL bmem128;
BOOL bmem129;
BOOL bmem130;
BOOL bmem131;
BOOL bmem132;
BOOL bmem133;
BOOL bmem134;
BOOL bmem135;
BOOL bmem136;
BOOL bmem137;
BOOL bmem138;
BOOL bmem139;
} Bit2Byte_typ;
/* structure for the FUB Byte2Bit */
typedef struct Byte2Bit {
/* non boolean input parameter */
UDINT byteadr;
UINT length;
/* non boolean output parameter*/
UDINT bitadr;
/* non boolean static local */
/* boolean input parameter */
/* boolean output parameter */
/* boolean static local */
BOOL bmem000;
BOOL bmem001;
BOOL bmem002;
BOOL bmem003;
BOOL bmem004;
BOOL bmem005;
BOOL bmem006;
BOOL bmem007;
BOOL bmem008;
BOOL bmem009;
BOOL bmem010;
BOOL bmem011;
BOOL bmem012;
BOOL bmem013;
BOOL bmem014;
BOOL bmem015;
BOOL bmem016;
BOOL bmem017;
BOOL bmem018;
BOOL bmem019;
BOOL bmem020;
BOOL bmem021;
BOOL bmem022;
BOOL bmem023;
BOOL bmem024;
BOOL bmem025;
BOOL bmem026;
BOOL bmem027;
BOOL bmem028;
BOOL bmem029;
BOOL bmem030;
BOOL bmem031;
BOOL bmem032;
BOOL bmem033;
BOOL bmem034;
BOOL bmem035;
BOOL bmem036;
BOOL bmem037;
BOOL bmem038;
BOOL bmem039;
BOOL bmem040;
BOOL bmem041;
BOOL bmem042;
BOOL bmem043;
BOOL bmem044;
BOOL bmem045;
BOOL bmem046;
BOOL bmem047;
BOOL bmem048;
BOOL bmem049;
BOOL bmem050;
BOOL bmem051;
BOOL bmem052;
BOOL bmem053;
BOOL bmem054;
BOOL bmem055;
BOOL bmem056;
BOOL bmem057;
BOOL bmem058;
BOOL bmem059;
BOOL bmem060;
BOOL bmem061;
BOOL bmem062;
BOOL bmem063;
BOOL bmem064;
BOOL bmem065;
BOOL bmem066;
BOOL bmem067;
BOOL bmem068;
BOOL bmem069;
BOOL bmem070;
BOOL bmem071;
BOOL bmem072;
BOOL bmem073;
BOOL bmem074;
BOOL bmem075;
BOOL bmem076;
BOOL bmem077;
BOOL bmem078;
BOOL bmem079;
BOOL bmem080;
BOOL bmem081;
BOOL bmem082;
BOOL bmem083;
BOOL bmem084;
BOOL bmem085;
BOOL bmem086;
BOOL bmem087;
BOOL bmem088;
BOOL bmem089;
BOOL bmem090;
BOOL bmem091;
BOOL bmem092;
BOOL bmem093;
BOOL bmem094;
BOOL bmem095;
BOOL bmem096;
BOOL bmem097;
BOOL bmem098;
BOOL bmem099;
BOOL bmem100;
BOOL bmem101;
BOOL bmem102;
BOOL bmem103;
BOOL bmem104;
BOOL bmem105;
BOOL bmem106;
BOOL bmem107;
BOOL bmem108;
BOOL bmem109;
BOOL bmem110;
BOOL bmem111;
BOOL bmem112;
BOOL bmem113;
BOOL bmem114;
BOOL bmem115;
BOOL bmem116;
BOOL bmem117;
BOOL bmem118;
BOOL bmem119;
BOOL bmem120;
BOOL bmem121;
BOOL bmem122;
BOOL bmem123;
BOOL bmem124;
BOOL bmem125;
BOOL bmem126;
BOOL bmem127;
BOOL bmem128;
BOOL bmem129;
BOOL bmem130;
BOOL bmem131;
BOOL bmem132;
BOOL bmem133;
BOOL bmem134;
BOOL bmem135;
BOOL bmem136;
BOOL bmem137;
BOOL bmem138;
BOOL bmem139;
} Byte2Bit_typ;
/***************/
/* Prototyping */
/***************/
UINT PV_ident (char *pv_name_p, USINT pv_tcnr, USINT pv_grpnr,
UDINT *pv_ident);
UINT PV_setval (UDINT pv_ident, UDINT value);
UINT PV_getval (UDINT pv_ident, UDINT *value);
UINT PV_getadr (char *pv_name_p, USINT pv_tcnr, USINT pv_grpnr,
UDINT *pv_adresse);
UINT PV_xgetadr (char *pv_name, UDINT *pv_adresse, UDINT *data_len);
UINT PV_xsetval (UDINT pv_ident, UINT subindex, void *data_p,
USINT data_len);
UINT PV_xgetval (UDINT pv_ident, UINT subindex, void *data_p,
USINT data_len);
UINT PV_info (UDINT pv_ident, UDINT *data_type, UDINT *data_len,
UINT *dimension);
UINT PV_list (UINT prev_index, UINT *index, PV_List_typ *pvl_p);
UINT PV_xlist (UINT prev_index, UINT *index, PV_xList_typ *pvl_p);
UINT PV_item (char *pv_name, UINT index, char *itemname);
UINT PV_ninfo (char *pv_name, UDINT *data_typ_p, UDINT *data_len_p,
UINT *dimension_p);
UINT SYS_info (UDINT *sg_init_cnt, UDINT *sg_initdescr, UDINT *sg_tickcnt,
UDINT *sg_version, UDINT *sg_ov_version);
UINT SYSxinfo (SYSxinfo_typ *sx_p);
UINT SYSreset (BOOL enable, USINT mode);
USINT SYS_battery (void);
UINT MO_list (UINT prev_index, UINT *index, MO_List_typ *mol_p);
void MO_info (struct MO_info* pInst);
UINT KEY_enadis (BOOL mode);
UINT KEY_read (USINT keys[4]);
UINT FORCE_info (USINT tcnr, BOOL *force);
UINT ST_ident (char *st_name_p, USINT st_grp, UDINT *st_ident);
UINT ST_suspend (UDINT st_ident);
UINT ST_resume (UDINT st_ident);
UINT ST_tmp_suspend (UDINT st_ident);
UINT ST_tmp_resume (UDINT st_ident);
UINT ST_allsuspend (void);
UINT ST_info (UDINT st_ident, USINT *state, SINT *tcnr);
UINT ST_name (UDINT st_ident, char *st_name_p, USINT *st_grp);
UINT UT_ident (char *ut_name_p, USINT ut_grp, USINT ut_proc, char *ut_sps_p,UDINT *ut_ident);
UINT UT_suspend (UDINT ut_ident);
UINT UT_resume (UDINT ut_ident);
UINT UT_sleep (UDINT tickcount);
UINT UT_sendmsg (UDINT ut_ident, void *msg, UDINT msglng, UDINT flags);
UINT UT_recmsg (UDINT *ut_ident, void **msg, UDINT *msglng, UDINT flags);
UINT UT_freemsg (UDINT msglng, void *msg);
UINT UT_exit (UDINT exitinfo);
UINT AVT_create (char *name_p, USINT grupid, UDINT av_info, UDINT *av_ident);
UINT AVT_cancel (UDINT av_ident);
UINT AVT_ident (char *name_p, USINT grupid, UDINT *av_ident);
UINT AVT_attach (UDINT av_ident, UDINT *av_info);
UINT AVT_release (UDINT av_ident);
UINT AVT_info (UDINT av_ident, USINT *av_linkcount);
UINT MEM_alloc (UDINT memlng, void **memptr);
UINT MEM_free (UDINT memlng, void *memptr);
UINT TMP_alloc (UDINT memlng, void **memptr);
UINT TMP_free (UDINT memlng, void *memptr);
UINT RTC_gettime (RTCtime_typ *rtctime);
UINT RTC_settime (RTCtime_typ *rtctime);
UINT SW_gettime (RTCtime_typ *rtctime);
UINT SW_settime (RTCtime_typ *rtctime);
UINT TIM_musec (void);
UINT TIM_ticks (void);
UINT SM_create (char *sm_name, USINT sm_count, UDINT *sm_ident);
UINT SM_ident (char *sm_name, UDINT *sm_ident);
UINT SM_delete (UDINT sm_ident);
UINT SM_attach (UDINT sm_ident, UDINT timeout, UDINT flags);
UINT SM_release (UDINT sm_ident);
UINT ERR_warning (UINT errornr, UDINT errorinfo);
UINT ERR_fatal (UINT errornr, UDINT errorinfo);
UINT ERR_read (UINT entry_nr, ERR_typ *err_p);
UINT ERRxwarning (UINT errornr, UDINT errorinfo, char* errorstring);
UINT ERRxread (UINT entry_nr, ERR_xtyp *err_p);
UINT ERRxfatal (UINT errornr, UDINT errorinfo, char* errorstring);
UINT DIS_str (UDINT row, UDINT col, char *string);
UINT DIS_chr (UDINT row, UDINT col, char character);
UINT DIS_clr (void);
UINT DA_create (char *name_p, USINT grp, UINT spooladr, UDINT data_len,
void *data_p, void **mo_data_p, UDINT *mo_ident);
UINT DA_write (UDINT mo_ident, void *data_p,UDINT data_len,
UDINT mo_data_offset);
UINT DA_read (UDINT mo_ident, void *data_p,UDINT data_len,
UDINT mo_data_offset);
UINT DA_ident (char *name_p, USINT grp, UDINT *mo_ident);
UINT DA_delete (UDINT mo_ident);
UINT DA_burn (UDINT mo_ident);
UINT DA_fix (UDINT mo_ident);
UINT DA_info (UDINT mo_ident, void **moduldata_adr, UDINT *moduldata_lng,
USINT *memorytype);
UINT DA_copy (UDINT mo_ident, char *new_name, USINT mem_typ, UDINT *da_ident,
UDINT *daten_p, UDINT *daten_len);
UINT DA_store (UDINT mo_ident, USINT mem_typ, UDINT* daten_p, UDINT* daten_len);
UINT MO_ver (STRING *pName, USINT grp, MoVerStruc_typ* pMoVerStruc);
void Bit2Byte (Bit2Byte_typ* Bit2Byte_ptr);
void Byte2Bit (Byte2Bit_typ* Byte2Bit_ptr);
#ifdef __cplusplus
};
#endif
#endif /* _SYS_LIB_H_ */

View File

@@ -0,0 +1,683 @@
/****************************************************************************/
/* */
/* sys_lib.h */
/* Declarations and Prototypes for libsys_lib.a */
/* */
/* Automation Studio */
/* Copyright Bernecker&Rainer 1998 */
/* */
/****************************************************************************/
#ifndef _SYS_LIB_H_
#define _SYS_LIB_H_
#ifdef __cplusplus
extern "C"
{
#endif
#include <bur/plctypes.h>
#include <runtime.h>
#define TMP_MODE 0x8000 /* temporary suspend/resume for */
/* PLC and user task */
/* Error codes of the BURTRAP/SYS_LIB services */
#define ERR_BUR_WRROW 2061 /* illegal row */
#define ERR_BUR_WRCOL 2062 /* illegal column */
#define ERR_BUR_WR_CHAR 2063 /* invalid ASCII character */
#define ERR_BUR_NORTC 2073 /* RTC not existing or uninitialized */
#define ERR_BUR_NOMEM 3030 /* out of memory */
#define ERR_BUR_MEMVWBUSY 3035 /* memory management busy */
#define ERR_BUR_ILLPTR 3104 /* illegal data pointer in MEM_free */
#define ERR_BUR_PSOS_BASE 3300 /* base number of pSOS errors */
#define ERR_BUR_ILLTKNR 3300 /* illegal task-class number */
#define ERR_BUR_WROFFSET 3301 /* illegal offset */
#define ERR_BUR_ILLSTATE 3302 /* illegal state of object */
#define ERR_BUR_NOMSG 3303 /* no message sent/received */
#define ERR_BUR_DUPOBJ 3305 /* object exists */
#define ERR_BUR_TIMEOUT 3304 /* timeout error */
#define ERR_BUR_EXISTS 3306 /* entry exists */
#define ERR_BUR_LCOUNT 3307 /* Linkcnt <> 0 in AVT_cancel () */
#define ERR_BUR_BURNING 3308 /* error burning module */
#define ERR_BUR_INVALIDMBX 3309 /* invalid mailbox */
#define ERR_BUR_ILLBPTR 3310 /* invalid base pointer */
#define ERR_BUR_ILLTYP 3311 /* invalid I/O type */
#define ERR_BUR_ILLEXT 3312 /* invalid ext. bit */
#define ERR_BUR_ILLVER 3313 /* invalid version */
/* e.g. BURTRAP V1.10 to SPSSW V1.05 */
#define ERR_BUR_ILLLEN 3314 /* invalid data length */
#define ERR_BUR_MAX_LCOUNT 3315 /* AVT_attach: LCOUNT > 127 */
#define ERR_BUR_AVT_FREE 3316 /* AVT_release:LCOUNT = 0 */
#define ERR_BUR_ILLPAR 3317 /* illegal parameter */
#define ERR_BUR_INSTALL 3318 /* error install datamodule */
#define ERR_BUR_WRONG_MODTYP 3319 /* wrong Moduletype */
#define ERR_BUR_OBJDEL 3320 /* object already deleted */
#define ERR_BUR_ILLOBJ 3324 /* object does not exist */
#define ERR_BUR_ILLOBJTYP 3328 /* invalid object type */
#define ERR_BUR_NOENTRY 3332 /* no entry */
#define ERR_BUR_TOOLONG_PVNAME 3333 /* too long PV name */
#define ERR_BUR_ILLIDENT 3336 /* illegal ident */
#define ERR_BUR_NOSMBUF 3560 /* no more semaphore buffers */
#define ERR_BUR_NOSM 3564 /* semaphore not available */
#define ERR_BUR_SMDEL 3568 /* semaphore deleted */
#define ERR_BUR_NOTIME 3584 /* time not available */
#define ERR_BUR_ILLDATE 3588 /* date : out of range */
#define ERR_BUR_ILLTIME 3592 /* time : out of range */
#define ERR_BUR_ILLTICKS 3596 /* ticks : out of range */
#define ERR_BUR_MEM_ALLOC 3600 /* not enough continuous memory */
#define ERR_BUR_TMP_ALLOC 3601 /* not enough continuous memory */
#define ERR_BUR_MEM_FREE 3700 /* invalid pointer/length */
#define ERR_BUR_TMP_FREE 3701 /* invalid pointer/length */
/* State for object PLC task */
#define Z_ST_created 1
#define Z_ST_running 2
#define Z_ST_blocked 3
#define Z_ST_exist 0x00
#define Z_ST_installed 0x82
#define Z_ST_PVinstalled 0x83
#define Z_ST_IOinstalled 0x84
#define Z_ST_IOdeinstalled 0x85
#define Z_ST_PVdeinstalled 0x86
#define Z_ST_delete 0x87
#define Z_ST_stdebug 0x88
#define Z_ST_tmp_suspended 0x90
/* PV data types */
#define PB_DT_STRUCT 0 /* structure */
#define PB_DT_BOOL 1 /* boolean */
#define PB_DT_INT8 2 /* integer8 */
#define PB_DT_INT16 3 /* integer16 */
#define PB_DT_INT32 4 /* integer32 */
#define PB_DT_BYTE 5 /* unsigned integer8 */
#define PB_DT_WORD 6 /* unsigned integer16 */
#define PB_DT_LONG 7 /* unsigned integer32 */
#define PB_DT_FLOAT 8 /* floating point */
#define PB_DT_VIS 9 /* visible string*/
#define PB_DT_OCTET 10 /* octet string */
#define PB_DT_DATE 11 /* date */
#define PB_DT_TIME 12 /* time of day */
#define PB_DT_DIFF 13 /* time difference */
#define PB_DT_BIT 14 /* bit string */
#define PB_DT_ARRAY 15 /* array */
/* memory types */
#define SYS_RAM 1 /* RAM */
#define USER_ROM1 2 /* EPROM */
#define FIX_RAM 5 /* fixed RAM */
typedef struct RTCtime_typ {
/* 1. UDINT */
UINT year; /* year, starting with zero */
USINT month; /* month: 1 - 12 */
USINT day; /* day: 1 - 31 */
/* 2. UDINT */
USINT reserve;
USINT hour; /* hour: 0 - 23 */
USINT minute; /* minute: 0 - 59 */
USINT second; /* second: 0 - 59 */
/* 3. UDINT */
UINT millisec; /* millisecond: 0 - 999 */
UINT microsec; /* microsecond: 0 - 999 */
} RTCtime_typ;
/* structure for SYSxinfo */
typedef struct SYSxinfo_typ {
char aws_name[6];
char aws_type[2];
UDINT cpu_info;
UINT ma_globl_len;
UINT md_globl_len;
UDINT os_len;
UDINT user_len;
UDINT tmp_len;
UDINT eprom_len;
UDINT fix_ram_len;
} SYSxinfo_typ;
/* structure for MO_list */
typedef struct MO_List_typ {
char name[14]; /* name of the module (ASCII) */
USINT grp; /* groups */
USINT type; /* module type */
USINT state; /* state of the module */
USINT reserve;
UDINT adress; /* physical address of the module */
UDINT memtype; /* memory type (0=OTP,1=RAM,2=EPROM,3=FLASH */
} MO_List_typ; /* 5=FIXRAM) */
/* structure for MO_info */
typedef struct MO_info
{
/* VAR_INPUT (analog) */
unsigned long pName;
unsigned char grp;
/* VAR_OUTPUT (analog) */
unsigned short status;
unsigned char type;
unsigned char state;
unsigned long memType;
unsigned long address;
unsigned long size;
unsigned char version[10];
struct RTCtime_typ date;
/* VAR_INPUT (digital) */
plcbit enable;
} MO_info_typ;
/* structure for PV_list */
typedef struct PV_List_typ {
char name[14]; /* name of the PV (ASCII) */
USINT tcnr; /* PV task class */
USINT grp; /* PV group */
UDINT ident; /* PV identifier */
UDINT adress; /* physical address of the PV */
} PV_List_typ;
/* structue for PV_xlist */
typedef struct PV_xList_typ {
char name[33]; /* name of PV (ASCII) */
USINT data_typ; /* data type of PV */
UDINT data_len; /* data length of PV */
UDINT dimension; /* dimension of PV */
UDINT adress; /* physical address of PV */
}PV_xList_typ;
/* structure for ERR_read */
typedef struct ERR_typ {
UINT err_nr; /* error number */
UDINT err_info; /* additional information */
char t_name[5]; /* name of the running task */
USINT err_type; /* error type (1=fatal, 2=warning, 3=info) */
UINT err_year; /* time of the error in RTC format */
USINT err_month;
USINT err_day;
USINT err_reserve;
USINT err_hour;
USINT err_minute;
USINT err_second;
UINT err_millisec;
UINT err_microsec;
} ERR_typ;
/* structure for ERR_xread */
typedef struct ERR_xtyp {
UINT err_nr; /* error number */
UDINT err_info; /* additional information */
char t_name[5]; /* name of the running task */
USINT err_type; /* error type (1=Fatal, 2=Warning, 3=Info) */
UINT err_year; /* time of the error in RTC format */
USINT err_month;
USINT err_day;
USINT err_reserve;
USINT err_hour;
USINT err_minute;
USINT err_second;
UINT err_millisec;
UINT err_microsec;
USINT err_string[34]; /* 32 byte string with 0 termination */
} ERR_xtyp;
/* structure for MO_ver */
typedef struct MoVerStruc_typ {
USINT version[10]; /* Version of the BR Module */
UINT year;
USINT month;
USINT day;
USINT reserve;
USINT hour;
USINT minute;
USINT second;
} MoVerStruc_typ;
/* structure for the FUB Bit2Byte */
typedef struct Bit2Byte {
/* non boolean input parameter */
UDINT bitadr;
UINT length;
/* non boolean output parameter*/
UDINT byteadr;
/* non boolean static local */
USINT byte_00;
USINT byte_01;
USINT byte_02;
USINT byte_03;
USINT byte_04;
USINT byte_05;
USINT byte_06;
USINT byte_07;
USINT byte_08;
USINT byte_09;
USINT byte_10;
USINT byte_11;
USINT byte_12;
USINT byte_13;
USINT byte_14;
USINT byte_15;
/* boolean input parameter */
/* boolean output parameter */
/* boolean static local */
BOOL bmem000;
BOOL bmem001;
BOOL bmem002;
BOOL bmem003;
BOOL bmem004;
BOOL bmem005;
BOOL bmem006;
BOOL bmem007;
BOOL bmem008;
BOOL bmem009;
BOOL bmem010;
BOOL bmem011;
BOOL bmem012;
BOOL bmem013;
BOOL bmem014;
BOOL bmem015;
BOOL bmem016;
BOOL bmem017;
BOOL bmem018;
BOOL bmem019;
BOOL bmem020;
BOOL bmem021;
BOOL bmem022;
BOOL bmem023;
BOOL bmem024;
BOOL bmem025;
BOOL bmem026;
BOOL bmem027;
BOOL bmem028;
BOOL bmem029;
BOOL bmem030;
BOOL bmem031;
BOOL bmem032;
BOOL bmem033;
BOOL bmem034;
BOOL bmem035;
BOOL bmem036;
BOOL bmem037;
BOOL bmem038;
BOOL bmem039;
BOOL bmem040;
BOOL bmem041;
BOOL bmem042;
BOOL bmem043;
BOOL bmem044;
BOOL bmem045;
BOOL bmem046;
BOOL bmem047;
BOOL bmem048;
BOOL bmem049;
BOOL bmem050;
BOOL bmem051;
BOOL bmem052;
BOOL bmem053;
BOOL bmem054;
BOOL bmem055;
BOOL bmem056;
BOOL bmem057;
BOOL bmem058;
BOOL bmem059;
BOOL bmem060;
BOOL bmem061;
BOOL bmem062;
BOOL bmem063;
BOOL bmem064;
BOOL bmem065;
BOOL bmem066;
BOOL bmem067;
BOOL bmem068;
BOOL bmem069;
BOOL bmem070;
BOOL bmem071;
BOOL bmem072;
BOOL bmem073;
BOOL bmem074;
BOOL bmem075;
BOOL bmem076;
BOOL bmem077;
BOOL bmem078;
BOOL bmem079;
BOOL bmem080;
BOOL bmem081;
BOOL bmem082;
BOOL bmem083;
BOOL bmem084;
BOOL bmem085;
BOOL bmem086;
BOOL bmem087;
BOOL bmem088;
BOOL bmem089;
BOOL bmem090;
BOOL bmem091;
BOOL bmem092;
BOOL bmem093;
BOOL bmem094;
BOOL bmem095;
BOOL bmem096;
BOOL bmem097;
BOOL bmem098;
BOOL bmem099;
BOOL bmem100;
BOOL bmem101;
BOOL bmem102;
BOOL bmem103;
BOOL bmem104;
BOOL bmem105;
BOOL bmem106;
BOOL bmem107;
BOOL bmem108;
BOOL bmem109;
BOOL bmem110;
BOOL bmem111;
BOOL bmem112;
BOOL bmem113;
BOOL bmem114;
BOOL bmem115;
BOOL bmem116;
BOOL bmem117;
BOOL bmem118;
BOOL bmem119;
BOOL bmem120;
BOOL bmem121;
BOOL bmem122;
BOOL bmem123;
BOOL bmem124;
BOOL bmem125;
BOOL bmem126;
BOOL bmem127;
BOOL bmem128;
BOOL bmem129;
BOOL bmem130;
BOOL bmem131;
BOOL bmem132;
BOOL bmem133;
BOOL bmem134;
BOOL bmem135;
BOOL bmem136;
BOOL bmem137;
BOOL bmem138;
BOOL bmem139;
} Bit2Byte_typ;
/* structure for the FUB Byte2Bit */
typedef struct Byte2Bit {
/* non boolean input parameter */
UDINT byteadr;
UINT length;
/* non boolean output parameter*/
UDINT bitadr;
/* non boolean static local */
/* boolean input parameter */
/* boolean output parameter */
/* boolean static local */
BOOL bmem000;
BOOL bmem001;
BOOL bmem002;
BOOL bmem003;
BOOL bmem004;
BOOL bmem005;
BOOL bmem006;
BOOL bmem007;
BOOL bmem008;
BOOL bmem009;
BOOL bmem010;
BOOL bmem011;
BOOL bmem012;
BOOL bmem013;
BOOL bmem014;
BOOL bmem015;
BOOL bmem016;
BOOL bmem017;
BOOL bmem018;
BOOL bmem019;
BOOL bmem020;
BOOL bmem021;
BOOL bmem022;
BOOL bmem023;
BOOL bmem024;
BOOL bmem025;
BOOL bmem026;
BOOL bmem027;
BOOL bmem028;
BOOL bmem029;
BOOL bmem030;
BOOL bmem031;
BOOL bmem032;
BOOL bmem033;
BOOL bmem034;
BOOL bmem035;
BOOL bmem036;
BOOL bmem037;
BOOL bmem038;
BOOL bmem039;
BOOL bmem040;
BOOL bmem041;
BOOL bmem042;
BOOL bmem043;
BOOL bmem044;
BOOL bmem045;
BOOL bmem046;
BOOL bmem047;
BOOL bmem048;
BOOL bmem049;
BOOL bmem050;
BOOL bmem051;
BOOL bmem052;
BOOL bmem053;
BOOL bmem054;
BOOL bmem055;
BOOL bmem056;
BOOL bmem057;
BOOL bmem058;
BOOL bmem059;
BOOL bmem060;
BOOL bmem061;
BOOL bmem062;
BOOL bmem063;
BOOL bmem064;
BOOL bmem065;
BOOL bmem066;
BOOL bmem067;
BOOL bmem068;
BOOL bmem069;
BOOL bmem070;
BOOL bmem071;
BOOL bmem072;
BOOL bmem073;
BOOL bmem074;
BOOL bmem075;
BOOL bmem076;
BOOL bmem077;
BOOL bmem078;
BOOL bmem079;
BOOL bmem080;
BOOL bmem081;
BOOL bmem082;
BOOL bmem083;
BOOL bmem084;
BOOL bmem085;
BOOL bmem086;
BOOL bmem087;
BOOL bmem088;
BOOL bmem089;
BOOL bmem090;
BOOL bmem091;
BOOL bmem092;
BOOL bmem093;
BOOL bmem094;
BOOL bmem095;
BOOL bmem096;
BOOL bmem097;
BOOL bmem098;
BOOL bmem099;
BOOL bmem100;
BOOL bmem101;
BOOL bmem102;
BOOL bmem103;
BOOL bmem104;
BOOL bmem105;
BOOL bmem106;
BOOL bmem107;
BOOL bmem108;
BOOL bmem109;
BOOL bmem110;
BOOL bmem111;
BOOL bmem112;
BOOL bmem113;
BOOL bmem114;
BOOL bmem115;
BOOL bmem116;
BOOL bmem117;
BOOL bmem118;
BOOL bmem119;
BOOL bmem120;
BOOL bmem121;
BOOL bmem122;
BOOL bmem123;
BOOL bmem124;
BOOL bmem125;
BOOL bmem126;
BOOL bmem127;
BOOL bmem128;
BOOL bmem129;
BOOL bmem130;
BOOL bmem131;
BOOL bmem132;
BOOL bmem133;
BOOL bmem134;
BOOL bmem135;
BOOL bmem136;
BOOL bmem137;
BOOL bmem138;
BOOL bmem139;
} Byte2Bit_typ;
/***************/
/* Prototyping */
/***************/
UINT PV_ident (char *pv_name_p, USINT pv_tcnr, USINT pv_grpnr,
UDINT *pv_ident);
UINT PV_setval (UDINT pv_ident, UDINT value);
UINT PV_getval (UDINT pv_ident, UDINT *value);
UINT PV_getadr (char *pv_name_p, USINT pv_tcnr, USINT pv_grpnr,
UDINT *pv_adresse);
UINT PV_xgetadr (char *pv_name, UDINT *pv_adresse, UDINT *data_len);
UINT PV_xsetval (UDINT pv_ident, UINT subindex, void *data_p,
USINT data_len);
UINT PV_xgetval (UDINT pv_ident, UINT subindex, void *data_p,
USINT data_len);
UINT PV_info (UDINT pv_ident, UDINT *data_type, UDINT *data_len,
UINT *dimension);
UINT PV_list (UINT prev_index, UINT *index, PV_List_typ *pvl_p);
UINT PV_xlist (UINT prev_index, UINT *index, PV_xList_typ *pvl_p);
UINT PV_item (char *pv_name, UINT index, char *itemname);
UINT PV_ninfo (char *pv_name, UDINT *data_typ_p, UDINT *data_len_p,
UINT *dimension_p);
UINT SYS_info (UDINT *sg_init_cnt, UDINT *sg_initdescr, UDINT *sg_tickcnt,
UDINT *sg_version, UDINT *sg_ov_version);
UINT SYSxinfo (SYSxinfo_typ *sx_p);
UINT SYSreset (BOOL enable, USINT mode);
USINT SYS_battery (void);
UINT MO_list (UINT prev_index, UINT *index, MO_List_typ *mol_p);
void MO_info (struct MO_info* pInst);
UINT KEY_enadis (BOOL mode);
UINT KEY_read (USINT keys[4]);
UINT FORCE_info (USINT tcnr, BOOL *force);
UINT ST_ident (char *st_name_p, USINT st_grp, UDINT *st_ident);
UINT ST_suspend (UDINT st_ident);
UINT ST_resume (UDINT st_ident);
UINT ST_tmp_suspend (UDINT st_ident);
UINT ST_tmp_resume (UDINT st_ident);
UINT ST_allsuspend (void);
UINT ST_info (UDINT st_ident, USINT *state, SINT *tcnr);
UINT ST_name (UDINT st_ident, char *st_name_p, USINT *st_grp);
UINT UT_ident (char *ut_name_p, USINT ut_grp, USINT ut_proc, char *ut_sps_p,UDINT *ut_ident);
UINT UT_suspend (UDINT ut_ident);
UINT UT_resume (UDINT ut_ident);
UINT UT_sleep (UDINT tickcount);
UINT UT_sendmsg (UDINT ut_ident, void *msg, UDINT msglng, UDINT flags);
UINT UT_recmsg (UDINT *ut_ident, void **msg, UDINT *msglng, UDINT flags);
UINT UT_freemsg (UDINT msglng, void *msg);
UINT UT_exit (UDINT exitinfo);
UINT AVT_create (char *name_p, USINT grupid, UDINT av_info, UDINT *av_ident);
UINT AVT_cancel (UDINT av_ident);
UINT AVT_ident (char *name_p, USINT grupid, UDINT *av_ident);
UINT AVT_attach (UDINT av_ident, UDINT *av_info);
UINT AVT_release (UDINT av_ident);
UINT AVT_info (UDINT av_ident, USINT *av_linkcount);
UINT MEM_alloc (UDINT memlng, void **memptr);
UINT MEM_free (UDINT memlng, void *memptr);
UINT TMP_alloc (UDINT memlng, void **memptr);
UINT TMP_free (UDINT memlng, void *memptr);
UINT RTC_gettime (RTCtime_typ *rtctime);
UINT RTC_settime (RTCtime_typ *rtctime);
UINT SW_gettime (RTCtime_typ *rtctime);
UINT SW_settime (RTCtime_typ *rtctime);
UINT TIM_musec (void);
UINT TIM_ticks (void);
UINT SM_create (char *sm_name, USINT sm_count, UDINT *sm_ident);
UINT SM_ident (char *sm_name, UDINT *sm_ident);
UINT SM_delete (UDINT sm_ident);
UINT SM_attach (UDINT sm_ident, UDINT timeout, UDINT flags);
UINT SM_release (UDINT sm_ident);
UINT ERR_warning (UINT errornr, UDINT errorinfo);
UINT ERR_fatal (UINT errornr, UDINT errorinfo);
UINT ERR_read (UINT entry_nr, ERR_typ *err_p);
UINT ERRxwarning (UINT errornr, UDINT errorinfo, char* errorstring);
UINT ERRxread (UINT entry_nr, ERR_xtyp *err_p);
UINT ERRxfatal (UINT errornr, UDINT errorinfo, char* errorstring);
UINT DIS_str (UDINT row, UDINT col, char *string);
UINT DIS_chr (UDINT row, UDINT col, char character);
UINT DIS_clr (void);
UINT DA_create (char *name_p, USINT grp, UINT spooladr, UDINT data_len,
void *data_p, void **mo_data_p, UDINT *mo_ident);
UINT DA_write (UDINT mo_ident, void *data_p,UDINT data_len,
UDINT mo_data_offset);
UINT DA_read (UDINT mo_ident, void *data_p,UDINT data_len,
UDINT mo_data_offset);
UINT DA_ident (char *name_p, USINT grp, UDINT *mo_ident);
UINT DA_delete (UDINT mo_ident);
UINT DA_burn (UDINT mo_ident);
UINT DA_fix (UDINT mo_ident);
UINT DA_info (UDINT mo_ident, void **moduldata_adr, UDINT *moduldata_lng,
USINT *memorytype);
UINT DA_copy (UDINT mo_ident, char *new_name, USINT mem_typ, UDINT *da_ident,
UDINT *daten_p, UDINT *daten_len);
UINT DA_store (UDINT mo_ident, USINT mem_typ, UDINT* daten_p, UDINT* daten_len);
UINT MO_ver (STRING *pName, USINT grp, MoVerStruc_typ* pMoVerStruc);
void Bit2Byte (Bit2Byte_typ* Bit2Byte_ptr);
void Byte2Bit (Byte2Bit_typ* Byte2Bit_ptr);
#ifdef __cplusplus
};
#endif
#endif /* _SYS_LIB_H_ */

View File

@@ -0,0 +1,643 @@
(********************************************************************
* COPYRIGHT -- Bernecker + Rainer
********************************************************************
* Library: sys_lib
* File: sys_lib.fun
* Author: B+R
********************************************************************
* Functions and function blocks of library sys_lib
********************************************************************)
FUNCTION_BLOCK Byte2Bit (*converts a byte array into a bit array*)
VAR_INPUT
byteadr :UDINT; (*byte array address*)
length :UINT; (*byte array length (1 through 16)*)
END_VAR
VAR_OUTPUT
bitadr :UDINT; (*bit array address*)
END_VAR
VAR
bmem000 :BOOL; (*internal variable*)
static_val :ARRAY[0..138] OF USINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK Bit2Byte (*converts a bit array into a byte array where every bit of data corresponds to an element in the bit array*)
VAR_INPUT
bitadr :UDINT; (*BIT array address*)
length :UINT; (*BIT array length (1 through 128)*)
END_VAR
VAR_OUTPUT
byteadr :UDINT; (*BYTE array address*)
END_VAR
VAR
byte_00 :USINT; (*internal variable*)
byte_01 :USINT; (*internal variable*)
byte_02 :USINT; (*internal variable*)
byte_03 :USINT; (*internal variable*)
byte_04 :USINT; (*internal variable*)
byte_05 :USINT; (*internal variable*)
byte_06 :USINT; (*internal variable*)
byte_07 :USINT; (*internal variable*)
byte_08 :USINT; (*internal variable*)
byte_09 :USINT; (*internal variable*)
byte_10 :USINT; (*internal variable*)
byte_11 :USINT; (*internal variable*)
byte_12 :USINT; (*internal variable*)
byte_13 :USINT; (*internal variable*)
byte_14 :USINT; (*internal variable*)
byte_15 :USINT; (*internal variable*)
bmem000 :BOOL; (*internal variable*)
static_val :ARRAY[0..138] OF USINT; (*internal variable*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION KEY_read : UINT (*reads the status of the keys on the CPU*)
VAR_INPUT
keys :UDINT; (*array variable for storing key states*)
END_VAR
END_FUNCTION
FUNCTION KEY_enadis : UINT (*disables key handling by the operating system (operating mode 0)*)
VAR_INPUT
mode :BOOL; (*operating mode: 0 ... key handling by the operating system, 1 ... key handling by an application program*)
END_VAR
END_FUNCTION
FUNCTION DA_fix : UINT (*transfers a data object to the FIXRAM*)
VAR_INPUT
mo_ident :UDINT; (*ID number from DA_create() or DA_ident()*)
END_VAR
END_FUNCTION
FUNCTION DA_info : UINT (*provides information about the data object*)
VAR_INPUT
mo_ident :UDINT; (*ID number from DA_create() or DA_ident()*)
moduldata_adr :UDINT; (*data address in the data object*)
moduldata_len :UDINT; (*pointer to length of the data (in bytes)*)
memorytype :UDINT; (*pointer to memory type*)
END_VAR
END_FUNCTION
FUNCTION DA_copy : UINT (*copies a data object into the specified memory (RAM, User ROM, MEMCARD or FIXRAM) under the name new_name*)
VAR_INPUT
mo_ident :UDINT; (*ID number from DA_create() or DA_ident()*)
new_name :UDINT; (*pointer to name of the new data object*)
mem_typ :USINT; (*memory type, e.g. 1...RAM, 2...User ROM, ..*)
da_ident :UDINT; (*pointer to ID number of the copied data object*)
daten_p :UDINT; (*data address in the new data object*)
daten_len :UDINT; (*pointer to data length in the new data object (in bytes)*)
END_VAR
END_FUNCTION
FUNCTION DA_store : UINT (*saves a data object in the specified memory (RAM, UserROM, MEMCARD or FIXRAM)*)
VAR_INPUT
mo_ident :UDINT; (*ID number from DA_create() or DA_ident()*)
mem_typ :USINT; (*memory type, e.g. 1...RAM, 2...User ROM, ..*)
daten_p :UDINT; (*data address in the new data object*)
daten_len :UDINT; (*pointer to data length in the new data object (in bytes)*)
END_VAR
END_FUNCTION
FUNCTION DA_burn : UINT (*transfers a data object to UserROM*)
VAR_INPUT
mo_ident :UDINT; (*ID number from DA_create() or DA_ident()*)
END_VAR
END_FUNCTION
FUNCTION DA_delete : UINT (*deletes a data object from the memory (RAM, User ROM, MEMCARD or FIXRAM)*)
VAR_INPUT
mo_ident :UDINT; (*ID number from DA_create() or DA_ident()*)
END_VAR
END_FUNCTION
FUNCTION DA_ident : UINT (*provides the ID number of an existing data object*)
VAR_INPUT
name_p :UDINT; (*pointer to name of the data object*)
grp :USINT; (*group number (standard = 0)*)
mo_ident :UDINT; (*pointer to ID number of the data object*)
END_VAR
END_FUNCTION
FUNCTION DA_read : UINT (*reads data from a module in the RAM or FIXRAM*)
VAR_INPUT
mo_ident :UDINT; (*ID number from DA_create() or DA_ident()*)
data_p :UDINT; (*pointer to data range*)
data_len :UDINT; (*length of the data (in bytes)*)
mo_data_offset :UDINT; (*offset in the data area of the module*)
END_VAR
END_FUNCTION
FUNCTION DA_write : UINT (*writes data to a data object in RAM or FIXRAM*)
VAR_INPUT
mo_ident :UDINT; (*ID number from DA_create() or DA_ident()*)
data_p :UDINT; (*pointer to data range*)
data_len :UDINT; (*length of the data (in bytes)*)
mo_data_offset :UDINT; (*offset in the data area of the module*)
END_VAR
END_FUNCTION
FUNCTION DA_create : UINT (*generates a data object with corresponding parameter in the RAM*)
VAR_INPUT
name_p :UDINT; (*pointer to name of the data object*)
grp :USINT; (*group Number (standard = 0)*)
spooladr :UINT; (*spool address (standard = 0)*)
data_len :UDINT; (*length of the data (in bytes)*)
data_p :UDINT; (*pointer to data which is written in the data object*)
mo_data_p :UDINT; (*data address in the data object*)
mo_ident :UDINT; (*pointer to ID number of the data object*)
END_VAR
END_FUNCTION
FUNCTION DIS_clr : UINT (*clears the CPU status display (B&R 2010 system only)*)
VAR_INPUT
dummy_input :USINT; (*required for operation in ladder diagram*)
END_VAR
END_FUNCTION
FUNCTION DIS_chr : UINT (*writes a ASCII character to the CPU status display*)
VAR_INPUT
row :UDINT; (*row number (0 or 1) where the ASCII character is to be output*)
col :UDINT; (*column number (0 through 7) where the ASCII character is to be output*)
character :SINT; (*ASCII character that is to be output on the status display*)
END_VAR
END_FUNCTION
FUNCTION DIS_str : UINT (*writes a character string to the CPU status display*)
VAR_INPUT
row :UDINT; (*row number (0 or 1) where the string is to be output*)
col :UDINT; (*column number (0 through 7) from where the string is to be output*)
string :UDINT; (*pointer to string (ending in zero) that is to be output on the status display*)
END_VAR
END_FUNCTION
FUNCTION ERRxfatal : UINT (*makes an log book entry in the error log book*)
VAR_INPUT
errornr :UINT; (*error number, which is entered in the error log book*)
errorinfo :UDINT; (*optional additional information (error details)*)
errorstring :UDINT; (*pointer to string, ending in zero (32 characters maximum)*)
END_VAR
END_FUNCTION
FUNCTION ERR_read : UINT (*reads an entry from the error log book and writes the information in a structure (ERR_typ_struct)*)
VAR_INPUT
entry_nr :UINT; (*number of the log book entry that is to be read*)
ERR_typ_struct :UDINT; (*pointer to structure in which information about the log book entry is written*)
END_VAR
END_FUNCTION
FUNCTION ERRxread : UINT (*reads an entry from the error log book and writes the information in a structure (ERR_typ_struct)*)
VAR_INPUT
entry_nr :UINT; (*number of the log book entry that is to be read*)
ERR_xtyp_struct :UDINT; (*pointer to structure in which information about the log book entry is written*)
END_VAR
END_FUNCTION
FUNCTION ERR_fatal : UINT (*makes an entry (log book entry) in the error log book*)
VAR_INPUT
errornr :UINT; (*error number, which is entered in the error log book*)
errorinfo :UDINT; (*optional additional information (error details)*)
END_VAR
END_FUNCTION
FUNCTION ERR_warning : UINT (*makes an entry (log book entry) in the error log book*)
VAR_INPUT
errornr :UINT; (*error number, which is entered in the error log book*)
errorinfo :UDINT; (*optional additional information (error details)*)
END_VAR
END_FUNCTION
FUNCTION ERRxwarning : UINT (*makes an entry (log book entry) in the error log book*)
VAR_INPUT
errornr :UINT; (*error number, which is entered in the error log book*)
errorinfo :UDINT; (*optional additional information (error details)*)
errorstring :UDINT; (*string ending in zero (32 characters maximum)*)
END_VAR
END_FUNCTION
FUNCTION SM_release : UINT (*releases the semaphore with the specified ID number*)
VAR_INPUT
sm_ident :UDINT; (*semaphore ID number from SM_create() or SM_ident()*)
END_VAR
END_FUNCTION
FUNCTION SM_attach : UINT (*requests the use of a semaphore*)
VAR_INPUT
sm_ident :UDINT; (*semaphore ID number from SM_create() or SM_ident()*)
timeout :UDINT; (*timeout time in units of 10 ms (0 = unlimited timeout time)*)
flags :UDINT; (*0 ... wait for timeout time to elapse, 1 ... do not wait for timeout time to elapse*)
END_VAR
END_FUNCTION
FUNCTION SM_delete : UINT (*deletes the semaphore with the specified ID number*)
VAR_INPUT
sm_ident :UDINT; (*semaphore ID number from SM_create() or SM_ident()*)
END_VAR
END_FUNCTION
FUNCTION SM_ident : UINT (*provides the ID number of an existing semaphore*)
VAR_INPUT
sm_name :UDINT; (*pointer to semaphore name*)
sm_ident :UDINT; (*pointer to ID number of the semaphore*)
END_VAR
END_FUNCTION
FUNCTION SM_create : UINT (*generates a semaphore using the specified parameter and provides the ID number of the semaphore*)
VAR_INPUT
sm_name :UDINT; (*semaphore name, given as a string*)
sm_count :USINT; (*number of permitted instances of simultaneous access using the semaphore*)
sm_ident :UDINT; (*ID number of the semaphore*)
END_VAR
END_FUNCTION
FUNCTION TIM_ticks : UINT (*provides the number of ticks (1 tick = 10 ms) in the current second*)
(* The dummy_input parameter is obsolete.
VAR_INPUT
dummy_input :USINT; required for operation in ladder diagram
END_VAR *)
END_FUNCTION
FUNCTION TIM_musec : UINT (*provides the (approximate) number of microseconds in the current tick (1 tick = 10 ms)*)
(* The dummy_input parameter is obsolete.
VAR_INPUT
dummy_input :USINT; required for operation in ladder diagram
END_VAR *)
END_FUNCTION
FUNCTION SW_settime : UINT (*sets the software clock to the desired time (RTCtime_struct structure)*)
VAR_INPUT
RTCtime_struct :UDINT; (*pointer to the structure which contains the time and date*)
END_VAR
END_FUNCTION
FUNCTION SW_gettime : UINT (*reads the time and date from the software clock and writes this information in a RTCtime_struct structure*)
VAR_INPUT
RTCtime_struct :UDINT; (*pointer to the structure where the time and date are stored*)
END_VAR
END_FUNCTION
FUNCTION RTC_settime : UINT (*sets the real-time clock to the desired time (RTCtime_struct structure)*)
VAR_INPUT
RTCtime_struct :UDINT; (*pointer to the structure which contains the time and date*)
END_VAR
END_FUNCTION
FUNCTION RTC_gettime : UINT (*reads time and date from the real-time clock and writes this information in a RTCtime_struct structure*)
VAR_INPUT
RTCtime_struct :UDINT; (*pointer to the structure where the time and date are stored*)
END_VAR
END_FUNCTION
FUNCTION TMP_free : UINT (*releases a memory area, which has been allocated using TMP_alloc()*)
VAR_INPUT
memlng :UDINT; (*size of the memory area to be released in bytes*)
memptr :UDINT; (*address for the memory area to be released*)
END_VAR
END_FUNCTION
FUNCTION TMP_alloc : UINT (*allocates memory in the temporary memory area (system RAM only)*)
VAR_INPUT
memlng :UDINT; (*size of the allocated memory area in bytes*)
memptr :UDINT; (*pointer to requested memory area*)
END_VAR
END_FUNCTION
FUNCTION MEM_free : UINT (*releases a memory area, which has been allocated using MEM_alloc()*)
VAR_INPUT
memlng :UDINT; (*size of the memory area to be released in bytes*)
memptr :UDINT; (*address for the memory area to be released*)
END_VAR
END_FUNCTION
FUNCTION MEM_alloc : UINT (*allocates memory in the user memory area (user RAM only)*)
VAR_INPUT
memlng :UDINT; (*size of the allocated memory area in bytes*)
memptr :UDINT; (*pointer to requested memory area*)
END_VAR
END_FUNCTION
FUNCTION AVT_info : UINT (*determines how many links there are to the AVT entry with the specified AVT ID number*)
VAR_INPUT
av_ident :UDINT; (*AVT ID number from AVT_create() or AVT_ident()*)
av_linkcount :UDINT; (*link count (number of access to this AVT entry)*)
END_VAR
END_FUNCTION
FUNCTION AVT_release : UINT (*releases the AVT entry with the specified AVT ID number*)
VAR_INPUT
av_ident :UDINT; (*AVT ID number from AVT_create() or AVT_ident()*)
END_VAR
END_FUNCTION
FUNCTION AVT_attach : UINT (*attachs information to an AVT entry*)
VAR_INPUT
av_ident :UDINT; (*AVT ID number from AVT_create() or AVT_ident()*)
av_info :UDINT; (*pointer to AVT info (e.g.: data address)*)
END_VAR
END_FUNCTION
FUNCTION AVT_ident : UINT (*provides the AVT ID number for an existing AVT entry*)
VAR_INPUT
av_name :UDINT; (*pointer to name of AVT entry*)
av_grp :USINT; (*group number (standard = 0)*)
av_ident :UDINT; (*pointer to AVT ident number*)
END_VAR
END_FUNCTION
FUNCTION AVT_cancel : UINT (*deletes the entry with the specified AVT ID number from the AVT*)
VAR_INPUT
av_ident :UDINT; (*AVT ID number from AVT_create() or AVT_ident()*)
END_VAR
END_FUNCTION
FUNCTION AVT_create : UINT (*generates an AVT entry with the specified name and provides an ID number*)
VAR_INPUT
av_name :UDINT; (*pointer to name of AVT entry*)
av_grp :USINT; (*group number (standard = 0)*)
av_info :UDINT; (*AVT info (e.g.: data address)*)
av_ident :UDINT; (*pointer to AVT ident number*)
END_VAR
END_FUNCTION
FUNCTION UT_sleep : UINT (*stops the idle time object for a set period of time*)
VAR_INPUT
tickcount :UDINT; (*number of ticks (1 tick = 10 ms) for which an idle time object is stopped*)
END_VAR
END_FUNCTION
FUNCTION UT_exit : UINT (*exits an idle time object*)
VAR_INPUT
exitinfo :UDINT; (*exit information (standard = 0)*)
END_VAR
END_FUNCTION
FUNCTION UT_freemsg : UINT (*releases the memory which was taken up by a received message*)
VAR_INPUT
msglng :UDINT; (*size of the memory to be released (in bytes)*)
msg :UDINT; (*pointer to memory to be released*)
END_VAR
END_FUNCTION
FUNCTION UT_recmsg : UINT (*receives a message sent using the UT_sendmsg() function*)
VAR_INPUT
ut_ident :UDINT; (*pointer to ID number of the object to which the message was sent*)
msg :UDINT; (*address at which the received message should be saved*)
msglng :UDINT; (*pointer to length of the received data in bytes*)
flags :UDINT; (*Bit 1 = 1: do not wait for UT_sendmsg()*)
END_VAR
END_FUNCTION
FUNCTION UT_sendmsg : UINT (*sends a message to another object (including cyclic objects)*)
VAR_INPUT
ut_ident :UDINT; (*ID number of the object to which the message is to be sent (from UT_ident())*)
msg :UDINT; (*pointer to message to be sent*)
msglng :UDINT; (*length of the message to be sent (in bytes)*)
flags :UDINT; (*Bit 1 = 1: do not wait for UT_recmsg()*)
END_VAR
END_FUNCTION
FUNCTION UT_resume : UINT (*restarts a stopped idle time object*)
VAR_INPUT
ut_ident :UDINT; (*ID number from UT_ident()*)
END_VAR
END_FUNCTION
FUNCTION UT_suspend : UINT (*stops the idle time object with the specified ID number*)
VAR_INPUT
ut_ident :UDINT; (*ID number from UT_ident()*)
END_VAR
END_FUNCTION
FUNCTION UT_ident : UINT (*provides the ID number of an idle time object*)
VAR_INPUT
ut_name :UDINT; (*pointer to name of the idle time object*)
ut_grp :USINT; (*group number (standard = 0)*)
ut_proc :USINT; (*processor number (standard: 0 = current processor)*)
ut_sps_p :UDINT; (*pointer to name of the target system*)
ut_ident :UDINT; (*pointer to ID number of the idle time object*)
END_VAR
END_FUNCTION
FUNCTION ST_name : UINT (*provides the name and group number for the object with the relevant ID number*)
VAR_INPUT
st_ident :UDINT; (*ID number for the object from ST_ident() (0 = the object itself)*)
st_name_p :UDINT; (*pointer to name of the object*)
st_grp :UDINT; (*pointer to group number for the object (standard = 0)*)
END_VAR
END_FUNCTION
FUNCTION ST_info : UINT (*provides information about the object with the relevant ID number*)
VAR_INPUT
st_ident :UDINT; (*ID number for the object from ST_ident() (0 = the object itself)*)
state :UDINT; (*pointer to status of the object: 1 ... Object installed, 2 ... Object running, ..*)
tknr :UDINT; (*pointer to resource information: 1 through 8 ... Cyclic resource, -8 ... Exception resource, ..*)
END_VAR
END_FUNCTION
FUNCTION ST_allsuspend : UINT (*suspends all cyclic software objects*)
VAR_INPUT
dummy_input :USINT; (*required for operation in ladder diagram*)
END_VAR
END_FUNCTION
FUNCTION ST_tmp_resume : UINT (*activates a previously stopped (cyclic) software object*)
VAR_INPUT
st_ident :UDINT; (*ID number for the software object from ST_ident()*)
END_VAR
END_FUNCTION
FUNCTION ST_tmp_suspend : UINT (*suspends a cyclic object temporarily*)
VAR_INPUT
st_ident :UDINT; (*ID number for the object from ST_ident() (0 = object suspends itself)*)
END_VAR
END_FUNCTION
FUNCTION ST_resume : UINT (*activates a previously stopped (cyclic) software object*)
VAR_INPUT
st_ident :UDINT; (*ID number for the software object from ST_ident()*)
END_VAR
END_FUNCTION
FUNCTION ST_suspend : UINT (*suspends a cyclic object permanently*)
VAR_INPUT
st_ident :UDINT; (*ID number for the object from ST_ident()(0 = object suspends itself)*)
END_VAR
END_FUNCTION
FUNCTION ST_ident : UINT (*provides the ID number for a software object*)
VAR_INPUT
st_name :UDINT; (*pointer to name of the software object*)
st_grp :USINT; (*group number for the object (standard = 0)*)
st_ident :UDINT; (*pointer to ID number of the object*)
END_VAR
END_FUNCTION
FUNCTION FORCE_info : UINT (*determines whether or not a variable is forced in the objects of the specified resource (tk_nr)*)
VAR_INPUT
tknr :USINT; (*resource that is to be checked: 1 through 4 ... cyclic resource, -9 ... Interrupt resource, ..*)
force :UDINT; (*given as a pointer: 1 ... force function is active, 0 ... force function is inactive*)
END_VAR
END_FUNCTION
FUNCTION MO_ver : UINT (*reads the version and the date of a B&R module*)
VAR_INPUT
pName :UDINT; (*pointer to name of the B&R module*)
grp :USINT; (*group number for the object (standard = 0)*)
pMoVerStruc :UDINT; (*pointer to the structure where the module version of the located B&R module is stored*)
END_VAR
END_FUNCTION
FUNCTION MO_list : UINT (*browses all the B&R modules on the target system*)
VAR_INPUT
prev_index :UINT; (*index of the B&R module where the search is being started*)
index :UDINT; (*pointer to index of the found B&R module*)
MO_List_struct :UDINT; (*pointer to structure where the module information is stored*)
END_VAR
END_FUNCTION
FUNCTION_BLOCK MO_info (*reads information of a B&R module on the target system*)
VAR_INPUT
enable :BOOL; (*enables execution*)
pName :UDINT; (*pointer to name of the B&R module*)
grp :USINT; (*group number for the object (standard = 0)*)
END_VAR
VAR_OUTPUT
status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
type :USINT; (*B&R module type*)
state :USINT; (*B&R module status*)
memType :UDINT; (*memory of the B&R module*)
address :UDINT; (*physical address of the B&R module*)
size :UDINT; (*size of the B&R module*)
version :ARRAY[0..9] OF USINT; (*B&R module version*)
date :RTCtime_typ; (*B&R module date*)
END_VAR
END_FUNCTION_BLOCK
FUNCTION SYS_battery : USINT (*indicates the status of the standard/rechargeable battery in the CPU and the battery in the APM*)
VAR_INPUT
dummy_input :USINT; (*required for operation in ladder diagram*)
END_VAR
END_FUNCTION
FUNCTION SYSreset : UINT (*initiates a boot procedure on the target system in the specified mode (WARM or COLD START)*)
VAR_INPUT
enable :BOOL; (*enables execution*)
mode :USINT; (*boot mode: 0x01 .. WARM START (with Restart), 0x02 .. COLD START (with Restart), ..*)
END_VAR
END_FUNCTION
FUNCTION SYSxinfo : UINT (*reads the additional system information and writes this information into a SYSxinfo_struct structure*)
VAR_INPUT
SYSxinfo_struct :UDINT; (*pointer to structure where the additional system information is stored, given as a pointer*)
END_VAR
END_FUNCTION
FUNCTION SYS_info : UINT (*provides information about the system*)
VAR_INPUT
init_count :UDINT; (*pointer to number of previously executed warm restarts*)
init_descr :UDINT; (*pointer to mode of last start-up: 1 ... WARM RESTART, 2 ... COLD RESTART, ..*)
tick_count :UDINT; (*pointer to tick counter*)
version :UDINT; (*pointer to operating system version number*)
ov_version :UDINT; (*pointer to object directory version number*)
END_VAR
END_FUNCTION
FUNCTION PV_xlist : UINT (*browse all the variables*)
VAR_INPUT
prev_index :UINT; (*index of the PV where the search is being started*)
index :UDINT; (*pointer to index of the located PV*)
PV_xList_struct :UDINT; (*pointer to structure which contains PV information about the located PV*)
END_VAR
END_FUNCTION
FUNCTION PV_ninfo : UINT (*reads data from a process variable of a complex data type (array or structure variable)*)
VAR_INPUT
pv_name :UDINT; (*pointer to name of the process variable*)
data_typ_p :UDINT; (*pointer to data type of the PV*)
data_len_p :UDINT; (*pointer to length of the PV in bytes*)
dimension_p :UDINT; (*pointer to number of array or structure elements*)
END_VAR
END_FUNCTION
FUNCTION PV_item : UINT (*determines the names of structure elements*)
VAR_INPUT
pv_name :UDINT; (*pointer to name of the process variable*)
index :UINT; (*structure element index*)
itemname :UDINT; (*pointer to name of the structure element*)
END_VAR
END_FUNCTION
FUNCTION PV_ident : UINT (*provides the ID number of a process variable (PV)*)
VAR_INPUT
pv_name :UDINT; (*pointer to name of the process variable*)
pv_tknr :USINT; (*process variable resource*)
pv_grp :USINT; (*group number *)
pv_ident :UDINT; (*pointer to PV ID number*)
END_VAR
END_FUNCTION
FUNCTION PV_list : UINT (*browses all variables*)
VAR_INPUT
prev_index :UINT; (*index of the PV where the search is being started*)
index :UDINT; (*pointer to index of the located PV*)
PVList_struct :UDINT; (*pointer to structure which contains PV information about the located PV*)
END_VAR
END_FUNCTION
FUNCTION PV_info : UINT (*reads data from a process variable of a complex data type (array or structure variable)*)
VAR_INPUT
pv_ident :UDINT; (*ID number of the process variable from PV_ident()*)
data_typ :UDINT; (*pointer to data type of the PV*)
data_len :UDINT; (*pointer to length of the PV in bytes*)
dimension :UDINT; (*pointer to number of array or structure elements*)
END_VAR
END_FUNCTION
FUNCTION PV_xgetval : UINT (*reads data from a process variable of a complex data type (array or structure variable)*)
VAR_INPUT
pv_ident :UDINT; (*ID number of the process variable from PV_ident()*)
subindex :UINT; (*element index: 0 ... Entire array/structure, 1 ... 1st element of the array/structure, ..*)
data_p :UDINT; (*pointer to data read*)
data_len :USINT; (*length of the data to be read in bytes*)
END_VAR
END_FUNCTION
FUNCTION PV_xsetval : UINT (*sets a particular value for a process variable of a complex data type (array variable or structure variable)*)
VAR_INPUT
pv_ident :UDINT; (*ID number of the process variable from PV_ident()*)
subindex :UINT; (*element index: 0 ... Entire array/structure, 1 ... 1st element of the array/structure, ..*)
data_p :UDINT; (*pointer to data assigned to the PV*)
data_len :USINT; (*length of the data in bytes*)
END_VAR
END_FUNCTION
FUNCTION PV_xgetadr : UINT (*provides the address and length of a variable*)
VAR_INPUT
pv_name_p :UDINT; (*pointer to name of the process variable*)
pv_adresse :UDINT; (*PV address for dynamic access*)
data_len :UDINT; (*pointer to length of the process variable in bytes*)
END_VAR
END_FUNCTION
FUNCTION PV_getadr : UINT (*provides the address of a process variable*)
VAR_INPUT
pv_name_p :UDINT; (*pointer to name of the process variable*)
pv_tknr :USINT; (*process variable resource: 1 ... Cyclic #1, timer #1-4, 2 ... Cyclic resource cyclic #2, ..*)
pv_grpnr :USINT; (*group number (standard = 0)*)
pv_adresse :UDINT; (*PV address for dynamic access*)
END_VAR
END_FUNCTION
FUNCTION PV_getval : UINT (*reads the value of a process variable*)
VAR_INPUT
pv_ident :UDINT; (*ID number of the process variable from PV_ident()*)
value :UDINT; (*pointer to determined value of the PV*)
END_VAR
END_FUNCTION
FUNCTION PV_setval : UINT (*sets a particular value for a process variable*)
VAR_INPUT
pv_ident :UDINT; (*ID number of the process variable from PV_ident()*)
value :UDINT; (*value assigned to the PV*)
END_VAR
END_FUNCTION

View File

@@ -0,0 +1,99 @@
(********************************************************************
* COPYRIGHT -- Bernecker + Rainer
********************************************************************
* Library: sys_lib
* File: sys_lib.typ
* Author: B+R
********************************************************************
* Data types of library sys_lib
********************************************************************)
TYPE
MoVerStruc_typ : STRUCT
version : ARRAY[0..9] OF USINT ;
year : UINT ;
month : USINT ;
day : USINT ;
reserve : USINT ;
hour : USINT ;
minute : USINT ;
second : USINT ;
END_STRUCT;
ERR_xtyp : STRUCT
err_nr : UINT ;
err_info : UDINT ;
t_name : ARRAY[0..4] OF SINT ;
err_type : USINT ;
err_year : UINT ;
err_month : USINT ;
err_day : USINT ;
err_reserve : USINT ;
err_hour : USINT ;
err_minute : USINT ;
err_second : USINT ;
err_millisec : UINT ;
err_microsec : UINT ;
err_string : ARRAY[0..33] OF USINT ;
END_STRUCT;
ERR_typ : STRUCT
err_nr : UINT ;
err_info : UDINT ;
t_name : ARRAY[0..4] OF SINT ;
err_type : USINT ;
err_year : UINT ;
err_month : USINT ;
err_day : USINT ;
err_reserve : USINT ;
err_hour : USINT ;
err_minute : USINT ;
err_second : USINT ;
err_millisec : UINT ;
err_microsec : UINT ;
END_STRUCT;
PV_xList_typ : STRUCT
name : ARRAY[0..32] OF SINT ; (*name of the process variable*)
data_typ : USINT ; (*PV data type (see PV_info())*)
data_len : UDINT ; (*length of the PV in bytes*)
dimension : UDINT ; (*number of array elements*)
adress : UDINT ; (*physical address of the PV (for dynamic access)*)
END_STRUCT;
PV_List_typ : STRUCT
name : ARRAY[0..13] OF SINT ; (*name of the PV*)
tcnr : USINT ; (*PV resource*)
grp : USINT ; (*group number of the PV (standard = 0)*)
ident : UDINT ; (*PV ID number*)
adress : UDINT ; (*physical address of the PV (for dynamic access)*)
END_STRUCT;
MO_List_typ : STRUCT
name : ARRAY[0..13] OF SINT ;
grp : USINT ;
type : USINT ;
state : USINT ;
reserve : USINT ;
adress : UDINT ;
memtype : UDINT ;
END_STRUCT;
SYSxinfo_typ : STRUCT
aws_name : ARRAY[0..5] OF SINT ;
aws_type : ARRAY[0..1] OF SINT ;
cpu_info : UDINT ;
ma_globl_len : UINT ;
md_globl_len : UINT ;
os_len : UDINT ;
user_len : UDINT ;
tmp_len : UDINT ;
eprom_len : UDINT ;
fix_ram_len : UDINT ;
END_STRUCT;
RTCtime_typ : STRUCT
year : UINT ;
month : USINT ;
day : USINT ;
reserve : USINT ;
hour : USINT ;
minute : USINT ;
second : USINT ;
millisec : UINT ;
microsec : UINT ;
END_STRUCT;
END_TYPE

View File

@@ -0,0 +1,105 @@
(********************************************************************
* COPYRIGHT -- Bernecker + Rainer
********************************************************************
* Library: sys_lib
* File: sys_lib.var
* Author: B+R
********************************************************************
* Local variables of library sys_lib
********************************************************************)
(*error codes of the SYS_LIB services*)
VAR CONSTANT
ERR_BUR_WRROW : UINT := 2061; (*illegal row*)
ERR_BUR_WRCOL : UINT := 2062; (*illegal column*)
ERR_BUR_WR_CHAR : UINT := 2063; (*invalid ASCII character*)
ERR_BUR_NORTC : UINT := 2073; (*RTC not existing or uninitialized*)
ERR_BUR_NOMEM : UINT := 3030; (*out of memory*)
ERR_BUR_MEMVWBUSY : UINT := 3035; (*memory management busy*)
ERR_BUR_ILLPTR : UINT := 3104; (*illegal data pointer in MEM_free*)
ERR_BUR_ILLTKNR : UINT := 3300; (*illegal task-class number*)
ERR_BUR_WROFFSET : UINT := 3301; (*illegal offset*)
ERR_BUR_ILLSTATE : UINT := 3302; (*illegal state of object*)
ERR_BUR_NOMSG : UINT := 3303; (*no message sent/received*)
ERR_BUR_DUPOBJ : UINT := 3305; (*object exists*)
ERR_BUR_TIMEOUT : UINT := 3304; (*timeout error*)
ERR_BUR_EXISTS : UINT := 3306; (*entry exists*)
ERR_BUR_LCOUNT : UINT := 3307; (*Linkcnt <> 0 in AVT_cancel ()*)
ERR_BUR_BURNING : UINT := 3308; (*error burning module*)
ERR_BUR_INVALIDMBX : UINT := 3309; (*invalid mailbox*)
ERR_BUR_ILLBPTR : UINT := 3310; (*invalid base pointer*)
ERR_BUR_ILLTYP : UINT := 3311; (*invalid I/O type*)
ERR_BUR_ILLEXT : UINT := 3312; (*invalid ext. bit*)
ERR_BUR_ILLVER : UINT := 3313; (*invalid version, e.g. BURTRAP V1.10 to SPSSW V1.05*)
ERR_BUR_ILLLEN : UINT := 3314; (*invalid data length*)
ERR_BUR_MAX_LCOUNT : UINT := 3315; (*AVT_attach: LCOUNT > 127*)
ERR_BUR_AVT_FREE : UINT := 3316; (*AVT_release:LCOUNT = 0*)
ERR_BUR_ILLPAR : UINT := 3317; (*illegal parameter*)
ERR_BUR_INSTALL : UINT := 3318; (*error install datamodule*)
ERR_BUR_WRONG_MODTYP : UINT := 3319; (*wrong Moduletype*)
ERR_BUR_OBJDEL : UINT := 3320; (*object already deleted*)
ERR_BUR_ILLOBJ : UINT := 3324; (*object does not exist*)
ERR_BUR_ILLOBJTYP : UINT := 3328; (*invalid object type*)
ERR_BUR_NOENTRY : UINT := 3332; (*no entry*)
ERR_BUR_TOOLONG_PVNAME : UINT := 3333; (*too long PV name*)
ERR_BUR_ILLIDENT : UINT := 3336; (*illegal ident*)
ERR_BUR_NOSMBUF : UINT := 3560; (*no more semaphore buffers*)
ERR_BUR_NOSM : UINT := 3564; (*semaphore not available*)
ERR_BUR_SMDEL : UINT := 3568; (*semaphore deleted*)
ERR_BUR_NOTIME : UINT := 3584; (*time not available*)
ERR_BUR_ILLDATE : UINT := 3588; (*date : out of range*)
ERR_BUR_ILLTIME : UINT := 3592; (*time : out of range*)
ERR_BUR_ILLTICKS : UINT := 3596; (*ticks : out of range*)
ERR_BUR_MEM_ALLOC : UINT := 3600; (*not enough continuous memory*)
ERR_BUR_TMP_ALLOC : UINT := 3601; (*not enough continuous memory*)
ERR_BUR_MEM_FREE : UINT := 3700; (*invalid pointer/length*)
ERR_BUR_TMP_FREE : UINT := 3701; (*invalid pointer/length*)
END_VAR
(*state for object PLC task*)
VAR CONSTANT
Z_ST_created : UINT := 1; (*object installed*)
Z_ST_running : UINT := 2; (*object running*)
Z_ST_blocked : UINT := 3; (*object stopped*)
Z_ST_exist : UINT := 16#00; (*object exists*)
Z_ST_installed : UINT := 16#82; (*temporary status during installation*)
Z_ST_PVinstalled : UINT := 16#83; (*temporary status during installation*)
Z_ST_IOinstalled : UINT := 16#84; (*temporary status during installation*)
Z_ST_IOdeinstalled : UINT := 16#85; (*temporary status during installation*)
Z_ST_PVdeinstalled : UINT := 16#86; (*temporary status during installation*)
Z_ST_delete : UINT := 16#87; (*temporary status during installation*)
Z_ST_stdebug : UINT := 16#88; (*temporary status during installation*)
Z_ST_tmp_suspended : UINT := 16#90; (*object temporarily stopped*)
END_VAR
(*PV data types*)
VAR CONSTANT
PB_DT_STRUCT : UINT := 0; (*structure*)
PB_DT_BOOL : UINT := 1; (*boolean*)
PB_DT_INT8 : UINT := 2; (*integer8*)
PB_DT_INT16 : UINT := 3; (*integer16*)
PB_DT_INT32 : UINT := 4; (*integer32*)
PB_DT_BYTE : UINT := 5; (*unsigned integer8*)
PB_DT_WORD : UINT := 6; (*unsigned integer16*)
PB_DT_LONG : UINT := 7; (*unsigned integer32*)
PB_DT_FLOAT : UINT := 8; (*floating point*)
PB_DT_VIS : UINT := 9; (*visible string*)
PB_DT_OCTET : UINT := 10; (*octet string*)
PB_DT_DATE : UINT := 11; (*date*)
PB_DT_TIME : UINT := 12; (*time of day*)
PB_DT_DIFF : UINT := 13; (*time difference*)
PB_DT_BIT : UINT := 14; (*bit string*)
PB_DT_ARRAY : UINT := 15; (*array*)
END_VAR
(*memory types*)
VAR CONSTANT
SYS_RAM : UINT := 1; (*RAM*)
USER_ROM1 : UINT := 2; (*EPROM*)
FIX_RAM : UINT := 5; (*fixed RAM*)
END_VAR

12
Logical/Package.pkg Normal file
View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=3.0.90.21 SP03?>
<Package xmlns="http://br-automation.co.at/AS/Package">
<Objects>
<Object Type="File" Description="Global data types">Global.typ</Object>
<Object Type="File" Description="Global variables">Global.var</Object>
<Object Type="Package" Description="Common Defaults">Common</Object>
<Object Type="Package" Description="Communication">Communication</Object>
<Object Type="Package" Description="Global libraries">Libraries</Object>
<Object Type="Program" Language="IEC" Description="A new program">test</Object>
</Objects>
</Package>

9
Logical/test/IEC.prg Normal file
View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=3.0.90.21 SP03?>
<Program xmlns="http://br-automation.co.at/AS/Program">
<Files>
<File Description="Implementation code">test.st</File>
<File Description="Local data types" Private="true">test.typ</File>
<File Description="Local variables" Private="true">test.var</File>
</Files>
</Program>

38
Logical/test/test.st Normal file
View File

@@ -0,0 +1,38 @@
(********************************************************************
* COPYRIGHT --
********************************************************************
* Program: test
* File: test.st
* Author: michi
* Created: July 13, 2012
********************************************************************
* Implementation of program test
********************************************************************)
PROGRAM _INIT
(* TODO : Add your code here *)
END_PROGRAM
PROGRAM _CYCLIC
//lrValue := 1234.5;
memcpy (ADR (ldValue), ADR (lrValue), 4);
ldValue1 := 0;
ldValue2 := ldValue AND 2#10000000_00000000_00000000_00000000;
ldValue2 := ldValue2 OR SHL (INT_TO_DWORD (DWORD_TO_INT (SHR ((ldValue AND 2#01111111_10000000_00000000_00000000), 23)) + 896), 20);
ldValue2 := ldValue2 OR SHR ((ldValue AND 2#00000000_01111111_11111111_11111111), 3);
memcpy (ADR (ldValueB), ADR (lrValue) + 2, 2);
memcpy (ADR (ldValueB) + 2, ADR (lrValue), 2);
ldValue3 := 0;
ldValue4 := ldValue AND 2#10000000_00000000_00000000_00000000;
ldValue4 := ldValue4 OR SHL (INT_TO_DWORD (DWORD_TO_INT (SHR ((ldValueB AND 2#01111111_10000000_00000000_00000000), 23)) + 896), 20);
ldValue4 := ldValue4 OR SHR ((ldValueB AND 2#00000000_01111111_11111111_11111111), 3);
END_PROGRAM

14
Logical/test/test.typ Normal file
View File

@@ -0,0 +1,14 @@
(********************************************************************
* COPYRIGHT --
********************************************************************
* Program: test
* File: test.typ
* Author: michi
* Created: July 13, 2012
********************************************************************
* Local data types of program test
********************************************************************)
TYPE
END_TYPE

19
Logical/test/test.var Normal file
View File

@@ -0,0 +1,19 @@
(********************************************************************
* COPYRIGHT --
********************************************************************
* Program: test
* File: test.var
* Author: michi
* Created: July 13, 2012
********************************************************************
* Local variables of program test
********************************************************************)
VAR
lrValue : REAL := 1234.0;
ldValueB : DWORD;
ldValue : DWORD;
ldValue1 : DWORD;
ldValue2 : DWORD;
ldValue3 : DWORD;
ldValue4 : DWORD;
END_VAR

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=3.0.90.18?>
<Configuration xmlns="http://br-automation.co.at/AS/Configuration">
<Objects>
<Object Type="File" Description="Hardware topology">Hardware.hc</Object>
<Object Type="PLC" Description="Files belonging to this PLC">PLC1</Object>
</Objects>
</Configuration>

Binary file not shown.

View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=?>
<RuntimeConfiguration Version="2.32.22">
<Module ID="IF4" Hardware="X20CP0291 (X2x)" />
<Module ID="IF4.ST0" Hardware="X20PS9500">
<Selector ID="FunctionModel" Value="Standard">
<Group ID="General">
<Parameter ID="Supervision" Value="on" />
<Parameter ID="ModuleInfo" Value="off" />
<Parameter ID="StatusInfo" Value="on" />
<Parameter ID="PowerInfo" Value="off" />
</Group>
</Selector>
</Module>
<Module ID="IF4.ST1" Hardware="X20AT4222">
<Selector ID="FunctionModel" Value="Standard">
<Group ID="General">
<Parameter ID="Supervision" Value="off" />
<Parameter ID="ModuleInfo" Value="off" />
<Parameter ID="IOCycleCounter" Value="off" />
<Parameter ID="InputFilter" Value="20ms" />
</Group>
<Group ID="Channel01">
<Parameter ID="SensorType01" Value="PT100" />
</Group>
<Group ID="Channel02">
<Parameter ID="SensorType02" Value="PT100" />
</Group>
<Group ID="Channel03">
<Parameter ID="SensorType03" Value="PT100" />
</Group>
<Group ID="Channel04">
<Parameter ID="SensorType04" Value="PT100" />
</Group>
</Selector>
</Module>
<Module ID="IF4.ST2" Hardware="X20AT4222">
<Selector ID="FunctionModel" Value="Standard">
<Group ID="General">
<Parameter ID="Supervision" Value="off" />
<Parameter ID="ModuleInfo" Value="off" />
<Parameter ID="IOCycleCounter" Value="off" />
<Parameter ID="InputFilter" Value="20ms" />
</Group>
<Group ID="Channel01">
<Parameter ID="SensorType01" Value="PT100" />
</Group>
<Group ID="Channel02">
<Parameter ID="SensorType02" Value="PT100" />
</Group>
<Group ID="Channel03">
<Parameter ID="SensorType03" Value="PT100" />
</Group>
<Group ID="Channel04">
<Parameter ID="SensorType04" Value="PT100" />
</Group>
</Selector>
</Module>
<Module ID="IF4.ST3" Hardware="X20AT4222">
<Selector ID="FunctionModel" Value="Standard">
<Group ID="General">
<Parameter ID="Supervision" Value="off" />
<Parameter ID="ModuleInfo" Value="off" />
<Parameter ID="IOCycleCounter" Value="off" />
<Parameter ID="InputFilter" Value="20ms" />
</Group>
<Group ID="Channel01">
<Parameter ID="SensorType01" Value="PT100" />
</Group>
<Group ID="Channel02">
<Parameter ID="SensorType02" Value="PT100" />
</Group>
<Group ID="Channel03">
<Parameter ID="SensorType03" Value="PT100" />
</Group>
<Group ID="Channel04">
<Parameter ID="SensorType04" Value="PT100" />
</Group>
</Selector>
</Module>
<Module ID="IF4.ST4" Hardware="X20AT4222">
<Selector ID="FunctionModel" Value="Standard">
<Group ID="General">
<Parameter ID="Supervision" Value="off" />
<Parameter ID="ModuleInfo" Value="off" />
<Parameter ID="IOCycleCounter" Value="off" />
<Parameter ID="InputFilter" Value="20ms" />
</Group>
<Group ID="Channel01">
<Parameter ID="SensorType01" Value="PT100" />
</Group>
<Group ID="Channel02">
<Parameter ID="SensorType02" Value="PT100" />
</Group>
<Group ID="Channel03">
<Parameter ID="SensorType03" Value="PT100" />
</Group>
<Group ID="Channel04">
<Parameter ID="SensorType04" Value="PT100" />
</Group>
</Selector>
</Module>
<Module ID="IF4.ST5" Hardware="X20DI9371">
<Selector ID="FunctionModel" Value="Standard">
<Group ID="General">
<Parameter ID="Supervision" Value="off" />
<Parameter ID="ModuleInfo" Value="off" />
<Parameter ID="InputFilter" Value="10" />
<Parameter ID="DigitalInputsPacked" Value="off" />
</Group>
</Selector>
</Module>
<Module ID="IF4.ST6" Hardware="X20DO9322">
<Selector ID="FunctionModel" Value="Standard">
<Group ID="General">
<Parameter ID="Supervision" Value="off" />
<Parameter ID="ModuleInfo" Value="off" />
<Parameter ID="StatusInfo" Value="on" />
<Parameter ID="DigitalOutputsPacked" Value="off" />
</Group>
</Selector>
</Module>
</RuntimeConfiguration>

View File

@@ -0,0 +1,13 @@
(********************************************************************
* COPYRIGHT --
********************************************************************
* File: Cpu.per
* Author: Administrator
* Created: November 03, 2011
********************************************************************
* Declaration of permanent variables
********************************************************************)
VAR_CONFIG
END_VAR

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=3.0.90.21 SP03?>
<SwConfiguration CpuAddress="SL1" xmlns="http://br-automation.co.at/AS/SwConfiguration">
<TaskClass Name="Cyclic#1">
<Task Name="get_dt" Source="Common.get_dt.prg" Memory="UserROM" Language="IEC" Debugging="true" />
</TaskClass>
<TaskClass Name="Cyclic#2">
<Task Name="collectd" Source="Communication.collectd.prg" Memory="UserROM" Language="IEC" Debugging="true" />
</TaskClass>
<TaskClass Name="Cyclic#3" />
<TaskClass Name="Cyclic#4">
<Task Name="test" Source="test.prg" Memory="UserROM" Language="IEC" Debugging="true" />
</TaskClass>
<DataObjects />
<NcDataObjects />
<VcDataObjects />
<Binaries>
<BinaryObject Name="asfw" Source="" Memory="SystemROM" Language="Binary" />
<BinaryObject Name="arconfig" Source="" Memory="SystemROM" Language="Binary" />
<BinaryObject Name="iomap" Source="" Memory="UserROM" Language="Binary" />
<BinaryObject Name="sysconf" Source="" Memory="SystemROM" Language="Binary" />
<BinaryObject Name="rtk68k" Source="" Memory="UserROM" Language="Binary" />
</Binaries>
<Libraries>
<LibraryObject Name="brsystem" Source="Libraries.brsystem.lby" Memory="UserROM" Language="Binary" Debugging="true" />
<LibraryObject Name="sys_lib" Source="Libraries.sys_lib.lby" Memory="UserROM" Language="Binary" Debugging="true" />
<LibraryObject Name="burtrap" Source="" Memory="UserROM" Language="Binary" Debugging="true" />
<LibraryObject Name="runtime" Source="" Memory="UserROM" Language="Binary" Debugging="true" />
<LibraryObject Name="AsUDP" Source="Libraries.AsUDP.lby" Memory="UserROM" Language="Binary" Debugging="true" />
<LibraryObject Name="standard" Source="Libraries.standard.lby" Memory="UserROM" Language="Binary" Debugging="true" />
<LibraryObject Name="asieccon" Source="" Memory="UserROM" Language="Binary" Debugging="true" />
<LibraryObject Name="astime" Source="" Memory="UserROM" Language="Binary" Debugging="true" />
<LibraryObject Name="asima" Source="" Memory="UserROM" Language="Binary" Debugging="true" />
<LibraryObject Name="asstring" Source="" Memory="UserROM" Language="Binary" Debugging="true" />
</Libraries>
</SwConfiguration>

View File

@@ -0,0 +1,27 @@
(********************************************************************
* COPYRIGHT --
********************************************************************
* File: IoMap.iom
* Author: Administrator
* Created: November 03, 2011
********************************************************************
* IO mapping file
********************************************************************)
VAR_CONFIG
giOven1Temp1 AT %IW.IF4.ST1.Temperature01;
giOven1Temp2 AT %IW.IF4.ST1.Temperature02;
giOven1Temp3 AT %IW.IF4.ST1.Temperature03;
giOven1Temp4 AT %IW.IF4.ST1.Temperature04;
giOven1Temp5 AT %IW.IF4.ST2.Temperature01;
giOven1Temp7 AT %IW.IF4.ST2.Temperature03;
giOven1Temp6 AT %IW.IF4.ST2.Temperature02;
giOven1Temp8 AT %IW.IF4.ST2.Temperature04;
giOven2Temp1 AT %IW.IF4.ST3.Temperature01;
giOven2Temp2 AT %IW.IF4.ST3.Temperature02;
giOven2Temp3 AT %IW.IF4.ST3.Temperature03;
giOven2Temp4 AT %IW.IF4.ST3.Temperature04;
giOven2Temp5 AT %IW.IF4.ST4.Temperature01;
giOven2Temp6 AT %IW.IF4.ST4.Temperature02;
giOven2Temp7 AT %IW.IF4.ST4.Temperature03;
giOven2Temp8 AT %IW.IF4.ST4.Temperature04;
END_VAR

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=3.0.90.21 SP03?>
<PLC xmlns="http://br-automation.co.at/AS/PLC">
<Objects>
<Object Type="File" Description="Software configuration">Cpu.sw</Object>
<Object Type="File" Description="Declaration of permanent variables">Cpu.per</Object>
<Object Type="File" Description="IO mapping file">IoMap.iom</Object>
<Object Type="File" Description="Runtime configuration file">ArConfig.rtc</Object>
<Object Type="File" Description="CPU system configuration">sysconf.br</Object>
</Objects>
<CpuModules>
<CpuModule LocalVariablesMemory="MemoryPool" GeneratePPCode="false" HasNcOperatingSystem="false" Target="SGC" ModuleID="CP0291" ClassID="X20CP0291" GccVersion="V2.95.3" OnlineConfigurationName="Temperöfen">
<DefaultTargetMemory Tasks="UserROM" Libraries="UserROM" DataObjects="UserROM" />
<DefaultTaskClass Name="Cyclic4" />
<IO DefaultTaskClass="Automatic" ArConfigDataModule="false" ArConfigDataModulePath="$(AS_CPU_PATH)\AS\CfgData.br" IoMapDataModule="false" IoMapDataModulePath="$(AS_CPU_PATH)\AS\IomData.br" />
<OS Version="2.32.0" Status="V" />
<Transfer DownloadMode="Overload" PromptBeforeProject="false" PromptBeforeTask="false" PackedArConfig="false" PackedIoMap="false" IgnoreTargetOnlyObjects="false" GeneratePviTransferList="true" TransferOnlyRelevantChanges="false" AllowWarmRestart="true" IgnoreBrDependencies="false" />
<Build />
<VC FirmwareVersion="V3.95.6" />
<OPC />
</CpuModule>
</CpuModules>
<Communication>
<OnlineConfiguration Name="Temperöfen" DeviceType="TCPIP" DeviceParameters="/IF=tcpip /LOPO=11159 /SA=1" ConnectionParameters="/RT=1000 /DAIP=192.168.100.56 /REPO=11159 /ANSL=1" Description="" />
</Communication>
</PLC>

Binary file not shown.

7
Physical/Physical.pkg Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=3.0.90.21 SP03?>
<Physical xmlns="http://br-automation.co.at/AS/Physical">
<Configurations>
<Configuration Name="Config1" Description="" />
</Configurations>
</Physical>

Binary file not shown.

View File

@@ -0,0 +1,7 @@
[config]
rule: MK_TK_zyklimit1, 4, 60000, 1, 17027
rule: MK_TK_zyklimit2, 4, 60000, 1, 17027
rule: MK_TK_zyklimit3, 4, 60000, 1, 17027
rule: MK_TK_zyklimit4, 4, 60000, 1, 17027
rule: MK_RK_SystemTick, 4000, 10000, 1, 17537

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
as/system/V0232/SGC/AsHW.br Normal file

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More