lijasmine
Member
I have installed libnodave-0.8.1 on RedHat 8 platform,beacuse I want to exchange data with siemens S7 300/400 PLCs. I have writen the program:
int main(int argc,char **argv)
{char buffer[50],buf[]="This is a simple application";
daveInterface * di;
daveConnection * dc;
_daveOSserialType fds;
int speed=daveSpeed187k;
fds.rfd=setPort("/dev/ttyS1","19200",'N');
fds.wfd=fds.rfd;
if(fds.rfd>0)
{printf("\nstarting ppidaemon\n");
/*daveNewInterface(_daveOSserialType nfd, char *
nname, int localMPI, int protocol, int speed);*/
di = daveNewInterface(fds,"Zhao",0,daveProtoMPI,speed);
if(daveInitAdapter(di)!=0)
printf("Adapter is succeed\n");
/*daveNewConnection(daveInterface * di, int MPI,int rack, int slot);*/
dc =daveNewConnection(di,2,0,2);
if(daveConnectPLC(dc)!=0)
printf("Connect PLC is succeed");
/*daveReadBytes(dc,area,dbnum,start,len,data)*/
/*int daveWriteBytes(daveConnection * dc,int area, int DBnum, int start,int len, void * buffer);*/
daveWriteBytes(dc,daveDB,1,0,24,buf);
daveReadBytes(dc,daveDB,1,0,24,buffer);
printf("%s\n",buffer);
daveDisconnectPLC(dc);
daveDisconnectAdapter(di);
}
return 0;
}
the output is:
starting ppidaemon
Adapter is succeed
Connect PLC is succeedZhao *** no DLE before send.
Zhao *** _daveSendMessageMPI error in _daveSendDialog.
Zhao *** no DLE before send.
Zhao *** _daveSendMessageMPI error in _daveSendDialog.
@?%@N
I want to know the meaning of char *nname and the why of error ?
int main(int argc,char **argv)
{char buffer[50],buf[]="This is a simple application";
daveInterface * di;
daveConnection * dc;
_daveOSserialType fds;
int speed=daveSpeed187k;
fds.rfd=setPort("/dev/ttyS1","19200",'N');
fds.wfd=fds.rfd;
if(fds.rfd>0)
{printf("\nstarting ppidaemon\n");
/*daveNewInterface(_daveOSserialType nfd, char *
nname, int localMPI, int protocol, int speed);*/
di = daveNewInterface(fds,"Zhao",0,daveProtoMPI,speed);
if(daveInitAdapter(di)!=0)
printf("Adapter is succeed\n");
/*daveNewConnection(daveInterface * di, int MPI,int rack, int slot);*/
dc =daveNewConnection(di,2,0,2);
if(daveConnectPLC(dc)!=0)
printf("Connect PLC is succeed");
/*daveReadBytes(dc,area,dbnum,start,len,data)*/
/*int daveWriteBytes(daveConnection * dc,int area, int DBnum, int start,int len, void * buffer);*/
daveWriteBytes(dc,daveDB,1,0,24,buf);
daveReadBytes(dc,daveDB,1,0,24,buffer);
printf("%s\n",buffer);
daveDisconnectPLC(dc);
daveDisconnectAdapter(di);
}
return 0;
}
the output is:
starting ppidaemon
Adapter is succeed
Connect PLC is succeedZhao *** no DLE before send.
Zhao *** _daveSendMessageMPI error in _daveSendDialog.
Zhao *** no DLE before send.
Zhao *** _daveSendMessageMPI error in _daveSendDialog.
@?%@N
I want to know the meaning of char *nname and the why of error ?