PDA

View Full Version : CR0451 Demo Program



Jeremy Kopicz
09-16-2011, 02:10 PM
Attached is a demo program for use in the CR0451.

Here is also a link to a demo for the CR1081:

http://mobilecontrols.ifmefector.com/showthread.php?t=218

Silas Curfman
07-04-2013, 12:09 AM
Even though from an old post should this demo work for a new controller? I get errors that it can't find about 5 of the libraries referenced. Would I just add the newest version of the libraries it's looking for and then delete the reference to the old one? Thanks.

Jeremy Kopicz
07-08-2013, 10:09 AM
Yes, it is an older demo so the libraries and target would need to be updated.

Silas Curfman
11-23-2014, 02:50 PM
After a long break from Codesys I've been back at it now. Been combing over the DemoStarterSet program being that I have a the Basic Kit here to work with. I'm getting fairly comfortable programming the CR0403 and CR0451 individually. Now I'd like to do more with them communicating together.

After focusing on the PDM_TO_PLC and PLC_TO_PDM POU's I thought I had a good enough grasp to add another feature to the original DemoStarterSet program. I want to read a poteniometer input on Input 4 of the CR0403 and be able to use it in the CR0451 display.

Using the same methods as in the original demo program, I captured the state of the input on the CR0403, packed it into the first to slots of the CAN_TX data array, and ran a CAN_TX just for this data in the PLC_PRG. Likewise I setup a CAN_RX on the CR0451 to read and unpack the value.

Programs compile with no errors. They load up and run on the devices. The CR0403 is picking up the potentiometer reading on INPUT 4. But no dice on the display end.

My guess is it has something to do with the Sync / Async functions in the PDM_TO_PLC. If that's the case, can you help me understand what the Sync and Async are doing in relation to the CAN_TX and CAN_RX? Thanks for the help. I'll post a couple screen grabs of what I'm doing if it helps.

Silas

https://www.dropbox.com/s/1t0k9r84nl933x9/get_input.png?dl=0

https://www.dropbox.com/s/q8tpeobo5oo187n/transmit.png?dl=0

https://www.dropbox.com/s/yfj4s081nd0k460/receive.png?dl=0

EDIT (late that night):
OK, I think I'm on the right track now. Network Variables, right? All of our programming has been on single controller / device setups, so up to this point I haven't done anything with Network Variables. After doing some searches I found Jeremy's tutorial on Network Variables (http://mobilecontrols.ifmefector.com/showthread.php?t=126&highlight=tutorial). That was a great help. I am still curious though if someone can explain the way the sync / async functionality works.

Erik Gerrits
12-01-2014, 12:45 PM
Sync / Async comes in with CANopen. If its set to sync the value gets sent when it sees the sync message (#80). Async is usually done on change (up to manufacture). Not sure where you were seeing it at.

Anyways, yes Network Variables is where you need to be going.