<?xml version="1.0" encoding="UTF-8"?>
<PoBlocks>
    <Project>
        <Author></Author>
        <Auto_reload_project>false</Auto_reload_project>
        <Cycle_time>10</Cycle_time>
        <Reset_core_on_startup>true</Reset_core_on_startup>
        <Disable_division_by_zero_exception>false</Disable_division_by_zero_exception>
        <Date></Date>
        <Project_name></Project_name>
        <Target_device>1</Target_device>
        <Auto_start>true</Auto_start>
        <BlocksCount>59</BlocksCount>
        <LinksCount>46</LinksCount>
    </Project>
    <Blocks>
        <block ID="0" type="0" position="90/340">
            <Name>MPG mode</Name>
            <Pin_ID>8</Pin_ID>
            <Init_function>true</Init_function>
            <Inverted>false</Inverted>
        </block>
        <block ID="1" type="0" position="1190/950">
            <Name>Select SSR2</Name>
            <Pin_ID>13</Pin_ID>
            <Init_function>true</Init_function>
            <Inverted>false</Inverted>
        </block>
        <block ID="2" type="0" position="200/530">
            <Name>Select EJE ENC2</Name>
            <Pin_ID>12</Pin_ID>
            <Init_function>true</Init_function>
            <Inverted>false</Inverted>
        </block>
        <block ID="3" type="223" position="1580/1040">
            <Name>Bits to byte</Name>
        </block>
        <block ID="4" type="1100" position="1690/970">
            <Name>OC outputs</Name>
            <hideInputs>1</hideInputs>
            <hideOutputs>0</hideOutputs>
            <hideMemory_bits>0</hideMemory_bits>
            <hideMemory_int8>0</hideMemory_int8>
            <hideMemory_int16>0</hideMemory_int16>
            <hideMemory_int32>0</hideMemory_int32>
            <hideVariables>outputs : INPUT(1,int8)
</hideVariables>
            <hideCode>LOAD outputs
