I have a generic service running reading a parameter. It can read the parameter once, then it won't go again because the 'IF xDone then' runs which makes it finish the sub routine. I need to do a cold reset to get it to work again.
I found a reset() function which seams to do nothing. The documentation says:
Zitat:
This function block is used for calling the reset service of a specific instance of a CIP object. The exact effect of this service depends on the CIP object (refer to the CIP specifications (Vol. 1 and 2). This instance call resets the DEVICE_123_ETHERNET device as soon as xExecute yields TRUE:
Thanks
Sub routine:
IFExecuteTHEN
  Done            :=FALSE;
  Read_Parameter_TxData[17]  :=DriveAddress;
  Read_Parameter_TxData[10]  :=WORD_TO_BYTE(ParameterNumber);
  Read_Parameter_TxData[11]  :=WORD_TO_BYTE(SHR(ParameterNumber,8));
  Read_Parameter(
    itfEtherNetIPDevice    :=EthernetAdapter,
    eClass          :=Read_Parameter_Class,
    dwInstance        :=Read_Parameter_Instance,
    wAttribute        :=Read_Parameter_Attribute,
    eService        :=Read_Parameter_Serv,
    pWriteData        :=ADR(Read_Parameter_TxData[0]),
    udiWriteDataSize    :=SIZEOF(Read_Parameter_TxData),
    pReadData        :=ADR(Read_Parameter_RxData[0]),
    udiReadDataSize      :=SIZEOF(Read_Parameter_RxData),
    xExecute        :=TRUE,
  );
  counter:=1;END_IFIFRead_Parameter.xDoneTHEN
  returnValue    :=  SHL(BYTE_TO_WORD(Read_Parameter_RxData[1]),8)+Read_Parameter_RxData[0];
  Execute      :=   FALSE;
  Done      :=  TRUE;
  counter      :=  0;
  Read_Parameter.xExecute :=FALSE;END_IFIFcounter=2THEN
  Execute:=TRUE;
  counter:=0;END_IFIFRead_Parameter.xErrorANDcounter=1THEN
  ErrorEnum :=Read_Parameter.eError;
  Execute  :=   FALSE;
  counter :=2;
  Read_Parameter.xExecute :=FALSE;END_IFError:=Read_Parameter.xError;
Main:
IFIDL_ReadBoolTHEN
      IFRParmEIP.ErrorTHEN
        RParmEIP();
      ELSE
      RParmEIP(
        EthernetAdapter   :=OPC_2_ETHIG_IN,
        ParameterNumber :=IDL_ReadP-1,
        Execute      :=TRUE,
      );
      END_IF
    END_IF
    IFRParmEIP.DoneTHEN
      IDL_ReadBool  :=FALSE;
      IDL_ReadVal    :=RParmEIP.returnValue;
      RParmEIP();
    END_IF
If you don't call your FB "Read_Parameter", how should xDone (FB output) come to false ?
Your FB should be called at every cycle.
exemple, slightly edited to auto cycle com requests
Read_Parameter_TxData[17]Â Â :=DriveAddress;Read_Parameter_TxData[10]Â Â :=WORD_TO_BYTE(ParameterNumber);Read_Parameter_TxData[11]Â Â :=WORD_TO_BYTE(SHR(ParameterNumber,8));Read_Parameter(
 itfEtherNetIPDevice   :=EthernetAdapter,
 eClass        :=Read_Parameter_Class,
 dwInstance      :=Read_Parameter_Instance,
 wAttribute      :=Read_Parameter_Attribute,
 eService      :=Read_Parameter_Serv,
 pWriteData      :=ADR(Read_Parameter_TxData[0]),
 udiWriteDataSize   :=SIZEOF(Read_Parameter_TxData),
 pReadData      :=ADR(Read_Parameter_RxData[0]),
 udiReadDataSize     :=SIZEOF(Read_Parameter_RxData),
 xExecute      :=NOT(Read_Parameter.xErrorORRead_Parameter.xDone),
);IFRead_Parameter.xDoneTHEN
  returnValue   :=  SHL(BYTE_TO_WORD(Read_Parameter_RxData[1]),8)+Read_Parameter_RxData[0];END_IFIFRead_Parameter.xErrorTHEN
  ErrorEnum :=Read_Parameter.eError;END_IF
Hello
I have a generic service running reading a parameter. It can read the parameter once, then it won't go again because the 'IF xDone then' runs which makes it finish the sub routine. I need to do a cold reset to get it to work again.
I found a reset() function which seams to do nothing. The documentation says:
Thanks
Sub routine:
Main:
Related
Talk.ru: 1
Talk.ru: 11
If you don't call your FB "Read_Parameter", how should xDone (FB output) come to false ?
Your FB should be called at every cycle.
exemple, slightly edited to auto cycle com requests
Regards,
dFx
Related
Talk.ru: 1
Talk.ru: 11
Ah thanks, so glad it was that simple!