<?xml version="1.0" encoding="UTF-8"?>
<PoBlocks>
    <Project>
        <Reset_core_on_startup>true</Reset_core_on_startup>
        <Auto_reload_project>false</Auto_reload_project>
        <Target_device>1</Target_device>
        <Author></Author>
        <Auto_start>true</Auto_start>
        <Cycle_time>10</Cycle_time>
        <Project_name></Project_name>
        <Date></Date>
        <Disable_division_by_zero_exception>false</Disable_division_by_zero_exception>
        <BlocksCount>8</BlocksCount>
        <LinksCount>5</LinksCount>
    </Project>
    <Blocks>
        <block ID="0" type="1100" position="280/180">
            <Name>Start Pulse engine</Name>
            <hideInputs>1</hideInputs>
            <hideOutputs>0</hideOutputs>
            <hideMemory_bits>1</hideMemory_bits>
            <hideMemory_int8>0</hideMemory_int8>
            <hideMemory_int16>0</hideMemory_int16>
            <hideMemory_int32>0</hideMemory_int32>
            <hideVariables>start : INPUT(1, bit)

tmpStart : bit</hideVariables>
            <hideCode># Check clock
LOAD start
STORE S

AND !tmpStart
POP tmpStart

CMPEQ DL[1]
JMPF cancelStart

# Configure axes 1, 2 and 3 in speed mode
LOAD DL[4]
STORE Bh0990
STORE Bh0991
STORE Bh0992

# Switch to running state
LOAD DL[3]
STORE Bh0980

cancelStart:
</hideCode>
        </block>
        <block ID="1" type="1100" position="290/310">
            <Name>Set ref. speed 1</Name>
            <hideInputs>3</hideInputs>
            <hideOutputs>2</hideOutputs>
            <hideMemory_bits>1</hideMemory_bits>
            <hideMemory_int8>0</hideMemory_int8>
            <hideMemory_int16>0</hideMemory_int16>
            <hideMemory_int32>0</hideMemory_int32>
            <hideVariables>start : INPUT(1, bit)

refx : INPUT(2, int32)
refy : INPUT(3, int32)

tmpStart : bit


posx : OUTPUT(1, int32)
posy : OUTPUT(2, int32)</hideVariables>
            <hideCode># Check clock
LOAD start
STORE S

AND !tmpStart
POP tmpStart

CMPEQ DL[1]
JMPF cancelSwitch1

# Move at requested speed 

# Copy the value from the input
# to the reference speed register
LOAD refx
STORE Dh940

LOAD refy
STORE Dh944

cancelSwitch1:

# Read the current position from the
# position register
LOAD Dh900
STORE posx

LOAD Dh904
STORE posy</hideCode>
        </block>
        <block ID="2" type="555" position="-10/290">
            <Name>Clock source</Name>
            <Half_time_m_period>2000</Half_time_m_period>
            <Show_dynamic_input>false</Show_dynamic_input>
        </block>
        <block ID="3" type="1100" position="290/410">
            <Name>Set ref. speed 2</Name>
            <hideInputs>3</hideInputs>
            <hideOutputs>2</hideOutputs>
            <hideMemory_bits>1</hideMemory_bits>
            <hideMemory_int8>0</hideMemory_int8>
            <hideMemory_int16>0</hideMemory_int16>
            <hideMemory_int32>0</hideMemory_int32>
            <hideVariables>start : INPUT(1, bit)

refx : INPUT(2, int32)
refy : INPUT(3, int32)

tmpStart : bit


posx : OUTPUT(1, int32)
posy : OUTPUT(2, int32)</hideVariables>
            <hideCode># Check clock
LOAD start
STORE S

AND !tmpStart
POP tmpStart

CMPEQ DL[1]
JMPF cancelSwitch2

# Move at requested speed
LOAD refx
STORE Dh940

LOAD refy
STORE Dh944

cancelSwitch2:

LOAD Dh900
STORE posx

LOAD Dh904
STORE posy</hideCode>
        </block>
        <block ID="4" type="200" position="120/390">
            <Name>NOT</Name>
        </block>
        <block ID="5" type="1100" position="290/500">
            <Name>Set ref. speed 2</Name>
            <hideInputs>1</hideInputs>
            <hideOutputs>1</hideOutputs>
            <hideMemory_bits>0</hideMemory_bits>
            <hideMemory_int8>0</hideMemory_int8>
            <hideMemory_int16>0</hideMemory_int16>
            <hideMemory_int32>0</hideMemory_int32>
            <hideVariables>refz : INPUT(1, int32)


posz : OUTPUT(1, int32)
</hideVariables>
            <hideCode># Move at requested speed
LOAD refz
STORE Dh948

cancelSwitch3:

LOAD Dh908
STORE posz
</hideCode>
        </block>
        <block ID="6" type="2" position="0/500">
            <Name>Analog input</Name>
            <Pin_ID>41</Pin_ID>
            <Init_function>true</Init_function>
            <Output_value>0</Output_value>
        </block>
        <block ID="7" type="980" position="120/500">
            <Name>Re-scale</Name>
            <Input_min>0</Input_min>
            <Input_max>4095</Input_max>
            <Output_min>0</Output_min>
            <Output_max>1000</Output_max>
            <Limit_output>true</Limit_output>
        </block>
    </Blocks>
    <Links>
        <link ID="0">
            <source type="port" blockID="2" portID="0"/>
            <destination blockID="1" portID="0"/>
            <anchors>
                <anchor ID="0" position="50/290"/>
            </anchors>
        </link>
        <link ID="1">
            <source type="port" blockID="4" portID="0"/>
            <destination blockID="3" portID="0"/>
            <anchors/>
        </link>
        <link ID="2">
            <source type="link" linkID="0" anchorID="0"/>
            <destination blockID="4" portID="0"/>
            <anchors/>
        </link>
        <link ID="3">
            <source type="port" blockID="6" portID="0"/>
            <destination blockID="7" portID="0"/>
            <anchors/>
        </link>
        <link ID="4">
            <source type="port" blockID="7" portID="0"/>
            <destination blockID="5" portID="0"/>
            <anchors/>
        </link>
    </Links>
    <Constants>
        <constant blockID="0" portID="0" value="1"/>
        <constant blockID="1" portID="1" value="1000"/>
        <constant blockID="1" portID="2" value="-1000"/>
        <constant blockID="3" portID="1" value="-1000"/>
        <constant blockID="3" portID="2" value="0"/>
    </Constants>
    <Shared/>
</PoBlocks>
