FUNCTION_BLOCK "Function Block"
	VAR_INPUT
		INVAR : S5TIME;
	END_VAR
	VAR
		MULTI : "Function Block 2";
	END_VAR
BEGIN
	CALL #MULTI (
		INP	:= 42,
	)
END_FUNCTION_BLOCK


FUNCTION_BLOCK "Function Block 2"
	VAR_INPUT
		INP : INT;
	END_VAR
BEGIN
	L		#INP
	__ASSERT==	__ACCU 1,	42
END_FUNCTION_BLOCK


DATA_BLOCK "Data_1"
STRUCT
	VAR0		: INT;
END_STRUCT;
BEGIN
	VAR0		:= 123;
END_DATA_BLOCK


DATA_BLOCK "Instance DB"
	"Function Block"
BEGIN
END_DATA_BLOCK


ORGANIZATION_BLOCK OB 1
BEGIN
	// Test symbolic M access
	__STWRST
	U		"sym_M_0.0"
	__ASSERT==	__STW VKE,	0
	SET
	=		M 0.0
	__STWRST
	U		"sym_M_0.0"
	__ASSERT==	__STW VKE,	1
	CLR
	=		"sym_M_0.0"
	__STWRST
	U		M 0.0
	__ASSERT==	__STW VKE,	0


	// Test symbolic fully qualified access
	L		"Data_1".VAR0
	__ASSERT==	__ACCU 1,	123


	// Test symbolic FB call
	CALL	"Function Block", "Instance DB" (
		INVAR := 100,
	)


	// Test symbolic timer/counter access
	CLR
	SI		"symbolic timer"
	U		"symbolic timer"
	=		M 0.0
	CLR
	ZR		"symbolic counter"
	U		"symbolic counter"
	=		M 0.0


	CALL SFC 46 // STOP CPU
END_ORGANIZATION_BLOCK