STORE Bh9A2</hideCode>
        </block>
        <block ID="5" type="1000" position="1510/970">
            <Name>Comment</Name>
            <Comment>SSR2</Comment>
        </block>
        <block ID="6" type="200" position="1300/950">
            <Name>NOT1</Name>
        </block>
        <block ID="7" type="1000" position="1510/990">
            <Name>Comment</Name>
            <Comment>REL2</Comment>
        </block>
        <block ID="8" type="1000" position="1510/1010">
            <Name>Comment</Name>
            <Comment>REL1</Comment>
        </block>
        <block ID="9" type="1000" position="1510/1030">
            <Name>Comment</Name>
            <Comment>OC1</Comment>
        </block>
        <block ID="10" type="1000" position="1510/1050">
            <Name>Comment</Name>
            <Comment>OC2</Comment>
        </block>
        <block ID="11" type="1000" position="1510/1070">
            <Name>Comment</Name>
            <Comment>OC3</Comment>
        </block>
        <block ID="12" type="1000" position="1510/1090">
            <Name>Comment</Name>
            <Comment>OC4</Comment>
        </block>
        <block ID="13" type="1000" position="1510/1110">
            <Name>Comment</Name>
            <Comment>SSR1</Comment>
        </block>
        <block ID="14" type="2" position="1190/880">
            <Name>AJUSTA SPIN 42</Name>
            <Pin_ID>42</Pin_ID>
            <Init_function>true</Init_function>
            <Output_value>0</Output_value>
        </block>
        <block ID="15" type="3" position="1580/890">
            <Name>PWM output</Name>
            <Pin_ID>17</Pin_ID>
            <PWM_period>25000</PWM_period>
            <Init_period>true</Init_period>
            <Duty_range>100</Duty_range>
            <Default_duty>0</Default_duty>
            <Show_enable_input>true</Show_enable_input>
        </block>
        <block ID="16" type="980" position="1370/880">
            <Name>Re-scale Vel Spindle</Name>
            <Input_min>0</Input_min>
            <Input_max>4095</Input_max>
            <Output_min>0</Output_min>
            <Output_max>200</Output_max>
            <Limit_output>false</Limit_output>
        </block>
        <block ID="17" type="850" position="1390/1470">
            <Name>LCD UI</Name>
            <Use_secondary_pins>false</Use_secondary_pins>
            <LCD_rows>4</LCD_rows>
            <LCD_columns>20</LCD_columns>
            <LCD>
                <Layout>
                    <Row Text=" PARO DE EMERGENCIA "/>
                    <Row Text="     ACTIVADO       "/>
                    <Row Text="  VERIFIQUE ESTADO  "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="  FRESADORA MBF550  "/>
                    <Row Text="    JRTC   v1.00    "/>
                    <Row Text="  MODO  AUTOMATICO  "/>
                    <Row Text="Pulse para confirmar"/>
                    <Variable Format="X0" BlockID="32" PortID="18" Position="0/1"/>
                    <Variable Format="X0" BlockID="32" PortID="19" Position="0/0"/>
                    <Variable Format="X0" BlockID="48" PortID="0" Position="18/0"/>
                    <Variable Format="X0" BlockID="49" PortID="0" Position="18/1"/>
                </Layout>
                <Layout>
                    <Row Text="  FRESADORA MBF550  "/>
                    <Row Text="    JRTC   v1.00    "/>
                    <Row Text="      MODO MPG      "/>
                    <Row Text="Pulse para confirmar"/>
                    <Variable Format="X0" BlockID="32" PortID="18" Position="0/1"/>
                </Layout>
                <Layout>
                    <Row Text="  FRESADORA MBF550  "/>
                    <Row Text="    JRTC   v1.00    "/>
                    <Row Text="   MODO DISTANCIA   "/>
                    <Row Text="Pulse para confirmar"/>
                    <Variable Format="X0" BlockID="32" PortID="18" Position="0/1"/>
                </Layout>
                <Layout>
                    <Row Text="  FRESADORA MBF550  "/>
                    <Row Text="    JRTC   v1.00    "/>
                    <Row Text="  MODO COORDENADAS  "/>
                    <Row Text="Pulse para confirmar"/>
                </Layout>
                <Layout>
                    <Row Text="  FRESADORA MBF550  "/>
                    <Row Text="    JRTC   v1.00    "/>
                    <Row Text="  MODO  UTILIDADES  "/>
                    <Row Text="Pulse para confirmar"/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="Modo AUTO   X    .  "/>
                    <Row Text="Spindle   % Y    .  "/>
                    <Row Text="Multipl   % Z    .  "/>
                    <Row Text="1     2     3       "/>
                    <Variable Format="XX0" BlockID="15" PortID="0" Position="7/1"/>
                    <Variable Format="+XX0" BlockID="44" PortID="2" Position="13/0"/>
                    <Variable Format="+X00" BlockID="26" PortID="1" Position="1/3"/>
                    <Variable Format="+X00" BlockID="25" PortID="1" Position="7/3"/>
                    <Variable Format="X0" Position="0/0"/>
                </Layout>
                <Layout>
                    <Row Text="Modo MPG  &gt;X       &lt;"/>
                    <Row Text="          &gt;Y       &lt;"/>
                    <Row Text="Mult       Z        "/>
                    <Row Text="Spin    % 1    2    "/>
                    <Variable Format="XX0" BlockID="15" PortID="0" Position="5/3"/>
                    <Variable Format="+XXXXX0" BlockID="21" PortID="0" Position="12/0"/>
                    <Variable Format="+X00" BlockID="26" PortID="1" Position="11/3"/>
                    <Variable Format="+X00" BlockID="25" PortID="1" Position="16/3"/>
                    <Variable Format="+XXXXX0" BlockID="21" PortID="1" Position="12/1"/>
                    <Variable Format="+XXXXX0" BlockID="21" PortID="2" Position="12/2"/>
                </Layout>
                <Layout>
                    <Row Text="Modo MPG   X        "/>
                    <Row Text="          &gt;Y       &lt;"/>
                    <Row Text="Mult      &gt;Z       &lt;"/>
                    <Row Text="Spin    % 1    2    "/>
                    <Variable Format="XX0" BlockID="15" PortID="0" Position="5/3"/>
                    <Variable Format="+X00" BlockID="26" PortID="1" Position="11/3"/>
                    <Variable Format="+X00" BlockID="25" PortID="1" Position="16/3"/>
                    <Variable Format="+XXXXX0" BlockID="21" PortID="1" Position="12/1"/>
                    <Variable Format="+XXXXX0" BlockID="21" PortID="2" Position="12/2"/>
                    <Variable Format="+XXXXX0" BlockID="21" PortID="0" Position="12/0"/>
                </Layout>
                <Layout>
                    <Row Text="Modo MPG   X        "/>
                    <Row Text="           Y        "/>
                    <Row Text="&gt;Mul     &lt; Z        "/>
                    <Row Text="Spin    %           "/>
                    <Variable Format="+XXXXX0" Position="12/2"/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="Modo DISTANCIA      "/>
                    <Row Text=" EJE X       &gt;SALIR&lt;"/>
                    <Row Text=" EJE Y              "/>
                    <Row Text=" EJE Z              "/>
                </Layout>
                <Layout>
                    <Row Text="Modo DISTANCIA      "/>
                    <Row Text="&gt;EJE X&lt;       SALIR "/>
                    <Row Text=" EJE Y              "/>
                    <Row Text=" EJE Z              "/>
                </Layout>
                <Layout>
                    <Row Text="Modo DISTANCIA      "/>
                    <Row Text=" EJE X        SALIR "/>
                    <Row Text="&gt;EJE Y&lt;             "/>
                    <Row Text=" EJE Z              "/>
                </Layout>
                <Layout>
                    <Row Text="Modo DISTANCIA      "/>
                    <Row Text=" EJE X        SALIR "/>
                    <Row Text=" EJE Y              "/>
                    <Row Text="&gt;EJE Z&lt;             "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="Modo DISTANCIA EJE X"/>
                    <Row Text="Vel    % &gt;SET       "/>
                    <Row Text="Mult      POS       "/>
                    <Row Text="Spin    %           "/>
                    <Variable Format="XX0" BlockID="16" PortID="1" Position="5/3"/>
                    <Variable Format="+XXXXX0" BlockID="21" PortID="0" Position="13/2"/>
                </Layout>
                <Layout>
                    <Row Text="Modo DISTANCIA EJE X"/>
                    <Row Text="Vel    %  SET       "/>
                    <Row Text="&gt;Mul      POS       "/>
                    <Row Text="Spin    %           "/>
                    <Variable Format="XX0" BlockID="16" PortID="1" Position="5/3"/>
                    <Variable Format="+XXXXX0" BlockID="21" PortID="0" Position="13/2"/>
                </Layout>
                <Layout>
                    <Row Text="Modo DISTANCIA EJE X"/>
                    <Row Text="Vel    %  SET       "/>
                    <Row Text="Mul &gt;     POS       "/>
                    <Row Text="Spin    %           "/>
                    <Variable Format="+XXXXX0" BlockID="21" PortID="0" Position="13/2"/>
                    <Variable Format="XX0" BlockID="16" PortID="1" Position="5/3"/>
                </Layout>
                <Layout>
                    <Row Text="Modo DISTANCIA EJE X"/>
                    <Row Text="Vel    %  &gt;VOLVER   "/>
                    <Row Text="Mul       POS       "/>
                    <Row Text="Spin    %           "/>
                    <Variable Format="XX0" BlockID="16" PortID="1" Position="5/3"/>
                    <Variable Format="+XXXXX0" BlockID="21" PortID="0" Position="13/2"/>
                </Layout>
                <Layout>
                    <Row Text="Modo DISTANCIA EJE Y"/>
                    <Row Text="Vel    % &gt;SET       "/>
                    <Row Text="Mult      POS       "/>
                    <Row Text="Spin    %           "/>
                    <Variable Format="XX0" Position="4/1"/>
                    <Variable Format="XX0" Position="5/3"/>
                </Layout>
                <Layout>
                    <Row Text="Modo DISTANCIA EJE Y"/>
                    <Row Text="Vel    %  SET       "/>
                    <Row Text="&gt;Mul      POS       "/>
                    <Row Text="Spin    %           "/>
                    <Variable Format="XX0" Position="4/1"/>
                    <Variable Format="XX0" Position="5/3"/>
                </Layout>
                <Layout>
                    <Row Text="Modo DISTANCIA EJE Y"/>
                    <Row Text="Vel    %  &gt;SALIR    "/>
                    <Row Text="Mult      POS       "/>
                    <Row Text="Spin    %           "/>
                    <Variable Format="XX0" Position="4/1"/>
                    <Variable Format="XX0" Position="5/3"/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="Modo DISTANCIA EJE Z"/>
                    <Row Text="Vel    % &gt;SET       "/>
                    <Row Text="Mult      POS       "/>
                    <Row Text="Spin    %           "/>
                    <Variable Format="XX0" Position="4/1"/>
                    <Variable Format="XX0" Position="5/3"/>
                </Layout>
                <Layout>
                    <Row Text="Modo DISTANCIA EJE Z"/>
                    <Row Text="Vel    %  SET       "/>
                    <Row Text="&gt;Mul      POS       "/>
                    <Row Text="Spin    %           "/>
                    <Variable Format="XX0" Position="4/1"/>
                    <Variable Format="XX0" Position="5/3"/>
                </Layout>
                <Layout>
                    <Row Text="Modo DISTANCIA EJE Z"/>
                    <Row Text="Vel    %  &gt;VOLVER   "/>
                    <Row Text="Mult      POS       "/>
                    <Row Text="Spin    %           "/>
                    <Variable Format="XX0" Position="4/1"/>
                    <Variable Format="XX0" Position="5/3"/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
                <Layout>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                    <Row Text="                    "/>
                </Layout>
            </LCD>
        </block>
        <block ID="18" type="3" position="1390/1530">
            <Name>contraste</Name>
            <Pin_ID>18</Pin_ID>
            <PWM_period>25000</PWM_period>
            <Init_period>true</Init_period>
            <Duty_range>100</Duty_range>
            <Default_duty>0</Default_duty>
            <Show_enable_input>false</Show_enable_input>
        </block>
        <block ID="19" type="3" position="1390/1580">
            <Name>led lcd</Name>
            <Pin_ID>22</Pin_ID>
            <PWM_period>25000</PWM_period>
            <Init_period>true</Init_period>
            <Duty_range>100</Duty_range>
            <Default_duty>0</Default_duty>
            <Show_enable_input>false</Show_enable_input>
        </block>
        <block ID="20" type="555" position="1040/1480">
            <Name>Clock source 100</Name>
            <Half_time_m_period>100</Half_time_m_period>
            <Show_dynamic_input>false</Show_dynamic_input>
        </block>
        <block ID="21" type="51" position="210/940">
            <Name>Pulse engine 
 status</Name>
            <Axes_count>4</Axes_count>
        </block>
        <block ID="22" type="1000" position="1040/1450">
            <Name>Comment</Name>
            <Comment>Refresco LCD cada 100 ms</Comment>
        </block>
        <block ID="23" type="1000" position="1190/930">
            <Name>Comment</Name>
            <Comment>Conecta spindle</Comment>
        </block>
        <block ID="24" type="1000" position="1190/860">
            <Name>Comment</Name>
            <Comment>Ajusta velocidad spindle</Comment>
        </block>
        <block ID="25" type="5" position="360/540">
            <Name>Encoder 2 value</Name>
            <Encoder_ID>2</Encoder_ID>
            <Channel_A_pin>15</Channel_A_pin>
            <Channel_B_pin>16</Channel_B_pin>
            <Multiplier_4x>false</Multiplier_4x>
            <Init_encoder>false</Init_encoder>
            <Clear_on_start>false</Clear_on_start>
            <Show_reset_input>true</Show_reset_input>
        </block>
        <block ID="26" type="5" position="380/480">
            <Name>Encoder 1 value</Name>
            <Encoder_ID>1</Encoder_ID>
            <Channel_A_pin>1</Channel_A_pin>
            <Channel_B_pin>2</Channel_B_pin>
            <Multiplier_4x>false</Multiplier_4x>
            <Init_encoder>false</Init_encoder>
            <Clear_on_start>false</Clear_on_start>
            <Show_reset_input>true</Show_reset_input>
        </block>
        <block ID="27" type="0" position="270/380">
            <Name>EESTOP</Name>
            <Pin_ID>52</Pin_ID>
            <Init_function>true</Init_function>
            <Inverted>false</Inverted>
        </block>
        <block ID="28" type="5" position="270/280">
            <Name>Encoder 3 value</Name>
            <Encoder_ID>3</Encoder_ID>
            <Channel_A_pin>6</Channel_A_pin>
            <Channel_B_pin>5</Channel_B_pin>
            <Multiplier_4x>false</Multiplier_4x>
            <Init_encoder>true</Init_encoder>
            <Clear_on_start>true</Clear_on_start>
            <Show_reset_input>false</Show_reset_input>
        </block>
        <block ID="29" type="1000" position="290/430">
            <Name>Comment</Name>
            <Comment>Permite visualizar los pasos de cada eje</Comment>
        </block>
        <block ID="30" type="1000" position="1370/1630">
            <Name>Comment</Name>
            <Comment>Multiplicador de pasos</Comment>
        </block>
        <block ID="31" type="1000" position="1590/860">
            <Name>Comment</Name>
            <Comment>¡¡No funciona el enable??</Comment>
        </block>
        <block ID="32" type="1100" position="560/160">
            <Name>Select Mode</Name>
            <hideInputs>4</hideInputs>
            <hideOutputs>10</hideOutputs>
            <hideMemory_bits>2</hideMemory_bits>
            <hideMemory_int8>0</hideMemory_int8>
            <hideMemory_int16>0</hideMemory_int16>
            <hideMemory_int32>0</hideMemory_int32>
            <hideVariables>ValEnc: INPUT(1,int16)
