WAGO PFC200 SMS not working

damian177
2020-10-08
2020-10-13
  • damian177

    damian177 - 2020-10-08

    Hi,
    I used SMS in my WAGO 750-8207 PFC200 2ETH RS 3G with Firmware Revision: 03.01.07 (13) and runtime version: 3.5.15.0 . Everything was ok with SMS communication when I used old library to SMS. Since the old SMS library it stopped working and I had to install new library: CODESYS IIoT Libraries SL.
    It turned out there was no structure:
    comParam.ComParity: = SMS_RS232.COM_PARITY.NONE; ( No Parity )
    comParam.ComStopBit: = SMS_RS232.COM_STOPBIT.ONE; ( One stopbit )

    so I change this lines on:
    comParam.ComParity: = SMS.COM_PARITY.NONE; ( No Parity )
    comParam.ComStopBit: = SMS.COM_STOPBIT.ONE; ( One stopbit )

    but SMS communication doesn't work.
    What can be wrong? what could be different in this library?

     
  • damian177

    damian177 - 2020-10-11

    Probably I found problem . When I run my PLC in log i noticed that my library is not installed - like attachement "licencja.jpg"

     
    πŸ‘
    1
  • damian177

    damian177 - 2020-10-08

    What should I do now, what check? Someone test SMS communication in IIoT Libraries SL ?

     
  • damian177

    damian177 - 2020-10-08

    Please find in attachment my comport linux configuration . In Codesys should I use port number 5 or 4 ?
    (comParam.iPortNumber := 4)
    In old library I used port 4. But in the example to new library is 5 used. So ?

     
  • eschwellinger

    eschwellinger - 2020-10-08

    would try 4..

     
  • damian177

    damian177 - 2020-10-08

    I all the time try with 4- but doesn't work. and do not have any error.

     
  • damian177

    damian177 - 2020-10-09

    The receiving and deleting message works . I have a problem with sending message. It is a minimal time beetwen execute receive function and execute send function ?

     

    Last edit: damian177 2020-10-09
  • damian177

    damian177 - 2020-10-09

    It is my code:

    CODE
    reconnect_timepout(IN := (iState = 32767) , PT:=T#1M);
    
    IF  ModemFb.xError  THEN
        err_modem :=TRUE;
    ELSE
        err_modem :=FALSE;
    END_IF
    
    //init
    IF NOT xInit THEN
    xInit := TRUE; (* This values should be device specific adapted *)
    comParam.iPortNumber         := 4; (* used com port number 1 *) 
    comParam.ComParity           := SMS.COM_PARITY.NONE; (* No Parity *)
    comParam.ComStopBit          := SMS.COM_STOPBIT.ONE; (* One stopbit *)  
    comParam.dwBaudrate          := 9600; (* Baudrate of 9600 *)
    comParam.byByteSize          := 8; (* Byte size is 8 *)
        (* No hardware handshake is used. When the device needs hardware handshake and it is set to false, it can result in data loss.*)
    comParam.byHardwareHandshake := FALSE; 
    comParam.bySoftwareHandshake := FALSE; (* No software handshake is used. *)
    comConnect.COMParameter      := comParam; (* set the parameter to the instance of the function block *)
    ModemFb.itfConnectionType    := comConnect; (* set the connection instance to the modem, that it can connect to the physical device.*)
        //SendSmsFb.smsInfo.sServiceCenterNr := ''; 
        err_modem :=FALSE;
    
    
    END_IF
    
    
    CASE iState OF
    
        0: 
            ModemFb(xExecute := TRUE, sPin := scPin, udiTimeOut := 120000000);
            IF ModemFb.xDone THEN
                iState := 1;
            ELSIF ModemFb.xError THEN
                iState := 32767;
            END_IF
    
        1:  
            ReceiveSmsFb(xExecute:=TRUE, ModemFB := ModemFb, udiTimeOut := 10000000);
            IF ReceiveSmsFb.xDone OR ReceiveSmsFb.xError THEN smsrec := ReceiveSmsFb.smsRecv;
    
            ReceiveSmsFb(xExecute := FALSE, ModemFB := ModemFb);
            iState :=20;
             END_IF
    
    
    20:     
    
            IF Send_Message THEN
               iState := 200;
    
            ELSE IF smsrec.sText <> '' THEN       
                pt:=ADR(smsrec.sText); // Get the Address of the text variable 
                FOR i:=0 TO  LEN(smsrec.sText)  DO
                    char[i]:=pt^; // Assign the value of the pointer to a Character
                    pt:=pt+1; // Advance to the next pointer
                END_FOR
    iState :=21;
            ELSE 
    iState:=1;
            END_IF;
            END_IF;
    
    
    
    21:   
                IF smsrec.sNumber = 'XXXXXXXXX' THEN 
                    iState :=22;
                 ELSE
                    iState :=100;
            END_IF;
    
    
    22: 
           timestamp_hist_hi := time_sys.udiLocal_DateAndTime + timestamp_hist;
           timestamp_hist_lo := time_sys.udiLocal_DateAndTime - timestamp_hist;
           IF (DT_TO_UDINT(smsrec.dtSend) < timestamp_hist_lo) OR (DT_TO_UDINT(smsrec.dtSend) > timestamp_hist_hi) THEN
                   iState :=100;
           ELSE
                   iState :=23;
           END_IF
    
    
    
    23: IF smsrec.sText = 'ON1' THEN
            bool_out_sms:= 1;
            iState :=100;
        ELSE IF smsrec.sText = 'OFF1' THEN
                 bool_out_sms:= 0;
                 iState :=100;
        ELSE
             iState :=100;
        END_IF;
        END_IF;
    
    
    100:
    
    DeleteSmsFb(xExecute:=TRUE, ModemFB := ModemFb, sms := sms_sys.ReceiveSmsFb.smsRecv, udiTimeOut := 10000000);
             IF DeleteSmsFb.xDone OR DeleteSmsFb.xError THEN
                (* This will reset the function block and release the modem lock.*)
    DeleteSmsFb(xExecute := FALSE, ModemFB := sms_sys.ModemFb, sms := smsrec);
                //xExecute_Delete_trig:=FALSE;
    iState :=1;
             END_IF; 
    
    
    200:    
    
    SMS_to_send.sNumber := 'XXXXXXXXX';
                    Send_Message:=FALSE;
    SendSmsFb(xExecute:=TRUE, ModemFb := ModemFb, udiTimeOut := 10000000, smsInfo:= SMS_to_send);
                    IF SendSmsFb.xDone OR SendSmsFb.xError THEN
                        (* This will reset the function block and release the modem lock.*)
    SendSmsFb( xExecute := FALSE, ModemFb := ModemFb);
    iState:=1;
                        err_send := SendSmsFb.eError; 
                    END_IF  
    
    32767: (* error *) ;
    
            IF reconnect_timepout.Q THEN    
    xInit := FALSE;
    iState :=0;
            END_IF
    
    END_CASE
    
    
    
    RTRIG_LICZs1_SMS(CLK:= (time_sys.todNow = TOD#22:00:00 ) OR (time_sys.todNow = TOD#21:54:10 ));
    IF RTRIG_LICZs1_SMS.Q THEN
    
    
    zm_temp := CONCAT('With SMS ', 'everything' );
    zm_temp := CONCAT(zm_temp,' OK :)');
    SMS_to_send.sText :=  zm_temp;
        Send_Message :=TRUE;
    
    END_IF
    
     

    Last edit: damian177 2020-10-11
  • damian177

    damian177 - 2020-10-11

    Let's focus on receiving messages Can I perform the receive function every cycle?

     
  • damian177

    damian177 - 2020-10-11

    When I upload to PLC and Build->Clean all and RUN PLC. Everything works perfectly but after several minutes sms doesn't work. Without any error. What can be wrong ? Something with memory ? I should something cleaning ?

     

    Last edit: damian177 2020-10-11
  • damian177

    damian177 - 2020-10-11

    How it is possible ??? I have installed library - please find in attachement

     
  • eschwellinger

    eschwellinger - 2020-10-12

    Hi,
    all prodcuts which have the 'SL' (single license) in the product name need the license activation on plc side.(not on the CODESYS development system machine)

    So this license you need to activate in the PFC200, this screenshot is your CODESYS pc softcontainer?
    So please write to the CODESYS Store -> my question -> bug report - you need a remove ticket and a new ticket for your PFC200.

     
  • damian177

    damian177 - 2020-10-12

    Yes I have this license installed on Workstation->Softcontainer.

    When I remove license form Workstation it will be works ? When I did not have license in workstation I had many error during compilation my project.

     
  • eschwellinger

    eschwellinger - 2020-10-12

    Yes this will work...

     
  • damian177

    damian177 - 2020-10-13

    After install license SMS function not even initialization...:/

     

Log in to post a comment.