<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Awlsim project file generated by awlsim-0.66.0-pre -->
<awlsim_project date_create="2016-03-16 00:00:00.000000"
                date_modify="2018-07-08 18:00:04.959722"
                format_version="1">
	<!-- CPU core configuration -->
	<cpu>
		<!-- CPU core feature specification -->
		<specs call_stack_size="256"
		       nr_accus="2"
		       nr_counters="256"
		       nr_flags="2048"
		       nr_inputs="128"
		       nr_localbytes="1024"
		       nr_outputs="128"
		       nr_timers="256"
		       parenthesis_stack_size="7" />

		<!-- CPU core configuration -->
		<config clock_memory_byte="-1"
		        cycle_time_limit_us="1000000"
		        ext_insns_enable="0"
		        mnemonics="0"
		        ob_startinfo_enable="0"
		        run_time_limit_us="-1" />
	</cpu>

	<!-- AWL/STL language configuration -->
	<language_awl>
		<!-- AWL/STL source code -->
		<source enabled="1"
		        name="Unnamed source"
		        type="0"><![CDATA[
ORGANIZATION_BLOCK OB 1
	VAR_TEMP
		OB1_EV_CLASS   : BYTE;          // Bits 0-3 = 1 (Coming event), Bits 4-7 = 1 (Event class 1)
		OB1_SCAN_1     : BYTE;          // 1 (Cold restart scan 1 of OB 1), 3 (Scan 2-n of OB 1)
		OB1_PRIORITY   : BYTE;          // Priority of OB execution
		OB1_OB_NUMBR   : BYTE;          // 1 (Organization block 1, OB 1)
		OB1_RESERVED_1 : BYTE;
		OB1_RESERVED_2 : BYTE;
		OB1_PREV_CYCLE : INT;           // Cycle time of previous OB 1 scan (milliseconds)
		OB1_MIN_CYCLE  : INT;           // Minimum cycle time of OB 1 (milliseconds)
		OB1_MAX_CYCLE  : INT;           // Maximum cycle time of OB 1 (milliseconds)
		OB1_DATE_TIME  : DATE_AND_TIME; // Date and time OB 1 started
	END_VAR
BEGIN
	//
	// EXAMPLE RASPBERRY PI PROJECT
	//
	// Two hardware modules are enabled in the
	// configuration of this project:
	// The 'rpigpio' module is used to access tha Raspberry Pi
	// GPIO ports.
	// The 'pyprofibus' module is used to access the PiLC
	// PROFIBUS-DP header and talk to PROFIBUS-DP slaves.
	//
	// The HW-config of the 'rpigpio' module
	// does the following input/output memory mappings:
	// I0.0 <= BCM17
	// I0.1 <= BCM24
	// Q0.0 => BCM27
	// Q0.1 => BCM23
	//
	// The HW-config of the 'pyprofibus' module
	// maps the PROFIBUS memory start to
	// I8.0 and Q8.0
	//
	
	
	A	I 0.0	// Read bit from GPIO BCM17
	=	Q 0.0	// Write bit to GPIO BCM27
	
	A	I 0.0	// Read bit from GPIO BCM17
	A	I 0.1	// Read bit from GPIO BCM24 and do an AND operation
	=	Q 0.1	// Write resulting bit to GPIO BCM23
	
	L	IB 8	// Read the first byte from PROFIBUS
	T	QB 8	// Write it to the first byte of PROFIBUS


	// Run some other code...
	CALL	FC 1

END_ORGANIZATION_BLOCK


FUNCTION FC 1 : VOID
BEGIN
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	L	MW 200
	+	1
	T	MW 202
	L	MW 204
	+	1
	T	MW 206
	L	MW 208
	+	1
	T	MW 210
	L	MW 212
	+	1
	T	MW 214
	L	MW 216
	+	1
	T	MW 218
	L	MW 220
	+	1
	T	MW 222
	L	MW 224
	+	1
	T	MW 226
	L	MW 228
	+	1
	T	MW 230
	L	MW 200
	+	1
	T	MW 202
	L	MW 204
	+	1
	T	MW 206
	L	MW 208
	+	1
	T	MW 210
	L	MW 212
	+	1
	T	MW 214
	L	MW 216
	+	1
	T	MW 218
	L	MW 220
	+	1
	T	MW 222
	L	MW 224
	+	1
	T	MW 226
	L	MW 228
	+	1
	T	MW 230
	L	MW 200
	+	1
	T	MW 202
	L	MW 204
	+	1
	T	MW 206
	L	MW 208
	+	1
	T	MW 210
	L	MW 212
	+	1
	T	MW 214
	L	MW 216
	+	1
	T	MW 218
	L	MW 220
	+	1
	T	MW 222
	L	MW 224
	+	1
	T	MW 226
	L	MW 228
	+	1
	T	MW 230
	L	MW 200
	+	1
	T	MW 202
	L	MW 204
	+	1
	T	MW 206
	L	MW 208
	+	1
	T	MW 210
	L	MW 212
	+	1
	T	MW 214
	L	MW 216
	+	1
	T	MW 218
	L	MW 220
	+	1
	T	MW 222
	L	MW 224
	+	1
	T	MW 226
	L	MW 228
	+	1
	T	MW 230
	L	MW 200
	+	1
	T	MW 202
	L	MW 204
	+	1
	T	MW 206
	L	MW 208
	+	1
	T	MW 210
	L	MW 212
	+	1
	T	MW 214
	L	MW 216
	+	1
	T	MW 218
	L	MW 220
	+	1
	T	MW 222
	L	MW 224
	+	1
	T	MW 226
	L	MW 228
	+	1
	T	MW 230
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
	NOP	0
END_FUNCTION

]]></source>
	</language_awl>

	<!-- Symbol table configuration -->
	<symbols>
		<!-- symbol table source code -->
		<source enabled="1"
		        name="Main table"
		        type="3"><![CDATA[

]]></source>
	</symbols>

	<!-- Core server link configuration -->
	<core_link>
		<!-- Locally spawned core server -->
		<spawn_local enable="0"
		             interpreters="$DEFAULT"
		             port_range_begin="4183"
		             port_range_end="8278" />

		<!-- Remote server connection -->
		<connect host="pilc"
		         port="4151"
		         timeout_ms="3000" />

		<!-- Transport tunnel -->
		<tunnel local_port="-1"
		        type="1">
			<ssh executable="ssh"
			     port="22"
			     user="pi" />
		</tunnel>
	</core_link>

	<!-- Hardware modules configuration -->
	<hardware>
		<!-- Loaded hardware module -->
		<module name="pyprofibus">
			<params>
				<param name="config"
				       value="awlsimhw_pyprofibus.conf" />
				<param name="inputAddressBase"
				       value="8" />
				<param name="outputAddressBase"
				       value="8" />
			</params>
		</module>

		<!-- Loaded hardware module -->
		<module name="rpigpio">
			<params>
				<param name="I0.0"
				       value="BCM17" />
				<param name="I0.1"
				       value="BCM24" />
				<param name="Q0.0"
				       value="BCM27" />
				<param name="Q0.1"
				       value="BCM23" />
				<param name="inputAddressBase"
				       value="0" />
				<param name="outputAddressBase"
				       value="0" />
			</params>
		</module>
	</hardware>

	<!-- Graphical user interface configuration -->
	<gui>
		<editor autoindent="1"
		        paste_autoindent="1"
		        validation="1" />
	</gui>
</awlsim_project>