PulsEnc : INPUT(2,bit)
eStop: INPUT(3,bit)
Enable: INPUT(4,int8)

Modo: OUTPUT(1,int8)
LytLCD : OUTPUT(2,int8)
EnAUTO: OUTPUT(3,bit)
EnMPG: OUTPUT(4,bit)
EnDIST: OUTPUT(5,bit)
EnCOORD: OUTPUT(6,bit)
EnSEL: OUTPUT(7,bit)
EnUTIL: OUTPUT(8,bit)
peStatus:OUTPUT(9,int8)
aoStatus:OUTPUT(10,int8)
flagEnSEL: bit
tmpStart: bit
</hideVariables>
            <hideCode>#Rutina para setear a 1 la variable EnSEL cada vez que arranco
LOAD flagEnSEL
CMPEQ BL[0]
JMPF CancelLoadEnSEL
LOAD b!L[0].0 
STORE EnSEL
STORE flagEnSEL
CancelLoadEnSEL:

LOAD  Bh0980# 0x0980   Pulse engine state
STORE peStatus
LOAD Bh0990#Axes configuration eje X
STORE aoStatus
LOAD eStop#Leo el valor de eStop...
CMPEQ b!L[0].0#...y lo comparo con 1. Si es igual que 0 hace todo lo siguiente...
JMPT EjecutoeStop#...y si es 1 salta a EjecutoeStopMPG

LOAD Enable#Leo el valor de Enable....
CMPEQ BL[0]#....y lo comparo con 0. Si es igual que1 hace todo lo siguiente...
JMPT _Disable

LOAD ValEnc#Leo el valor del encoder
CMPEQ BL[0]#Lo comparo con 0
JMPF ComparoValEnc1#Si el encoder no es 0, salto a la siguiente comparación

#-----------------------------Si el encoder es 0...--------------------------------------------
LOAD PulsEnc#Leo el valor del pulsador 
CMPEQ b!L[0].0#Lo comparo con 1
JMPF ComparoPulsEnc1#Si el pulsador no es 1 (es decir, si he pulsado el botón del encoder), salto a CancelCompPulsEnc1
#..........................Si el pulsador es 1 (no pulsado)....
#Configuro el Modo: 0 = seleccion
LOAD BL[0]
STORE Modo
LOAD BL[1]#Muestro la pantalla del LCD 1
STORE LytLCD
#Configuro las salidas de ENABLE EN MODO SEL
LOAD  b!L[0].0#&lt;&gt;1
STORE EnSEL
LOAD  bL[0].0#&lt;&gt;0
STORE EnAUTO
STORE EnMPG
STORE EnDIST
STORE EnCOORD
STORE EnUTIL
JMP EndCheck
#..........................Si el pulsador es 0 (pulsado)....
ComparoPulsEnc1:
#Configuro el Modo: 1 = AUTOMATICO
LOAD BL[1]
STORE Modo

#Configuro las salidas de ENABLE EN MODO AUTO
LOAD  b!L[0].0#&lt;&gt;1
STORE EnAUTO
LOAD  bL[0].0#&lt;&gt;0
STORE EnSEL
STORE EnMPG
STORE EnDIST
STORE EnCOORD
STORE EnUTIL
JMP EndCheck

#-----------------------------Si el encoder es 1...--------------------------------------------
ComparoValEnc1:
CMPEQ BL[1]
JMPF ComparoValEnc2#Si el encoder no es 1, salto a la siguiente comparación
 LOAD PulsEnc
 CMPEQ b!L[0].0
JMPF ComparoPulsEnc2#Si el pulsador no es 1 (es decir, si he pulsado el botón del encoder), salto a CancelCompPulsEnc2
#..........................Si el pulsador es 1 (no pulsado)....
#Configuro el Modo: 0 = seleccion
LOAD BL[0]
STORE Modo
LOAD BL[2]#Muestro la pantalla del LCD 2
STORE LytLCD
#Configuro las salidas de ENABLE EN MODO SEL
LOAD  b!L[0].0#&lt;&gt;1
STORE EnSEL
LOAD  bL[0].0#&lt;&gt;0
STORE EnAUTO
STORE EnMPG
STORE EnDIST
STORE EnCOORD
STORE EnUTIL
JMP EndCheck
#..........................Si el pulsador es 0 (pulsado)....
ComparoPulsEnc2:
#Configuro el Modo: 2 = MPG
LOAD BL[2]
STORE Modo

#Configuro las salidas de ENABLE EN MODO MPG
LOAD  b!L[0].0#&lt;&gt;1
STORE EnMPG
LOAD  bL[0].0#&lt;&gt;0
STORE EnSEL
STORE EnAUTO
STORE EnDIST
STORE EnCOORD
STORE EnUTIL
JMP EndCheck

#-----------------------------Si el encoder es 2...--------------------------------------------
ComparoValEnc2:
CMPEQ BL[2]
JMPF ComparoValEnc3#Si el encoder no es 2, salto a la siguiente comparación
LOAD PulsEnc
CMPEQ b!L[0].0
JMPF ComparoPulsEnc3#Si el pulsador no es 1 (es decir, si he pulsado el botón del encoder), salto a CancelCompPulsEnc3
#..........................Si el pulsador es 1 (no pulsado)....
#Configuro el Modo: 0 = seleccion
LOAD BL[0]
STORE Modo
LOAD BL[3]#Muestro la pantalla del LCD 3
STORE LytLCD
#Configuro las salidas de ENABLE EN MODO SEL
LOAD  b!L[0].0#&lt;&gt;1
STORE EnSEL
LOAD  bL[0].0#&lt;&gt;0
STORE EnAUTO
STORE EnMPG
STORE EnDIST
STORE EnCOORD
STORE EnUTIL
JMP EndCheck
#..........................Si el pulsador es 0 (pulsado)....
ComparoPulsEnc3:
#Configuro el Modo: 3 = DISTANCIA
LOAD BL[3]
STORE Modo

#Configuro las salidas de ENABLE EN MODO DIST
LOAD  b!L[0].0#&lt;&gt;1
STORE EnDIST
LOAD  bL[0].0#&lt;&gt;0
STORE EnSEL
STORE EnAUTO
STORE EnMPG
STORE EnCOORD
STORE EnUTIL
JMP EndCheck

#-----------------------------Si el encoder es 3...--------------------------------------------
ComparoValEnc3:
CMPEQ BL[3]
JMPF ComparoValEnc4#Si el encoder no es 3, salto a la siguiente comparación
LOAD PulsEnc
CMPEQ b!L[0].0
JMPF ComparoPulsEnc4#Si el pulsador no es 1 (es decir, si he pulsado el botón del encoder), salto a CancelCompPulsEnc4
#..........................Si el pulsador es 1 (no pulsado)....
#Configuro el Modo: 0 = seleccion
LOAD BL[0]
STORE Modo
LOAD BL[4]#Muestro la pantalla del LCD 4
STORE LytLCD
#Configuro las salidas de ENABLE EN MODO SEL
LOAD  b!L[0].0#&lt;&gt;1
STORE EnSEL
LOAD  bL[0].0#&lt;&gt;0
STORE EnAUTO
STORE EnMPG
STORE EnDIST
STORE EnCOORD
STORE EnUTIL
JMP EndCheck
#..........................Si el pulsador es 0 (pulsado)....
ComparoPulsEnc4:
#Configuro el Modo: 4 = COORDENADAS
LOAD BL[4]
STORE Modo

#Configuro las salidas de ENABLE EN MODO COORD
LOAD  b!L[0].0#&lt;&gt;1
STORE EnCOORD
LOAD  bL[0].0#&lt;&gt;0
STORE EnSEL
STORE EnAUTO
STORE EnMPG
STORE EnDIST
STORE EnUTIL
JMP EndCheck

#-----------------------------Si el encoder es 4...--------------------------------------------
ComparoValEnc4:
CMPEQ BL[4]
JMPF ComparoValEnc5#Si el encoder no es 4, salto a la siguiente comparación
LOAD PulsEnc
CMPEQ b!L[0].0
JMPF ComparoPulsEnc5#Si el pulsador no es 1 (es decir, si he pulsado el botón del encoder), salto a CancelCompPulsEnc5
#..........................Si el pulsador es 1 (no pulsado)....
#Configuro el Modo: 0 = seleccion
LOAD BL[0]
STORE Modo
LOAD BL[5]#Muestro la pantalla del LCD 5
STORE LytLCD
#Configuro las salidas de ENABLE EN MODO SEL
LOAD  b!L[0].0#&lt;&gt;1
STORE EnSEL
LOAD  bL[0].0#&lt;&gt;0
STORE EnAUTO
STORE EnMPG
STORE EnDIST
STORE EnCOORD
STORE EnUTIL
JMP EndCheck
#..........................Si el pulsador es 0 (pulsado)....
ComparoPulsEnc5:
#Configuro el Modo: 5 = UTILIDADES
LOAD BL[5]
STORE Modo

