Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Using Piface with ladder example

2014-12-11
2015-01-26
  • jsolderitsch - 2014-12-16

    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

     
  • jsolderitsch - 2014-12-16

    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.

     
  • eschwellinger

    eschwellinger - 2014-12-16

    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

     
  • jsolderitsch - 2014-12-16

    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.

     
  • eschwellinger

    eschwellinger - 2014-12-16

    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

     
  • jsolderitsch - 2014-12-17

    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.

    IMG: HMI

    IMG: UnalignedHMI.png

     
  • eschwellinger

    eschwellinger - 2014-12-17

    Hi,

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

    See screenshot.

    BR
    Edwin

    IMG: FixedClientSize.JPG

     
  • jsolderitsch - 2014-12-17

    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.

     
  • frb - 2015-01-02

    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

    IMG: PiFaceIoDrv_LadderExample Probleme 02.jpg

    IMG: PiFaceIoDrv_LadderExample Probleme 01.jpg

     
  • eschwellinger

    eschwellinger - 2015-01-02

    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

     
  • frb - 2015-01-05

    Hallo,

    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 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="">???</bibliothek></bibliothek>

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

    BR
    frb

    IMG: PiFaceIoDrv_LadderExample Probleme 03.jpg

     
  • eschwellinger

    eschwellinger - 2015-01-26

    Hi,

    Screenshot?
    BR
    Edwin

    IMG: Update.png

     

Log in to post a comment.