Hello,
I am an absolut beginner with the CIFX 50 RE. I never worked with it before and I need some help.
At the moment I am trying to write a little C Programm(Visual Studio 2005 C++), which has to send a packet to an ethernet device(PING).
I connected the ehternet device(Ethernet/IP) over a HUB to the CIFX Card.
Can someone please post a little example code, so that I can see how I have to programm the CIFX Card.
Especially I want to know how to tell the CIFX Card , the Destination IP of the Packet.
Regards
Christian Huiskens
(Sorry my english isn't so good :D )
Hi AJ,
thanks for the quick answer.
I did everything you said but now I have another problem.
I am looking for a function , to send a predefined packet to the Ethernet Device.
The only function I found is "TLR_QUE_SEND_PACKET_FIFO()", but when I try to compile the programm, following error message appears" error C3861: "TLR_QUE_SEND_PACKET_FIFO": Bezeichner wurde nicht gefunden.", is there a special header file which I have to include first?Or is there another function to sned a packet?
Regards
Christian Huiskens
Hilscher Gesellschaft fuer Systemautomation mbH
Hi,
where did you find the function "TLR_QUE_SEND_PACKET_FIFO()"?
HI,
I found it int the "EtherNetIP Scanner Protocol API.pdf",page 161(Using the macro TLR_QUE_SEND_PACKET_FIFO() will send the packet to the EipEncap-Task process queue).
Because of your reaction I think ,that that was the wrong idea to send a packet.
Could you tell me which basic steps I have to programm to communicate with an ethernet device over the CIFX card?
regards
C.Huiskens
Hilscher Gesellschaft fuer Systemautomation mbH
Hi,
the reason, why I am struggling is that you are using a cifX card. You do not write any code directly on the netX.
The command "TLR_QUE_SEND_PACKET_FIFO()" must be used in the case you are writing an application directly on the netX.
But in case of the cifX card you are using the cifX driver to communicate with the device. Here for is the "xChannelPutPacket" the right command to sent a package.
Hi,
first of all thanks that you have patience with me, but I think step by tep I get into it.
So did I undestand you right that it is impossible to programm the netx of a cifx card??
And I still have the problem that I dont know how to tell the CIFX card , at which IP it should send the packets?
Example:
Get a ping from the device:
|CIFX 50RE(EIP Scanner)|------------>|EthernetDevice(Slave)|
(192.168.1.126)______________________(192.168.1.123)
Regards
C.Huiskens
Hilscher Gesellschaft fuer Systemautomation mbH
Hi,
I think you miss one more manual which is not on the delivered CD :|
Please download from the Hilscher web page in the Download section the Protocol API manual for the TCP/IP stack. This manual includes the commands for your need
Hi AJ,
today I tried to write a programm using the CIFX device driver.
HANDLE hDriver = NULL; HANDLE hSys = NULL; long lRet =CIFX_NO_ERROR;lRet = xDriverOpen(&hDriver);
if(CIFX_NO_ERROR != lRet)
{
printf("Error opening driver. lRet=0x%08X\r\n", lRet);
}
else{
HANDLE hChannel = NULL;
lRet = xChannelOpen(hDriver, "cifX0", 0, &hChannel);
if(CIFX_NO_ERROR != lRet)
{
printf("Error opening Channel!");
}
else{
// xChannelReset(hChannel,CIFX_SYSTEMSTART,1000000);
CIFX_PACKET sendPacket={
0,//ulDest /*!< destination of packet, process queue */
0,//ulSrc /*!< source of packet, process queue */
0,//ulDestId /*!< destination reference of packet */
0,//ulSrcId /*!< source reference of packet */
0,//ulLen /*!< length of packet data without header */
0,//ulId /*!< identification handle of sender */
0,//ulState /*!< status code of operation */
0,//ulCmd /*!< packet command defined in TLR_Commands.h */
0,//ulExt /*!< extension */
0,//ulRout /*!< router */
};CIFX_PACKET recPacket={
0,//printf("%u\n",tSendPkt.tHeader.ulDest );//=0; /*!< destination of packet, process queue */
0,//printf("%u\n",tSendPkt.tHeader.ulSrc );//=0; /*!< source of packet, process queue */
0,//printf("%u\n",tSendPkt.tHeader.ulDestId );//=0; /*!< destination reference of packet */
0,//printf("%u\n",tSendPkt.tHeader.ulSrcId );//=0; /*!< source reference of packet */
0,//printf("%u\n",tSendPkt.tHeader.ulLen );//=0; /*!< length of packet data without header */
0,//printf("%u\n",tSendPkt.tHeader.ulId );//=0; /*!< identification handle of sender */
0,//printf("%u\n",tSendPkt.tHeader.ulState );//=0; /*!< status code of operation */
0,//printf("%u\n",tSendPkt.tHeader.ulCmd );//=0; /*!< packet command defined in TLR_Commands.h */
0,//printf("%u\n",tSendPkt.tHeader.ulExt );//=0; /*!< extension */
0,//printf("%u\n",tSendPkt.tHeader.ulRout );//=0; /*!< router */
};
if(CIFX_NO_ERROR != (lRet = xChannelPutPacket(hChannel, &sendPacket, PACKET_WAIT_TIMEOUT)))
{
printf("Error sending packet to device!\r\n");
} else
{
printf("Send Packet:\r\n");
DumpPacket(&sendPacket);
if(CIFX_NO_ERROR != (lRet = xChannelGetPacket(hChannel, sizeof(recPacket), &recPacket, PACKET_WAIT_TIMEOUT)) )
{
printf("Error getting packet from device!\r\n");
} else
{
printf("Received Packet:\r\n");
DumpPacket(&recPacket);
}
lRet=xChannelIOWrite(hChannel,0,0,0,0,0);
if((lRet==CIFX_NO_ERROR))
printf("gut");
else{
char szError[1024] ={0};
xDriverGetErrorDescription(lRet,szError,sizeof(szError));
printf("%s\n",szError);
}
}
printf("hat geklappt");
}
}
getchar();
return 0;
Regards
C.Huiskens
Hilscher Gesellschaft fuer Systemautomation mbH
Hi,
COM FLAG not set, means that the communication flag is not set. This tells you, that you have not established a communication between the master and the slave.
Before you start to write your own application, you should try to establish a communication with the delivered applications. When this is working you should start with your own application. Very helpful for you will also the C-Toolkit. This is also on the CD.
Hi
I got a
similar problem «Communication flag not set»! After tuning cifx RE 50 Scanner
in SYCON, and Adapter to netX Configuration Tool status LEDs on the Adapter and
Scaner is SYS: green; MS: green, NS: flashing green. Adapter and Scanner
connected via a hub. No errors. However, in the dialogue «Diagnostic»:
Extended
Diagnosis-> RX_SYSTEM-> InitBatch Status-> Current state = Error
Extended
Diagnosis-> RX_SYSTEM-> InitBatch Status-> InitBatch Result = No DBM
file
does not
work «Start Communication» because «COM-flag not set». Why?
And when
you run the examples from the Toolkit error occurs in the line xChannelIORead
(hChannel, 0, 0, sizeof (abRecvData), abRecvData, 10).
Please
specify the reason for the problem.
Hilscher Gesellschaft fuer Systemautomation mbH
Hi,
that means, that the stack is not configured.
Nice, could you tell us which error do you get?!
Regards
AJ
Hi
It is clear, but how can I configure the stack? With the help of utilities SYCON.net or netX Configuration Tool? Is it possible somewhere to take the example of setting up the stack?
----------------------------------------------------
--- Read / Write Block Information ---
Read CONTROL Block
00 00 00 00
Write CONTROL Block
Read COMMON Status Block
07 00 00 00
Write COMMON Status Block
Error writing to common status block. lRet = 0x800a0006
Read EXTENDED Status Block
00 00 00 00
Write EXTENDED Status Block
Error writing to extended status block. lRet = 0x800a0006
Error 800C0021 - Communication flag not set
Hilscher Gesellschaft fuer Systemautomation mbH
Hi,
I could saw in your trace that you are using the EtherNetIP Scanner. In that case you have to do the configuration with Sycon.net. But please do not forget to download the config to the card at the end ;-)
Regards
AJ
I do
configuration by SYCON.net, in the end push on "Apply" and “Download”
(menu shortcut). Recording on the device is made, it is seen by a flashing LED.
May be to do something else?
Where can I
download the example of configuration file and how to download it into the
device?
Hilscher Gesellschaft fuer Systemautomation mbH
have you connected a slave?
They are connected by cable and in SYCON.net project, but in diagnostic windows connection disable.

Hilscher Gesellschaft fuer Systemautomation mbH
and physically? Maybe you should get in contact with the hotline.
Andreas Jacob
Hilscher Gesellschaft fuer Systemautomation mbH
Hi,
at first you should start to configure your cifX card as an EtherNet/IP card. There for you can use several tools.
Sycon.Net
cifX Setup
or the netX Configuration and Diagnostic Utility.
The best way is to have a look into the CIFX-RE_usermanual_en.pdf manual. It describes all necessary steps.
When you have installed the card you should read the EtherNet/IP Protocol API manual. It is also included on the CD.
This manual will help you to communicate with the stack over your application.