#Configuro las salidas de ENABLE EN MODO UTIL
LOAD  b!L[0].0#&lt;&gt;1
STORE EnUTIL
LOAD  bL[0].0#&lt;&gt;0
STORE EnSEL
STORE EnAUTO
STORE EnMPG
STORE EnDIST
STORE EnCOORD
JMP EndCheck

#-----------------------------Si el encoder es 5...--------------------------------------------
ComparoValEnc5:
CMPEQ BL[5]#Si el encoder es igual que 5
JMPF ComparoValEnc6#Si el encoder no es igual 5, salto a la siguiente comparación
LOAD BL[0]
STORE Dh0208#Es lo mismo que STORE D520. Posición de memoria del encoder 3
JMP EndCheck

#-----------------------------Si el encoder es menor que 0...--------------------------------
ComparoValEnc6:
CMPLT BL[0]#Si el encoder es menor que 0
LOAD BL[4]
STORE Dh0208#Es lo mismo que STORE D520. Posición de memoria del encoder 3

#*************RUTINA A EJECUTAR EN ESTOP**************
EjecutoeStop:
LOAD BL[0]#Muestro la pantalla del LCD 0
STORE LytLCD

EndCheck:
_Disable:
</hideCode>
        </block>
        <block ID="33" type="401" position="1290/1460">
            <Name>From 1</Name>
            <Link_ID>1</Link_ID>
        </block>
        <block ID="34" type="105" position="280/330">
            <Name>T flip-flop</Name>
            <Default_value>false</Default_value>
            <Retain_on_reset>false</Retain_on_reset>
            <Initial_value>false</Initial_value>
        </block>
        <block ID="35" type="500" position="190/340">
            <Name>Rising edge</Name>
        </block>
        <block ID="36" type="400" position="1660/70">
            <Name>To1</Name>
            <Link_ID>1</Link_ID>
        </block>
        <block ID="37" type="1100" position="1110/140">
            <Name>Mode AUTO</Name>
            <hideInputs>4</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>ValEncAUTO : INPUT(1,int8)
PulsEncAUTO : INPUT(2,int8)
EnableAUTO: INPUT(3,bit)
eStopAUTO: INPUT(4,bit)
LytLCDAUTO : OUTPUT(1,int8)
EnSELAUTO : OUTPUT(2,bit)


tmp : bit</hideVariables>
            <hideCode>LOAD eStopAUTO#Leo el valor de eStop...
CMPEQ b!L[0].0#...y lo comparo con 1. Si es igual que 1 hace todo lo siguiente...
JMPT EjecutoeStopAUTO

LOAD EnableAUTO#Leo el valor de Enable....
CMPEQ BL[0]#....y lo comparo con 0. Si es igual que1 hace todo lo siguiente...
JMPT _DisableAUTO



LOAD ValEncAUTO#Leo el valor del encoder
CMPEQ BL[0]#Lo comparo con 0
JMPF ComparoValEncAUTO1#Si el encoder no es 0, salto a la siguiente comparación

#------------------------------------Si el encoder es 0 (estoy seleccionando el eje X)...-------------------------------------------
LOAD PulsEncAUTO#Leo el valor del pulsador 
CMPEQ b!L[0].0#Lo comparo con 1
JMPT ComparoPulsEncAUTO1#Si el pulsador es 1 (es decir, si NO he pulsado el botón del encoder), salto a CancelCompPulsEncAUTO1
#Si el pulsador es 1 (no pulsado)....
LOAD BL[11]#Muestro la pantalla del LCD 11: Menú de trabajo MODO AUTO
STORE LytLCDAUTO
#Configuro el  enable...
LOAD  bL[0].0#&lt;&gt;0
STORE EnSELAUTO
# Configuro los ejes Y y Z en speed mode (pág. 113 protocol specification) 
#Axis options
#   aoENABLED		=(1&lt;&lt;0),(si 0&lt;&lt;0 aoDISABLED????)
#   aoINVERTED 	= (1&lt;&lt;1),
#   aoINTERNAL_PLANNER 	= (1&lt;&lt;2),
#   aoPOSITION_MODE 	= (1&lt;&lt;3),(si 0&lt;&lt;3 aoSPEED_MODE????)
#   aoINVERTED_HOME 	= (1&lt;&lt;4), 
#   aoSOFT_LIMIT_ENABLED 	= (1&lt;&lt;5), 
#   aoFAST_OUTPUT 	= (1&lt;&lt;6),
#   aoENABLED_MASKED 	= (1&lt;&lt;7)
#LOAD DL[0]# 00000100 &gt;&gt; 4 aoINTERNAL_PLANNER
#STORE Bh0991#Axes configuration eje Y
#STORE Bh0992#Axes configuration eje Z
#STORE Bh0990#Axes configuration eje X

# Switch to pulse engine state 3
#LOAD DL[3] # 3= peRUNNING (pág 103 protocol specification)
#STORE Bh0980# 0x0980   Pulse engine state
JMP EndCheckAUTO

#Si el pulsador es 0 (pulsado)....
ComparoPulsEncAUTO1:
#Seteo el encoder a la posición 0 para que al regresar esté en modo 1
LOAD BL[0]
STORE Dh0208#Es lo mismo que STORE D520. Posición de memoria del encoder 3
# Switch to pulse engine state 0
LOAD DL[0] #0= peSTOPPED (pág 103 protocol specification)
STORE Bh0980# 0x0980   Pulse engine state
#Configuro el  enable...
LOAD  b!L[0].0#&lt;&gt;1
STORE EnSELAUTO
JMP EndCheckAUTO


#------------------------------------Si el encoder es 1 ---------------------------------------------------------------------------------
ComparoValEncAUTO1:
CMPEQ BL[1]#Si el encoder es igual que 1
JMPF ComparoValEncAUTO2#Si el encoder no es igual 1, salto a la siguiente comparación
LOAD BL[0]
STORE Dh0208#Es lo mismo que STORE D520. Posición de memoria del encoder 3
JMP EndCheckAUTO
#------------------------------------Si el encoder es menor que 0---------------------------------------------------------------------
ComparoValEncAUTO2:
CMPLT BL[0]#Si el encoder es menor que 0
LOAD BL[0]
STORE Dh0208#Es lo mismo que STORE D520. Posición de memoria del encoder 3
#*****************************RUTINA A EJECUTAR EN ESTOP***************************************
EjecutoeStopAUTO:
LOAD BL[0]#Muestro la pantalla del LCD 0
STORE LytLCDAUTO

EndCheckAUTO:
_DisableAUTO:
</hideCode>
        </block>
        <block ID="38" type="1100" position="1110/330">
            <Name>Mode MPG</Name>
            <hideInputs>4</hideInputs>
            <hideOutputs>4</hideOutputs>
            <hideMemory_bits>7</hideMemory_bits>
            <hideMemory_int8>0</hideMemory_int8>
            <hideMemory_int16>0</hideMemory_int16>
            <hideMemory_int32>3</hideMemory_int32>
            <hideVariables>ValEncMPG : INPUT(1,int8)
PulsEncMPG : INPUT(2,int8)
EnableMPG: INPUT(3,bit)
eStopMPG:INPUT(4,bit)
LytLCDMPG : OUTPUT(1,int8)
EnSELMPG : OUTPUT(2,int8)
pePosX:OUTPUT(3,int32)
MultMPG:OUTPUT(4,int8)
tmpCambioEjeX: bit
tmpCambioEjeZ: bit


tmpENC2X: int32
tmpENC1:int32
tmpENC2Z: int32
tmpStartMPG: bit
tmpRestaurarValoresUnaVez:bit
tmpGuardarValoresUnaVez:bit
tmpEJEX: bit
tmpEJEZ: bit</hideVariables>
            <hideCode>LOAD eStopMPG#Leo el valor de eStop...
CMPEQ b!L[0].0#...y lo comparo con 1. Si es igual que 0 hace todo lo siguiente...
JMPT EjecutoeStopMPG#...y si es 1 salta a EjecutoeStopMPG

#Si no estoy en eStop bajo la bandera que me permitirá guardar los valores de los encoder al pulsar eStop
LOAD bL[0].0
STORE tmpGuardarValoresUnaVez

LOAD EnableMPG#Leo el valor de Enable....
CMPEQ b!L[0].0#....y lo comparo con 1. Si es igual que1 hace todo lo siguiente...
JMPF _DisableMPG#...y si no es 1 salta a _DisableMPG

# Switch to pulse engine state 10
#LOAD DL[10] # 10 = peJOGGING (pág 103 protocol specification)
#STORE Bh0980# 0x0980   Pulse engine state

LOAD Dh0900
STORE pePosX


#Chequeo el estado del encoder
LOAD ValEncMPG#Leo el valor del encoder
CMPEQ BL[0]#Lo comparo con 0
JMPF ComparoValEncMPG1#Si el encoder no es 0, salto a la siguiente comparación

