Schneider said that the plc is only compatible with modbus or EtherNet/IP protocol.
OK - maybe they only
support these protocols, but I have used the Network Variables feature, and the link I shared has raw-UDP communication through the function blocks, so clearly it is compatible. Did you send Schneider support their very own advertisement? If they don't support it, why are they advertising it?
So I started using the codesys code and the scanner is working with the plc. The problem İ'm facing is that randomly the plc crashes and Schneider can't explain why.
Let me guess... this communication profile is not supported, so they won't help you?
Even while not communicating with the scanner via Ethernet Tcp/IP prtocol it still crashes.
Sounds like you have bigger problems than scanner communications. If it still crashes, not sure how another communication method solves your whole problem... maybe you need a new PLC vendor?
You are correct it states that the hmi is for EtherNet/IP or modbus. But if you want to use this hmi with 3rd party plc it can communicate via Ethernet Tcp/IP prtocol, for example with Mitsubishi, Siemens or Allan bradly and so on.
True, but just claiming 'Ethernet TCP/IP' is not sufficient to determine communications capability. I am sorry this is so, but in fact, it is.
ModbusTCP uses Ethernet and TCP/IP.
EtherNet/IP uses Ethernet and TCP/IP.
Profinet uses Ethernet and in most cases uses TCP/IP (I think IRT uses raw Ethernet frames, so may not use TCP/IP at all - but confirm with a Profinet expert)
etc...
So claiming 'Ethernet and TCP/IP' is necessary, but not sufficient, to determine if these devices can talk.
Now the Magelis may have raw Ethernet TCP/IP capability; I don't know. My point was only that the EtherNet/IP explicit driver you selected would not work. The Magelis driver selection is not huge, but they have some. Schneider HMI guys should be able to inform you of this if no one hear knows? I only use Magelis when I have to, I prefer other brands. There is nothing wrong with it, I just prefer others. For instance, Redlion HMIs can do this.