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

New to CoDeSys.Please help me.

skycruiser
2008-10-10
2008-10-14
  • skycruiser - 2008-10-10

    Hi to all you techies.

    I'm using EASY215 with CoDeSys.I tried the Traffic light example but had some problems.Can anyone provide me with step by step guide to do programming.Any useful docs will be a great help.Currently I'm in need of a simple program to blink a LED with the press of a button.

    You can even give me sample programs or tell me as to where shall I get them.

    Thanks in advance.

     
  • deluxe79 - 2008-10-13

    It's easy to just toggle blinking of e.g. a led. Try this code in your project.

    PROGRAM PLC_PRG
    VAR
       Button1 AT %IX0.0   : BOOL;          (* A button connected to first digital (binary) input *)
       Led1 AT %QX0.0      : BOOL;          (* A led connected to first digital (binary) output *)
       Blink1              : BLINK;         (* Make an instance of Blink FB. Found in Utils.lib *)
       Trig1               : R_TRIG;        (* Rising edge detection. Found in Standard.lib *)
       xBlink              : BOOL := FALSE; (* TRUE=Blinking enabled, FALSE=Blinking disabled *)
    END_VAR
    ---
    Trig1(CLK:=Button1);
    IF Trig1.Q THEN                         (* If detected a rising edge *)
       xBlink := NOT xBlink;                (* Toggle blink state *)
            IF NOT xBlink THEN              
              Blink1(ENABLE:=FALSE);        (* Reset blink routine *)
              Led1 := FALSE;                (* and output. Doing a OUT=>Led1 does not guarantee to switch led off *)       
            END_IF
    END_IF
    IF xBlink THEN
       Blink1(ENABLE:=TRUE, TIMELOW:=t#500ms, TIMEHIGH:=t#500ms, OUT=>Led1);   
    END_IF
    
     
    👍
    1
  • skycruiser - 2008-10-13

    Hey Buddy...Thanks a lot for the program.It ran successfully.Can you give me some more progs on fbd.

    Thanks in advance.

     
  • deluxe79 - 2008-10-14

    Do you mean example routines built using function block diagram technique? Any particular operation in mind? By the way, I would strongly suggest searching for examples. There is a lot of them in this forum, alternatively google.

     
  • skycruiser - 2008-10-14

    Yeah I want simple FBD routines.I'm learning fbd so that i'm finally able to implement openCAN on easy215 PLC chip.So can you help me with this objective in mind?Well ST programs would also be fine..

    Take Care.

     

Log in to post a comment.