#------------------------------------------Si el encoder es 0 (estoy seleccionando el eje Z)...---------------------------------------------------
LOAD PulsEncMPG#Leo el valor del pulsador 
CMPEQ b!L[0].0#Lo comparo con 1
JMPT ComparoPulsEncMPG1#Si el pulsador es 1 (es decir, si NO he pulsado el botón del encoder), salto a ComparoPulsEncMPG1
#....................................Si el pulsador es 0 (pulsado) ENTRO EN EL MODO TRABAJO EJE Z........................................
LOAD  b!L[0].0 
STORE tmpEJEZ #Señalizo que  estoy en el ejeZ
LOAD  bL[0].0 
STORE tmpEJEX #Señalizo que NO estoy en el ejeX

#Muestro la pantalla del LCD 13: Menú de trabajo MODO MPG EJE Z
LOAD BL[13]
STORE LytLCDMPG

#Configuro el  enable...
LOAD  bL[0].0#&lt;&gt;0
STORE EnSELMPG

#Configuro los ejes con los encoder correspondientes
LOAD DL[0]
STORE Bh09A8#EJE X sin encoder
LOAD DL[1]#MPG 1
STORE Bh09A9#EJE Y con el encoder MPG1
LOAD DL[2]#MPG 2
STORE Bh09AA#EJE Z con el encoder MPG2

# Configuro los ejes Y y Z en speed mode (pág. 113 protocol specification) 
#Axis options
#   aoENABLED		=(1&lt;&lt;0),(si 0&lt;&lt;0 aoDISABLED????)
#   aoINVERTED 	= (1&lt;&lt;1),
#   aoINTERNAL_PLANNER 	= (1&lt;&lt;2),
#   aoPOSITION_MODE 	= (1&lt;&lt;3),(si 0&lt;&lt;3 aoSPEED_MODE????)
#   aoINVERTED_HOME 	= (1&lt;&lt;4), 
#   aoSOFT_LIMIT_ENABLED 	= (1&lt;&lt;5), 
#   aoFAST_OUTPUT 	= (1&lt;&lt;6),
#   aoENABLED_MASKED 	= (1&lt;&lt;7)
LOAD DL[4]# 00000100 &gt;&gt; 4 aoINTERNAL_PLANNER
STORE Bh0991#Axes configuration eje Y
STORE Bh0992#Axes configuration eje Z
LOAD DL[0]#Deshabilito el ejeX
STORE Bh0990#Axes configuration eje X

#¿¿¿¿CREO QUE ESTO AQUI NO HACE FALTA, YA QUE NUNCA ENTRO EN MPG POR EL EJE Z????????
#Cada vez que entro en este módulo cargo en los encoder los valores que tenía guardados en las variables tmpENC1 y tmpENC2X o tmpENC2Z....
#LOAD tmpRestaurarValoresUnaVez#Leo la bandera que señaliza que solo he restaurado los valores en los encoder una vez...
#CMPEQ bL[0].0#...y lo comparo con 0 (siempre es 0 al arrancar la máquina). Si es igual que 0...
#JMPT EjecutoRestaurarValoresUnaVez#...quiere decir que es la primera vez que resstauro los valores en los encoder.... 

#Si vengo del EJE X restauro los valores guardados en tmpENC2Z al encoder MPG2
LOAD tmpCambioEjeZ
CMPEQ bL[0].0#Lo comparo con 0
JMPT EjecutoCambioEjeZ



LOAD bL[0].0
STORE tmpCambioEjeX

JMP EndCheckMPG
#...................................Si el pulsador es 1 ( no pulsado) SALGO DEL MODO TRABAJO DEL EJE Z......................................
ComparoPulsEncMPG1:
#LOAD  bL[0].0 
#STORE tmpEJEZ #Señalizo que NO estoy en el ejeZ
#LOAD  bL[0].0 
#STORE tmpEJEX #Señalizo que NO estoy en el ejeX
#...DESHABILITO LOS EJES Y LOS ENCODER...
LOAD DL[0]
STORE Bh09A8#MPG jog encoder setup EJE X
STORE Bh09A9#MPG jog encoder setup EJE Y
STORE Bh09AA#MPG jog encoder setup EJE Z
STORE Bh0990#Axes configuration eje X
STORE Bh0991#Axes configuration eje Y
STORE Bh0992#Axes configuration eje Z

# Configuro el estado del  pulse engine
LOAD DL[0] # 0 = peSTOPPED (pág 103 protocol specification)
STORE Bh0980# 0x0980   Pulse engine state


#Seteo el encoder 3 a la posición 1 para que al regresar esté en modo 2 (MPG)
LOAD BL[1]
STORE Dh0208#Es lo mismo que STORE D520. Posición de memoria del encoder 3

#Configuro el  enable...
LOAD  b!L[0].0#&lt;&gt;1
STORE EnSELMPG
LOAD  bL[0].0#&lt;&gt;0
STORE tmpRestaurarValoresUnaVez


#...guardo la posicion actual de los encoder 1 y 2Z
JMP EjecutoCambioEjeX
#JMP EndCheckMPG

#------------------------------------Si el encoder es 1 (estoy seleccionando el eje X)...-------------------------------------------
ComparoValEncMPG1:
CMPEQ BL[1]#Comparo el valor del encoder con 1...
JMPF ComparoValEncMPG2 #Si el encoder no es 1, salto a la siguiente comparación...
LOAD PulsEncMPG#Leo el valor del pulsador 
CMPEQ b!L[0].0#Lo comparo con 1
JMPT ComparoPulsEncMPG2#Si el pulsador es 1 (es decir, si NO he pulsado el botón del encoder), salto a ComparoPulsEncMPG2
#............................Si el pulsador es 0 (pulsado) ENTRO EN EL MODO TRABAJO EJE X.................................
LOAD  b!L[0].0 
STORE tmpEJEX #Señalizo que estoy en el ejeX
LOAD  bL[0].0 
STORE tmpEJEZ #Señalizo que NO estoy en el ejeZ

#Muestro la pantalla del LCD 12: Menú de trabajo MODO MPG EJE X
LOAD BL[12]
STORE LytLCDMPG

#Configuro el  enable...
LOAD  bL[0].0#&lt;&gt;0
STORE EnSELMPG

#Configuro los ejes con los encoder correspondientes
LOAD DL[2]#MPG 2
STORE Bh09A8#EJE X con el encoder MPG2
LOAD DL[1]#MPG 1
STORE Bh09A9#EJE Y con el encoder MPG1
LOAD DL[0]
STORE Bh09AA#EJE Z sin encoder

# Configuro los ejes Y y Z en speed mode (pág. 113 protocol specification) 
#Axis options
#   aoENABLED		=(1&lt;&lt;0),(si 0&lt;&lt;0 aoDISABLED????)
#   aoINVERTED 	= (1&lt;&lt;1),
#   aoINTERNAL_PLANNER 	= (1&lt;&lt;2),
#   aoPOSITION_MODE 	= (1&lt;&lt;3),(si 0&lt;&lt;3 aoSPEED_MODE????)
#   aoINVERTED_HOME 	= (1&lt;&lt;4), 
#   aoSOFT_LIMIT_ENABLED 	= (1&lt;&lt;5), 
#   aoFAST_OUTPUT 	= (1&lt;&lt;6),
#   aoENABLED_MASKED 	= (1&lt;&lt;7)
LOAD DL[4]# 00000100 &gt;&gt; 4 aoINTERNAL_PLANNER
STORE Bh0990#Axes configuration eje X
STORE Bh0991#Axes configuration eje Y
LOAD DL[0]#Deshabilito el eje Z
STORE Bh0992#Axes configuration eje Z

# Configuro el estado del  pulse engine
#LOAD DL[10] # 10 = peJOGGING (pág 103 protocol specification)
#STORE Bh0980# 0x0980   Pulse engine state

#Cada vez que entro en este módulo por primera vez cargo en los encoder los valores que tenía guardados en las variables tmpENC1 y tmpENC2X o tmpENC2Z....
LOAD tmpRestaurarValoresUnaVez#Leo la bandera que señaliza que solo he restaurado los valores en los encoder una vez...
CMPEQ bL[0].0#...y lo comparo con 0 (siempre es 0 al arrancar la máquina). Si es igual que 0...
JMPT EjecutoRestaurarValoresUnaVez#...quiere decir que es la primera vez que resstauro los valores en los encoder....

#Si vengo del eje Ztransfiero los valores guardados al encoder 2 cuando cambio del eje Z al X
LOAD tmpCambioEjeX
CMPEQ bL[0].0#Lo comparo con 0
JMPT EjecutoCambioEjeX

LOAD bL[0].0
STORE tmpCambioEjeZ

JMP EndCheckMPG
#.....................................Si el pulsador es 1 (no pulsado) SALGO DEL MODO TRABAJO DEL EJE X.......................................
ComparoPulsEncMPG2:
#LOAD  bL[0].0 
#STORE tmpEJEZ #Señalizo que NO estoy en el ejeZ
#LOAD  bL[0].0 
#STORE tmpEJEX #Señalizo que NO estoy en el ejeX
#...DESHABILITO LOS EJES Y LOS ENCODER...
LOAD DL[0]
STORE Bh09A8#MPG jog encoder setup EJE X
STORE Bh09A9#MPG jog encoder setup EJE Y
STORE Bh09AA#MPG jog encoder setup EJE Z
STORE Bh0990#Axes configuration eje X
STORE Bh0991#Axes configuration eje Y
STORE Bh0992#Axes configuration eje Z

