I'm trying to send Art-Net packages to an ArtNet-DMX-Converter via NBS.UDP_Send to switch between several DMX Channels within one Universe. I use wireshark to check the packets, and seem to be facing two difficulties:
- all my UDP Packets seem to be within the port range 1740-1743, instead of the 6454 that I fed to myUDP_Send
- the UDP Packets I am sending cointain a whole lot more data than just the UDP header and what I put into myUDP_Send.pData
As my CodeSys experience isn't off the charts, I want to ask you guys whether what I'm trying is possible, and if so, how.
1740-1743 is the communication ports for the Development system or a HMI, so you would see them even if you had no NBS running.
You will need instead a UDP_PEER.
Please also use the SP16 version of the library, it is amazing!
Let me know if you are still stuck after using UDP_PEER and I'll try to track down an example.
Thanks mate, I'll try going with UDP_Peer next week!
Hey there again!
I've now tried using myUDP_PEER without success, as it always puts out an Error/ sets xError to TRUE. I could really do with a code example, as the one I used (NetBaseServicesDemo.project from https://help.codesys.com/webapp/090eefOU8ghnTgjp1u-MsUHjdQY%2Ffld-Examples;product=CAA_NetBaseServices;version=22.214.171.124) didn't get me where I wanted.
Additionally, the project is in version 3.5.13, so is there any way (other than updating the whole thing) for me to use the SP 16 library?
Thanks in advance and cheers
Which IEC language would you be most comfortable with?
Yes, CAA Net Base Service is replaced with Net Base Services and is slightly different.
Thanks for your quick answer, I'd prefer ST!
Have a look at this I put together:
#5 UDP Send and Receive with Net Base Services SP16
Let me know if it helps you on your way.
If you ever want to share your ArtNet-DMX-Converter project in forge, I will be happy to answer any questions you might have about that. You can either use iec-snippets if it's small, or add a new project or library (depending how you have packaged it).
Talk Topic about project #iec-snippets
Sorry for not answering any quicker and thanks a lot for your piece of code!
I did update the projekt, switched to NBS SP16 and implemented what you sent me, but sadly I still seem unable to achieve the desired results. When using Wireshark to monitor the local Network, not a single UDP message shows up on port 6454. Any more wisdom you could share with me?
EDIT: I am receiving 'WRONG_CONFIGURATION' errors from both myUDP_Peer and myUDP_Send.
In case it is relevant, I'm using a PixtendV2, i.e. CodeSys for RaspberryPi!
I found a project from some years ago. Is in a very raw state, but worked well for some tests/events with this ArtNet-DMX-Gateway:
Disabling the firewall was necessary to get the UDP pakets out. Maybe you can have a look at this.
Thanks for the resources you provided!
About disabling the firewall, are we talking the routers firewall for the network, or is this something host-based to do with CodeSys directly?
because I used the winplc I had to switch off the firewall of Windows10 to get the UDP pakets sent and recieved.
I am using the OSCAT libraries for sending ArtNet from a PFC200 with Codesys 126.96.36.199 to a simple ArtNet Node from Ulrich Radig. Thats very reliable since years. Here is some code from the early stage - but still working: http://www.oscat.de/community/index.php/topic,880.msg13485.html#msg13485
All the best,
UPDATE: Things are starting to look a lot better, as I can now consistently send Art-Net Packets. I'll post the code once I'm happy with it. Thanks a lot to @i-campbell!
This is the code I'll be using:
xSend : BOOL;
port : UINT := 6454;
theirIP : NBS.IPv4Address := (ipAddress := 'XXX.XXX.XXX.XXX'); //BOTEX ArtNet-DMX-Converter
myIP : NBS.IPv4Address := (ipAddress := 'XXX.XXX.XXX.XXX'); //PixTend
MySendData : ARRAY [0..50] OF BYTE;
MySendDataReset : ARRAY [0..50] OF BYTE := [16#41,16#72,16#74,16#2D,16#4E,16#65,16#74,16#00,16#00,16#50,
NumberOfBytesToSend : UDINT := 50;
myUDP_Peer : NBS.UDP_Peer;
myUDP_Send : NBS.UDP_Send;
myUDP_Receive : NBS.UDP_Receive;
ChannelOnNumber : INT := 0;
state : INT := 0; //CASE state
i : INT; //FOR Counter
CASE state OF
eErrorID=> peerErrorId ,
state := 1;
FOR i := 0 TO 50 DO
MySendData[i] := MySendDataReset[i];
IF ChannelOnNumber > 0 THEN
MySendData[ChannelOnNumber+17] := 16#FF;
state := 2;
udiTimeOut:= 100000, // 100 ms timeout
xError=> sendErrorBool ,
xSend := NOT xSend;
See Attachment for Example WebVisu UI: DropDownMenu changes PLC_PRG.ChannelOnNumber, while the ApplyButton sets PLC_PRG.state to 1.
Log in to post a comment.