CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version 
It is currently Sat Aug 19, 2017 5:42 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Functions
PostPosted: Fri Aug 05, 2016 12:34 pm 
Offline

Joined: Thu Aug 04, 2016 12:00 pm
Posts: 2
Hello!
I'm fairly new to programming and I'm struggling using Functions. I'm writing a piece of code that will use one timer for 4 applications within the program... I understand FB's but it's functions I'm unsure of. I'm not sure how to call the function, or how to get a result out of it...

The idea is to have a variable pulsed signal from the function, then use that multiple times and they will have their own setpoints... I've hit a wall at the moment, so any help will be appreciated.

Thanks

Karl


Top
   
 Post subject: Re: Functions
PostPosted: Fri Aug 05, 2016 9:13 pm 
Online
Frequent User
Frequent User

Joined: Fri Sep 02, 2011 8:02 pm
Posts: 240
Functions do not keep memory - they are made to do some quick thing and that's it - no timers, no counters, etc. (there are ways around this, but avoid this - functions are for "a+b = c" type operations)

Use one FB to be your signal generator. You can then link the output to all four other FBs inputs.


Top
   
 Post subject: Re: Functions
PostPosted: Sun Aug 14, 2016 4:31 pm 
Offline

Joined: Thu Aug 04, 2016 12:00 pm
Posts: 2
Hi,

Thanks for the reply!

In the end I used a function block exactly like you recommended! It took a while for the penny to drop where I was going wrong, but I guess that the point of learning something new! :)

I'm really getting into ST and IEC 61131-3!

Thanks

Karl


Top
   
 Post subject: Re: Functions
PostPosted: Mon Aug 15, 2016 10:53 am 
Offline
Frequent User
Frequent User

Joined: Thu Jun 14, 2007 9:49 am
Posts: 974
you can also time a task, i am running a standard blinker with a task on 100 ms.

_________________
shooter@home.nl
computer shooter
paul deelen
jacob van wassenaerstraat 29
NL 5224 GG 's-Hertogenbosch
skype shooter paul.deelen
phone +31736139136


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

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 5 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 Limited