# Configuro el estado del  pulse engine
LOAD DL[0] # 0 = peSTOPPED (pág 103 protocol specification)
STORE Bh0980# 0x0980   Pulse engine state

#...guardo las posiciones de los encoder 
LOAD   Dh0200 
STORE tmpENC1
LOAD   Dh0204 
STORE tmpENC2X

#Seteo el encoder 3 a la posición1 para que al regresar esté en modo 2 (MPG)
LOAD BL[1]
STORE Dh0208#Es lo mismo que STORE D520. Posición de memoria del encoder 3

#Configuro el  enable...
LOAD  b!L[0].0#&lt;&gt;1
STORE EnSELMPG

#Al salir preparo la variable tmpRestaurarValoresUnaVez para que cuando entre de nuevo se ejecute la restauración de los encoder
LOAD  bL[0].0#&lt;&gt;0
STORE tmpRestaurarValoresUnaVez



JMP EndCheckMPG

#------------------------------------Si el valor del encoder 3 es 2 ---------------------------------------------------------------------------------
ComparoValEncMPG2:
CMPEQ BL[2]#Si el encoder es igual que 2...
JMPF ComparoValEncMPG3#Si el encoder no es igual 3, salto a la siguiente comparación
LOAD BL[0]#...lo convierto en 0.
STORE Dh0208#Es lo mismo que STORE D520. Posición de memoria del encoder 3
JMP EndCheckMPG

#------------------------------------Si el valor del encoder 3 es menor que 0---------------------------------------------------------------------
ComparoValEncMPG3:
CMPLT BL[0]#Si el encoder es menor que 0...
LOAD BL[1]#...lo convierto en 1.
STORE Dh0208#Es lo mismo que STORE D520. Posición de memoria del encoder 3
JMP EndCheckMPG

#********************************RUTINA A EJECUTAR EN ESTOP************************************
EjecutoeStopMPG:
LOAD BL[0]#Muestro la pantalla del LCD 0
STORE LytLCDMPG
#...DESHABILITO LOS EJES Y LOS ENCODER...
LOAD DL[0]
STORE Bh09A8#MPG jog encoder setup EJE X
STORE Bh09A9#MPG jog encoder setup EJE Y
STORE Bh09AA#MPG jog encoder setup EJE Z
STORE Bh0990#Axes configuration eje X
STORE Bh0991#Axes configuration eje Y
STORE Bh0992#Axes configuration eje Z

# Switch to pulse engine state 0
LOAD DL[101] # 101 = peSTOP_EMERGENCY (pág 103 protocol specification)
STORE Bh0980# 0x0980   Pulse engine state

LOAD  bL[0].0#&lt;&gt;0
STORE tmpRestaurarValoresUnaVez

LOAD b!L[0].0
STORE tmpCambioEjeX
STORE tmpCambioEjeZ

#Cada vez que entro en este módulo guardo los valores de los encoder en en las variables tmpENC1 y tmpENC2X o tmpENC2Z....
LOAD tmpGuardarValoresUnaVez#Leo la bandera que señaliza que solo he gaurdado los valores de los encoder una vez...
CMPEQ bL[0].0#...y lo comparo con 0 (siempre es 0 al arrancar la máquina). Si es igual que 0...
JMPT EjecutoGuardarValoresUnaVez#...quiere decir que es la primera vez que guardo los valores de los encoder....

JMP EndCheckMPG

EjecutoCambioEjeX:
LOAD   Dh0200 
STORE tmpENC1
#Transfiero al encoder 2 el valor que tenía anteriormente cuando estuvo asignado en el eje X
#1º Cargo el valor actual del encoder estando en el eje Z
LOAD  Dh0204
STORE tmpENC2Z
#2º Cargo el valor que tengo almacenado a la salida de &quot;MPG2 en Z&quot; en la entrada del encoder 2
LOAD tmpENC2X
STORE Dh0204#Es lo mismo que STORE D516. Posición de memoria del encoder 2
LOAD bL[0].0
STORE tmpCambioEjeZ
LOAD b!L[0].0
STORE tmpCambioEjeX
JMP EndCheckMPG

EjecutoCambioEjeZ:
LOAD   Dh0200 
STORE tmpENC1
#Transfiero al encoder 2 el valor que tenía anteriormente cuando estuvo asignado en el eje Z
#1º Cargo el valor actual del encoder estando en el eje X
LOAD Dh0204
STORE tmpENC2X
#2º Cargo el valor que tengo almacenado a la salida de &quot;MPG2 en X&quot; en la entrada del encoder 2
LOAD tmpENC2Z
STORE Dh0204#Es lo mismo que STORE D516 &lt;&gt;  Posición de memoria del encoder 2 
LOAD bL[0].0
STORE tmpCambioEjeX
LOAD b!L[0].0
STORE tmpCambioEjeZ
JMP EndCheckMPG

#Función para guardar los valores de los encoder en  tmpENC1 y tmpENC2X o tmpENC2Z... 
EjecutoGuardarValoresUnaVez:
#Señalizo que ha he entrado aquí para que solo se ejecute una vez
LOAD  b!L[0].0#&lt;&gt;1
STORE tmpGuardarValoresUnaVez
#...guardo la posicion del encoder 1 en la variable tmpENC1 y del encoder 2 en la variable correspondiente al eje
LOAD   Dh0200
STORE tmpENC1
LOAD tmpEJEX 
CMPEQ b!L[0].0#Si estaba en el ejeX al pulsar eStop
JMPF GuardoEncoder2entmpENC2Z
LOAD tmpEJEZ 
CMPEQ b!L[0].0#Si estaba en el ejeZ al pulsar eStop
JMPF GuardoEncoder2entmpENC2X

#Función para restaruar los valores de los encoder desde los valores guardados en  tmpENC1 y tmpENC2X o tmpENC2Z... 
EjecutoRestaurarValoresUnaVez:
# Configuro el estado del  pulse engine
LOAD DL[0] # 0 = peSTOPPED (pág 103 protocol specification)
STORE Bh0980# 0x0980   Pulse engine state
#Señalizo que ha he entrado aquí para que solo se ejecute una vez
LOAD  b!L[0].0#&lt;&gt;1
STORE tmpRestaurarValoresUnaVez
#Cargo en los encoder los valores que tenía guardados en las variables tmpENC1 y tmpENC2X o tmpENC2Z....
LOAD  tmpENC1
STORE Dh0200#...cargo el valor del encoder 1(ejeY) que guardé en tmpENC1.
LOAD tmpEJEX 
CMPEQ b!L[0].0#Si estaba en el ejeX al pulsar eStop
JMPT GuardotmpENC2XenEncoder2
LOAD tmpEJEZ 
CMPEQ b!L[0].0#Si estaba en el ejeZ al pulsar eStop
JMPT GuardotmpENC2ZenEncoder2

GuardotmpENC2XenEncoder2:
LOAD tmpENC2X
STORE Dh0204
# Configuro el estado del  pulse engine
LOAD DL[10] # 10 = peJOGGING (pág 103 protocol specification)
STORE Bh0980# 0x0980   Pulse engine state
JMP EndCheckMPG#JMP RegresoRestaurarValoresUnaVez

GuardotmpENC2ZenEncoder2:
LOAD  tmpENC2Z
STORE Dh0204 
# Configuro el estado del  pulse engine
LOAD DL[10] # 10 = peJOGGING (pág 103 protocol specification)
STORE Bh0980# 0x0980   Pulse engine state
JMP EndCheckMPG#JMP RegresoRestaurarValoresUnaVez

GuardoEncoder2entmpENC2X:
LOAD Dh0204
STORE  tmpENC2X
JMP EndCheckMPG

GuardoEncoder2entmpENC2Z:
LOAD Dh0204
STORE  tmpENC2Z
JMP EndCheckMPG

EndCheckMPG:
_DisableMPG:</hideCode>
        </block>
        <block ID="39" type="962" position="1560/130">
            <Name>Select Layout LCD</Name>
            <Inputs>6</Inputs>
        </block>
        <block ID="40" type="202" position="1740/380">
            <Name>OR</Name>
            <Show_negated_output>false</Show_negated_output>
            <Inputs>3</Inputs>
        </block>
        <block ID="41" type="107" position="1830/360">
            <Name>1 T delay</Name>
            <Default_value>0</Default_value>
        </block>
        <block ID="42" type="500" position="1560/400">
            <Name>Rising edge MPG</Name>
        </block>
        <block ID="43" type="500" position="1480/380">
            <Name>Rising edge AUTO</Name>
        </block>
        <block ID="44" type="351" position="390/920">
            <Name>DIST_X</Name>
            <Function_f>5</Function_f>
        </block>
        <block ID="45" type="351" position="510/1220">
            <Name>DIST_Y</Name>
            <Function_f>5</Function_f>
        </block>
        <block ID="46" type="351" position="510/1360">
            <Name>DIST_Z</Name>
            <Function_f>5</Function_f>
        </block>
        <block ID="47" type="1100" position="1410/1020">
            <Name>Custom PoIL</Name>
            <hideInputs>1</hideInputs>
            <hideOutputs>1</hideOutputs>
            <hideMemory_bits>1</hideMemory_bits>
            <hideMemory_int8>0</hideMemory_int8>
            <hideMemory_int16>0</hideMemory_int16>
            <hideMemory_int32>0</hideMemory_int32>
            <hideVariables>in1 : INPUT(1,bit)



