Using Pi with added Piface with ladder pou's -> example
PiFaceIoDrv_LadderExample.project [156.18 KiB]
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.
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.
I have added a more detailed example in the first post.
This should show how tp map the piface variables and use WebVisualisation.
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.
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.
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.
you need to change to fixed client size not best fit.
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.
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.
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.
I'm sorry, but it doesn't work on his way! l posting.php?mode=reply&f=21&t=5989# l
Is it because i'm on version 220.127.116.11 and the first error wants to include < Bibliothek SM3_Basic, 18.104.22.168 > and the second <bibliothek 22.214.171.124="" sm3_cnc,="">and the third <bibliothek 126.96.36.199="" iostandard,="">???</bibliothek></bibliothek>
Excuse me, there is no <update-posibillity> after right-click.
The <compiler and="" version="" visuprofile=""> is updated - Thangs.
But it doesn't work!</compiler></update-posibillity>
Log in to post a comment.