CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version Spanish version French version
It is currently Tue Jul 22, 2014 12:20 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Fri Oct 10, 2008 3:09 pm 
Offline
User avatar

Joined: Wed Oct 08, 2008 2:16 pm
Posts: 12
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.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 13, 2008 4:37 am 
Offline
User avatar

Joined: Tue Oct 16, 2007 10:16 pm
Posts: 16
Location: Haugesund - Norway
It's easy to just toggle blinking of e.g. a led. Try this code in your project.

Code:
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

_________________
Regards,
Frank Thaule


Last edited by deluxe79 on Tue Oct 14, 2008 12:29 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Thanks
PostPosted: Mon Oct 13, 2008 2:02 pm 
Offline
User avatar

Joined: Wed Oct 08, 2008 2:16 pm
Posts: 12
Hey Buddy...Thanks a lot for the program.It ran successfully.Can you give me some more progs on fbd.
Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 14, 2008 10:44 am 
Offline
User avatar

Joined: Tue Oct 16, 2007 10:16 pm
Posts: 16
Location: Haugesund - Norway
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.

_________________
Regards,
Frank Thaule


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 14, 2008 11:50 am 
Offline
User avatar

Joined: Wed Oct 08, 2008 2:16 pm
Posts: 12
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group