out1 : OUTPUT(1,bit)


tmp : bit</hideVariables>
            <hideCode>
LOAD in1
CMPEQ b!L[0].0#&lt;&gt;1
JMPT Test1

LOAD  bL[0].0#&lt;&gt;0
STORE out1
JMP EndTest1


Test1:
LOAD  b!L[0].0#&lt;&gt;1
STORE out1
JMP EndTest1



EndTest1:
</hideCode>
        </block>
        <block ID="48" type="108" position="1300/1020">
            <Name>JOG ON-OFF</Name>
            <Default_value>false</Default_value>
            <Retain_on_reset>false</Retain_on_reset>
            <Initial_value>false</Initial_value>
        </block>
        <block ID="49" type="108" position="1300/990">
            <Name>MIST</Name>
            <Default_value>false</Default_value>
            <Retain_on_reset>false</Retain_on_reset>
            <Initial_value>false</Initial_value>
        </block>
        <block ID="50" type="108" position="1300/1110">
            <Name>COOLANT</Name>
            <Default_value>false</Default_value>
            <Retain_on_reset>false</Retain_on_reset>
            <Initial_value>false</Initial_value>
        </block>
        <block ID="51" type="1100" position="1410/990">
            <Name>Custom PoIL</Name>
            <hideInputs>1</hideInputs>
            <hideOutputs>1</hideOutputs>
            <hideMemory_bits>1</hideMemory_bits>
            <hideMemory_int8>0</hideMemory_int8>
            <hideMemory_int16>0</hideMemory_int16>
            <hideMemory_int32>0</hideMemory_int32>
            <hideVariables>in2 : INPUT(1,bit)



out2 : OUTPUT(1,bit)


tmp : bit</hideVariables>
            <hideCode>
LOAD in2
CMPEQ b!L[0].0#&lt;&gt;1
JMPT Test2

LOAD  bL[0].0#&lt;&gt;0
STORE out2
JMP EndTest2


Test2:
LOAD  b!L[0].0#&lt;&gt;1
STORE out2
JMP EndTest2



EndTest2:
</hideCode>
        </block>
        <block ID="52" type="1100" position="1410/1110">
            <Name>Custom PoIL</Name>
            <hideInputs>1</hideInputs>
            <hideOutputs>1</hideOutputs>
            <hideMemory_bits>1</hideMemory_bits>
            <hideMemory_int8>0</hideMemory_int8>
            <hideMemory_int16>0</hideMemory_int16>
            <hideMemory_int32>0</hideMemory_int32>
            <hideVariables>in3 : INPUT(1,bit)



out3 : OUTPUT(1,bit)


tmp : bit</hideVariables>
            <hideCode>
LOAD in3
CMPEQ b!L[0].0#&lt;&gt;1
JMPT Test3

LOAD  bL[0].0#&lt;&gt;0
STORE out3
JMP EndTest3


Test3:
LOAD  b!L[0].0#&lt;&gt;1
STORE out3
JMP EndTest3



