Codesys Question

OK, smarter answer, the real one.
In your global variables, you are not matching COB IDs. For example, if you transmit a group of network variables with a COB ID 100, you must setup a global variable list, that can except the same variables in the receiver with a COB ID of 100 set to receive.
What you have is in the CR0232 is a list of variables set to transmit on a COB ID of 100. There is nothing in the HMI setup to receive these variables. The same occurs for the send and receive COB IDs 1000 (PLC receive) and 200 and 250 (HMI).
I find the easiest way to ensure this is correct is to setup my global variables in one device, such as the PLC, then use the export project function to export the network variable global variable lists. These are then imported into the other device. You then swap the tranmit/receive functions, and adjust the periodic or event driven transmit as desired.

Hope this helps.
 
Thanks for looking at it Doug, I noticed that I put in the wrong file. Here is the actual file. What I did do was to create the Network Variable list in one unit and then use the Merge command to copy the same list into the other unit. So I wouldnt have any mistakes. I then changed each list from read to write in the new unit. I still cant get it to work for some reason.

Let me know if you can think of anything else.

Cheers.
 
OK, I see nothing wrong at this point. There is only that it transmits on change only, which if there is no change, there will be no transmit.

I would try the following.
1, switch to transmit and receive 1 word only, have this on a cyclic transmission of 200ms (for example) then feed it with an incrementing value so you see it changing.

I have to unpack my test equipment, but I can't see anything too wrong.
I will probably get you something tomorrow.
 
Thanks for your help Doug, I have contacted ifm tech support in Canada and the engineer is on holidays until Mar 26, tech support in the US said they would get back to me next week. I have to travel up to the site on Tuesday for a demo of this system for the customer. I understand Codesys for the most part, but the manuals and information from IFM Germany isn't the best.

Gotta love the internet, a fellow helps you out from half a world away like he was local.

Cheers, and thanks again, if there is anything I can ever do for you, let me know. Ever travelling to Canada, look me up.

Thanks,
 
OK, I had a lot of frustration with this one, but it turned out to be a loose Can H pin. Comes with assembling and disassembling the test rig twice a week.

I used a CR0403/CR0451 combination, because I did not have the exact units you had.
Firstly, transmit on change will only work if you actually have a change. So you must make sure a change occurs. If I was you, I would change the PLC transmission to cyclic. The HMI may also be cyclic if you don't have too many variables. If you are doing a demo, then you should set it up for cyclic untill you have mastered the workings of this.
At 250kbps, you will get two messages per second. So a 100ms transmit cycle should work OK.
Second, for messages, each bit is packed into one byte. If you want to pack your bits into bytes and get only a single message, then you should use the pack and unpack libraries. This will cut your messages down enough to make cyclic transmission efficient.
Finally, you can have multiple network variable declaration files, each setup for a different transmission rate. For example, one could transmit every 10 second, one could do every 50ms and one could be on change.

Hope this helps.
 
Solved

Well, after many hours of fishing around in the program, I managed to finally get my network variable lists to work. Thank you Doug for your help in sorting this out. I used your files as a template and checked everything on my programs against yours.

Cheers, and thanks again.

Waindude.
 
Hi WainDude,

Can you let me know where the problem was?

For example, when I was trying to find the problem in your code, the CanH wire coincedently broke. This resulted in the network variables suddenly not working once I started using your list.

Where did you go wrong?
 
Doug, I ended up setting the CR1080 display as a slave and the CR2500 as the master. I made sure network variables was selected in target settings on both. I was looking at the Can parameters in the PLC configuration tab on the master when I noticed the Node ID was 30. I Changed the node ID on the slave in POU CanOPENHEADER_CH1 to 30, and away it went. I am able to read and write to and from both units using the network variable lists I made up. Pretty simple mistake, but I am a Can Newby for sure.

Thanks again for your help.

Waindude.
 
Hi guys,

I'm having a problem to send data in CAN netwrok with CR0451. Are there any specific configurations that should be done before ? I'm using the master template and trying to send data to the network.
 

Similar Topics

I only have one POU in the program that is written in Function Block Diagram. It is only 12 rungs, so I could just re write it into structured...
Replies
14
Views
1,816
Hi all, I'm just starting out in the plc world. For school we had some introduction into codesys v3.5, basically we get given visualizations and...
Replies
9
Views
2,425
Hello. I'm wanting to use a boolean value associated with turning an output on to control the visibility of an image. The visibility option in...
Replies
6
Views
2,159
I'm having trouble locating string data to %MW registers. This does not appear to work: site_name AT %MW200: STRING[20];
Replies
3
Views
1,567
Hello! I think I have a basic question and I'm hoping someone can point me in the direction of a solution. I am new to PLC programming and my...
Replies
2
Views
1,658
Back
Top Bottom