Menu

Siemens S7-200

Help
Clive
2015-07-28
2015-07-28
  • Clive

    Clive - 2015-07-28

    Hi

    I am new to libnodave library and siemens PLC. I have installed the library on a CentOS.

    To familiarize with this library I have tried the sample code provided testPPI.c on Netbeans IDE.It compiled without errors. I am using Siemens USB/PPI Multi-Master cable 6ES7 901-3DB30-0XA0 which when connect to USB port on my PC the LEDs blink momentarily twice and turn off.Then I use linux lsusb command to check if the cable has been detected and shows on terminal Siemens AG.

    When I debug the code the serial port is found but the function daveConnectPLC returns a value of (-1025) and then a timeout error is displayed. It seems that there is driver issue with the cable but not sure.

    Has someone encountered such problem ? How can I solve it ? Thanks. I tried alot without success.

    Following is the code I a trying.

    define LINUX

    include <stdlib.h></stdlib.h>

    include <stdio.h></stdio.h>

    include "nodave.h"

    include "nodave.c"

    include "setport.h"

    include "setport.c"

    int main(int argc, char **argv) {
    int a,b,c,
    res;
    float d;
    daveInterface * di;
    daveConnection * dc;
    _daveOSserialType fds;

    //if (-3<2) {
    

    // printf("Usage: testPPI serial port.\n");
    // exit(-1);
    //}

    fds.rfd=setPort("/dev/ttyS0","9600",'E');
    fds.wfd=fds.rfd;
    if (fds.rfd>0) { 
    di =daveNewInterface(fds, "IF1", 0, daveProtoPPI, daveSpeed9k);
    dc =daveNewConnection(di, 2, 0, 0);  
    daveConnectPLC(dc);
    printf("Trying to read 16 bytes from FW0.\n");
    res=daveReadBytes(dc,daveFlags,0,0,16,NULL);
    if (res==0) {
            a=daveGetU32(dc);
            b=daveGetU32(dc);
        c=daveGetU32(dc);
            d=daveGetFloat(dc);
        printf("FD0: %d\n",a);
        printf("FD4: %d\n",b);
        printf("FD8: %d\n",c);
        printf("FD12: %f\n",d);
    }
    
    return 0;
    } else {
    printf("Couldn't open serial port %s\n","testPPI"); 
    return -1;
    }
    

    }

     
    • Anonymous

      Anonymous - 2021-10-15
      Post awaiting moderation.
  • Anonymous

    Anonymous - 2017-07-12
    Post awaiting moderation.

Anonymous
Anonymous

Add attachments
Cancel