EndTest3:
</hideCode>
        </block>
        <block ID="53" type="1000" position="90/310">
            <Name>Comment</Name>
            <Comment>Pulsador encoder 3.</Comment>
        </block>
        <block ID="54" type="108" position="1000/610">
            <Name>Shared 1-bit</Name>
            <Default_value>false</Default_value>
            <Retain_on_reset>false</Retain_on_reset>
            <Initial_value>false</Initial_value>
        </block>
        <block ID="55" type="1" position="1200/610">
            <Name>Digital output</Name>
            <Pin_ID>43</Pin_ID>
            <Init_function>true</Init_function>
            <Inverted>false</Inverted>
            <Default_value>false</Default_value>
            <Set_to_default_on_init>true</Set_to_default_on_init>
            <Show_enable_input>false</Show_enable_input>
        </block>
        <block ID="56" type="555" position="1000/680">
            <Name>Clock source</Name>
            <Half_time_m_period>200</Half_time_m_period>
            <Show_dynamic_input>false</Show_dynamic_input>
        </block>
        <block ID="57" type="105" position="1110/670">
            <Name>T flip-flop</Name>
            <Default_value>false</Default_value>
            <Retain_on_reset>false</Retain_on_reset>
            <Initial_value>false</Initial_value>
        </block>
        <block ID="58" type="1000" position="970/660">
            <Name>Comment</Name>
            <Comment>1 HABILITA FLIPFLOP, 0 LO PARA</Comment>
        </block>
    </Blocks>
    <Links>
        <link ID="0">
            <source type="port" blockID="3" portID="0"/>
            <destination blockID="4" portID="0"/>
            <anchors/>
        </link>
        <link ID="1">
            <source type="port" blockID="1" portID="0"/>
            <destination blockID="6" portID="0"/>
            <anchors/>
        </link>
        <link ID="2">
            <source type="port" blockID="6" portID="0"/>
            <destination blockID="3" portID="0"/>
            <anchors>
                <anchor ID="0" position="1390/950"/>
                <anchor ID="1" position="1460/970"/>
            </anchors>
        </link>
        <link ID="3">
            <source type="port" blockID="14" portID="0"/>
            <destination blockID="16" portID="0"/>
            <anchors>
                <anchor ID="0" position="1280/880"/>
            </anchors>
        </link>
        <link ID="4">
            <source type="port" blockID="16" portID="0"/>
            <destination blockID="15" portID="0"/>
            <anchors>
                <anchor ID="0" position="1500/880"/>
            </anchors>
        </link>
        <link ID="5">
            <source type="port" blockID="20" portID="0"/>
            <destination blockID="17" portID="1"/>
            <anchors>
                <anchor ID="0" position="1090/1480"/>
                <anchor ID="1" position="1140/1480"/>
                <anchor ID="2" position="1150/1480"/>
                <anchor ID="3" position="1220/1480"/>
            </anchors>
        </link>
        <link ID="6">
            <source type="link" linkID="2" anchorID="0"/>
            <destination blockID="15" portID="1"/>
            <anchors>
                <anchor ID="0" position="1460/900"/>
            </anchors>
        </link>
        <link ID="7">
            <source type="port" blockID="33" portID="0"/>
            <destination blockID="17" portID="0"/>
            <anchors/>
        </link>
        <link ID="8">
            <source type="port" blockID="28" portID="0"/>
            <destination blockID="32" portID="0"/>
            <anchors>
                <anchor ID="0" position="360/300"/>
                <anchor ID="1" position="400/230"/>
                <anchor ID="2" position="400/110"/>
                <anchor ID="3" position="450/70"/>
            </anchors>
        </link>
        <link ID="9">
            <source type="port" blockID="35" portID="0"/>
            <destination blockID="34" portID="1"/>
            <anchors/>
        </link>
        <link ID="10">
            <source type="port" blockID="34" portID="0"/>
            <destination blockID="32" portID="1"/>
            <anchors>
                <anchor ID="0" position="360/320"/>
                <anchor ID="1" position="420/280"/>
                <anchor ID="2" position="420/130"/>
                <anchor ID="3" position="460/90"/>
            </anchors>
        </link>
        <link ID="11">
            <source type="link" linkID="10" anchorID="0"/>
            <destination blockID="38" portID="1"/>
            <anchors>
                <anchor ID="0" position="740/320"/>
                <anchor ID="1" position="790/320"/>
                <anchor ID="2" position="840/320"/>
                <anchor ID="3" position="940/320"/>
                <anchor ID="4" position="970/320"/>
            </anchors>
        </link>
        <link ID="12">
            <source type="port" blockID="39" portID="0"/>
            <destination blockID="36" portID="0"/>
            <anchors/>
        </link>
        <link ID="13">
            <source type="port" blockID="37" portID="0"/>
            <destination blockID="39" portID="2"/>
            <anchors/>
        </link>
        <link ID="14">
            <source type="port" blockID="38" portID="0"/>
            <destination blockID="39" portID="3"/>
            <anchors>
                <anchor ID="0" position="1230/300"/>
                <anchor ID="1" position="1270/250"/>
                <anchor ID="2" position="1270/170"/>
                <anchor ID="3" position="1320/130"/>
            </anchors>
        </link>
        <link ID="15">
            <source type="port" blockID="32" portID="2"/>
            <destination blockID="37" portID="2"/>
            <anchors>
                <anchor ID="0" position="740/110"/>
                <anchor ID="1" position="790/150"/>
                <anchor ID="2" position="840/150"/>
                <anchor ID="3" position="890/150"/>
                <anchor ID="4" position="980/150"/>
            </anchors>
        </link>
        <link ID="16">
            <source type="port" blockID="32" portID="3"/>
            <destination blockID="38" portID="2"/>
            <anchors>
                <anchor ID="0" position="710/130"/>
                <anchor ID="1" position="750/170"/>
                <anchor ID="2" position="750/300"/>
                <anchor ID="3" position="790/340"/>
                <anchor ID="4" position="990/340"/>
                <anchor ID="5" position="1010/340"/>
            </anchors>
        </link>
        <link ID="17">
            <source type="port" blockID="32" portID="1"/>
            <destination blockID="39" portID="1"/>
            <anchors/>
        </link>
        <link ID="18">
            <source type="port" blockID="32" portID="0"/>
            <destination blockID="39" portID="0"/>
            <anchors/>
        </link>
        <link ID="19">
            <source type="link" linkID="11" anchorID="0"/>
            <destination blockID="37" portID="1"/>
            <anchors>
                <anchor ID="0" position="810/260"/>
                <anchor ID="1" position="810/180"/>
                <anchor ID="2" position="850/130"/>
            </anchors>
        </link>
        <link ID="20">
            <source type="link" linkID="8" anchorID="0"/>
            <destination blockID="38" portID="0"/>
            <anchors>
                <anchor ID="0" position="740/300"/>
                <anchor ID="1" position="810/300"/>
                <anchor ID="2" position="860/300"/>
                <anchor ID="3" position="950/300"/>
                <anchor ID="4" position="980/300"/>
            </anchors>
        </link>
        <link ID="21">
            <source type="link" linkID="20" anchorID="0"/>
            <destination blockID="37" portID="0"/>
            <anchors>
                <anchor ID="0" position="790/240"/>
                <anchor ID="1" position="790/150"/>
                <anchor ID="2" position="840/110"/>
            </anchors>
        </link>
        <link ID="22">
            <source type="port" blockID="40" portID="0"/>
            <destination blockID="41" portID="0"/>
            <anchors/>
        </link>
        <link ID="23">
            <source type="port" blockID="41" portID="0"/>
            <destination blockID="32" portID="3"/>
            <anchors>
                <anchor ID="0" position="1930/400"/>
                <anchor ID="1" position="1930/790"/>
                <anchor ID="2" position="1870/830"/>
                <anchor ID="3" position="500/840"/>
                <anchor ID="4" position="460/800"/>
                <anchor ID="5" position="460/180"/>
                <anchor ID="6" position="500/130"/>
            </anchors>
        </link>
        <link ID="24">
            <source type="port" blockID="32" portID="6"/>
            <destination blockID="40" portID="0"/>
            <anchors>
                <anchor ID="0" position="650/190"/>
                <anchor ID="1" position="690/230"/>
                <anchor ID="2" position="690/410"/>
                <anchor ID="3" position="730/450"/>
                <anchor ID="4" position="1120/450"/>
                <anchor ID="5" position="1230/450"/>
                <anchor ID="6" position="1280/360"/>
            </anchors>
        </link>
        <link ID="25">
            <source type="port" blockID="38" portID="1"/>
            <destination blockID="42" portID="0"/>
            <anchors>
                <anchor ID="0" position="1190/320"/>
                <anchor ID="1" position="1230/360"/>
                <anchor ID="2" position="1270/400"/>
            </anchors>
        </link>
        <link ID="26">
            <source type="port" blockID="37" portID="1"/>
            <destination blockID="43" portID="0"/>
            <anchors>
                <anchor ID="0" position="1210/130"/>
                <anchor ID="1" position="1250/180"/>
                <anchor ID="2" position="1250/330"/>
                <anchor ID="3" position="1290/380"/>
            </anchors>
        </link>
        <link ID="27">
            <source type="port" blockID="27" portID="0"/>
            <destination blockID="32" portID="2"/>
            <anchors>
                <anchor ID="0" position="350/340"/>
                <anchor ID="1" position="400/340"/>
                <anchor ID="2" position="440/280"/>
                <anchor ID="3" position="440/150"/>
                <anchor ID="4" position="490/110"/>
            </anchors>
        </link>
        <link ID="28">
            <source type="link" linkID="27" anchorID="1"/>
            <destination blockID="38" portID="3"/>
            <anchors>
                <anchor ID="0" position="590/340"/>
                <anchor ID="1" position="640/380"/>
                <anchor ID="2" position="770/380"/>
                <anchor ID="3" position="830/380"/>
                <anchor ID="4" position="880/380"/>
                <anchor ID="5" position="920/380"/>
                <anchor ID="6" position="970/360"/>
            </anchors>
        </link>
        <link ID="29">
            <source type="link" linkID="28" anchorID="4"/>
            <destination blockID="37" portID="3"/>
            <anchors>
                <anchor ID="0" position="930/320"/>
                <anchor ID="1" position="930/210"/>
                <anchor ID="2" position="980/170"/>
            </anchors>
        </link>
        <link ID="30">
            <source type="port" blockID="0" portID="0"/>
            <destination blockID="35" portID="0"/>
            <anchors/>
        </link>
        <link ID="31">
            <source type="port" blockID="2" portID="0"/>
            <destination blockID="26" portID="0"/>
            <anchors>
                <anchor ID="0" position="250/520"/>
            </anchors>
        </link>
        <link ID="32">
            <source type="link" linkID="31" anchorID="0"/>
            <destination blockID="25" portID="0"/>
            <anchors/>
        </link>
        <link ID="33">
            <source type="port" blockID="21" portID="0"/>
            <destination blockID="44" portID="0"/>
            <anchors/>
        </link>
        <link ID="34">
            <source type="port" blockID="21" portID="1"/>
            <destination blockID="45" portID="0"/>
            <anchors>
                <anchor ID="0" position="300/970"/>
                <anchor ID="1" position="300/1160"/>
                <anchor ID="2" position="340/1210"/>
            </anchors>
        </link>
        <link ID="35">
            <source type="port" blockID="21" portID="2"/>
            <destination blockID="46" portID="0"/>
            <anchors>
                <anchor ID="0" position="280/1000"/>
                <anchor ID="1" position="280/1310"/>
                <anchor ID="2" position="330/1350"/>
            </anchors>
        </link>
        <link ID="36">
            <source type="port" blockID="48" portID="0"/>
            <destination blockID="47" portID="0"/>
            <anchors/>
        </link>
        <link ID="37">
            <source type="port" blockID="47" portID="0"/>
            <destination blockID="3" portID="2"/>
            <anchors/>
        </link>
        <link ID="38">
            <source type="port" blockID="49" portID="0"/>
            <destination blockID="51" portID="0"/>
            <anchors/>
        </link>
        <link ID="39">
            <source type="port" blockID="51" portID="0"/>
            <destination blockID="3" portID="1"/>
            <anchors/>
        </link>
        <link ID="40">
            <source type="port" blockID="50" portID="0"/>
            <destination blockID="52" portID="0"/>
            <anchors/>
        </link>
        <link ID="41">
            <source type="port" blockID="52" portID="0"/>
            <destination blockID="3" portID="7"/>
            <anchors/>
        </link>
        <link ID="42">
            <source type="port" blockID="42" portID="0"/>
            <destination blockID="40" portID="2"/>
            <anchors/>
        </link>
        <link ID="43">
            <source type="port" blockID="43" portID="0"/>
            <destination blockID="40" portID="1"/>
            <anchors/>
        </link>
        <link ID="44">
            <source type="port" blockID="54" portID="0"/>
            <destination blockID="55" portID="0"/>
            <anchors/>
        </link>
        <link ID="45">
            <source type="port" blockID="56" portID="0"/>
            <destination blockID="57" portID="1"/>
            <anchors/>
        </link>
    </Links>
    <Constants>
        <constant blockID="3" portID="3" value="0" valueF="0"/>
        <constant blockID="3" portID="4" value="0" valueF="0"/>
        <constant blockID="3" portID="5" value="0" valueF="0"/>
        <constant blockID="3" portID="6" value="0" valueF="0"/>
        <constant blockID="18" portID="0" value="5" valueF="0"/>
        <constant blockID="19" portID="0" value="25" valueF="0"/>
        <constant blockID="34" portID="0" value="1" valueF="0"/>
        <constant blockID="44" portID="1" value="0" valueF="250"/>
        <constant blockID="45" portID="1" value="0" valueF="325"/>
        <constant blockID="46" portID="1" value="0" valueF="320"/>
        <constant blockID="57" portID="0" value="1" valueF="0"/>
    </Constants>
    <Shared>
        <slot id="0" rights="3" blockID="57" portID="0"/>
        <slot id="21" rights="3" blockID="48" portID="0"/>
        <slot id="22" rights="3" blockID="49" portID="0"/>
        <slot id="23" rights="3" blockID="50" portID="0"/>
        <slot id="24" rights="3" blockID="54" portID="0"/>
    </Shared>
</PoBlocks>
