CODESYS - the IEC 61131-3 automation software
https://forum.codesys.com/

Using Piface with ladder example
https://forum.codesys.com/viewtopic.php?f=21&t=5989
Page 1 of 1

Author:  Edwin Schwellinger [ Thu Dec 11, 2014 6:12 am ]
Post subject:  Using Piface with ladder example

Hi,

Using Pi with added Piface with ladder pou's -> example


BR
Edwin

Author:  jsolderitsch [ Tue Dec 16, 2014 12:16 am ]
Post subject:  Re: Using Piface with ladder example

I have compiled the sample program with ladder logic and logged into the attached Raspberry PI and started the program.

But how do I use the buttons on the PiFace to see that I am able to execute the logic.

Are the PiFace switches and LEDs bound to the variables and elements in the POU automatically or do I need to do some more configuration?

I expect the xSwitch1 will be one of the PiFace switches. Similarly for xSwitch2. But when I press the switches, nothing happens on the PiFace.

The description of the binding of my ladder logic to the PiFace seems incomplete.

If there is something else I can read on this, please advise.

Respectfully

Jim Solderitsch

Author:  jsolderitsch [ Tue Dec 16, 2014 2:00 am ]
Post subject:  Re: Using Piface with ladder example

Following up on my question.

Do I need a real circuit, say implemented on a breadboard, that has two real momentary switches and two leds that I connect to the right points on the input and output connections of the PiFace? I can pull power and ground from the PiFace as well

I was expecting to use the switches and leds on the PiFace itself to implement the ladder logic operational logic but I may be confused on what is possible.

Thanks.

Author:  Edwin Schwellinger [ Tue Dec 16, 2014 6:22 am ]
Post subject:  Re: Using Piface with ladder example

Hi,

I have added a more detailed example in the first post.
This should show how tp map the piface variables and use WebVisualisation.

BR
Edwin

Author:  jsolderitsch [ Tue Dec 16, 2014 6:41 pm ]
Post subject:  Re: Using Piface with ladder example

Yes, this example works like I expected the original one to work. I guess I was right in expecting that the switches in the ladder logic needed to be bound to the variables available on the PiFace. They are no longer part of the declaration section of the POU as they were in the original example.

The visualization works as well except I don't have the background graphic of the PiFace board to provide the image under the visualized switches and leds. Was that graphic meant to be part of the project file? My visualization just shows a white background.

I also like how the ladder also shows the switch boolean values and then the led indicators as you manipulate the switches on the PiFace. And the fourth switch does require a continuous press of 2 seconds before the led lights up because of the timer component on that rail.

Thanks for the quick extension of this example. This will be very beneficial. I want to implement a 2-way traffic light concept in ladder logic and I have an example from a MicroLogic PLC that I want to adapt for this purpose. I think I have enough info now to start this. I will connect the inputs and outputs from the PiFace to a real circuit board where I have green, yellow and red leds as well as actual switches. The timers will give me the ability to automatically progress through a sequence of Green, then Yellow and then Red where the intersecting direction shows the corresponding change from Red to Green.

Author:  Edwin Schwellinger [ Tue Dec 16, 2014 7:00 pm ]
Post subject:  Re: Using Piface with ladder example

Hi,
thank's for the feedback. You are right, the image should be embedded into the project.
I've changed it and now it is in the project in the first post.
BR
Edwin

Author:  jsolderitsch [ Wed Dec 17, 2014 2:09 am ]
Post subject:  Re: Using Piface with ladder example

I can confirm that the image is now present in the visualization and when viewed from the Codesys IDE it looks good: the HMI items are overlaid on the image just fine. When viewed in a browser (tried Chrome on Mac and PC) the alignment of the HMI elements (switches and leds) is bad. The switches are represented as ovals and are too widely spaced. The Led boxes are bigger than they should be and are not centered properly. Attaching a screenshot.

Not a big deal but curious if anyone else sees the same thing.

Turns out that if I group the HMI elements with the PiFace image, I get a better alignment. Attaching a screenshot from Chrome on Windows. The image still seems unnecessarily elongated -- stretched and the aspect ratio is not respected. When I browse from Safari on my iPhone, I get a weird vertical stretch but at least the buttons and leds remain aligned.

Author:  Edwin Schwellinger [ Wed Dec 17, 2014 9:07 am ]
Post subject:  Re: Using Piface with ladder example

Hi,

you need to change to fixed client size not best fit.

See screenshot.

BR
Edwin

Author:  jsolderitsch [ Wed Dec 17, 2014 5:51 pm ]
Post subject:  Re: Using Piface with ladder example

Yes -- that's what I needed. I did not know to open this element of the Visualization UI to find this setting. Once I make the change, then the UI in the browser looks exactly like the UI representation in Codesys.

I am running the English text version of the Codesys UI and I notice that the word for this in my English version is still the German word: Web-Visualisierung and perhaps that can be a point of confusion for new users like me. Almost all of the other words in the UI are translated to English.

I appreciate the timely posts to this forum to my observations.

Author:  frb [ Fri Jan 02, 2015 3:27 pm ]
Post subject:  Re: Using Piface with ladder example

Hallo,
I'm new on working with, RPi and PiFaceDigital.
So this is very interesting for me. But the projekt PiFaceIoDrv_LadderExample doesn't work on my system! :(
After starting, and updating (it was asked for) there are over 500 errors.
It seems to be that there are missing or bad configured iodriver interfaces, visuelembase, ... .
The GPIOs_A_B is missing too.
What's wrong?

Many thangs
frb

Author:  Edwin Schwellinger [ Fri Jan 02, 2015 5:11 pm ]
Post subject:  Re: Using Piface with ladder example

Hi,

you need to right click to the raspberry pi device in the device tree,
then update device (to your version)
then set compiler version and visuprofile to current version,
then it should work.

BR
Edwin

Author:  frb [ Mon Jan 05, 2015 3:34 pm ]
Post subject:  Re: Using Piface with ladder example

Hallo,

I'm sorry, but it doesn't work on his way! posting.php?mode=reply&f=21&t=5989#
Is it because i'm on version 3.5.5.2 and the first error wants to include < Bibliothek SM3_Basic, 3.5.4.0 > and the second <Bibliothek SM3_CNC, 3.5.4.0 >and the third <Bibliothek IoStandard, 3.5.4.0 >???

Excuse me, there is no <update-posibillity> after right-click.
The <compiler version and visuprofile > is updated - Thangs.
But it doesn't work!

BR
frb

Author:  Edwin Schwellinger [ Mon Jan 26, 2015 10:05 am ]
Post subject:  Re: Using Piface with ladder example

Hi,

Screenshot?
BR
Edwin

Page 1 of 1 All times are UTC+01:00
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/