<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Extra 10ms in pulse length for an Eaton XC201</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/4e68e0197e/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/4e68e0197e/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/4e68e0197e/</id><updated>2020-02-27T23:23:17.895000Z</updated><subtitle>Recent posts to Extra 10ms in pulse length for an Eaton XC201</subtitle><entry><title>Extra 10ms in pulse length for an Eaton XC201</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/4e68e0197e/?limit=25#c938" rel="alternate"/><published>2020-02-27T23:23:17.895000Z</published><updated>2020-02-27T23:23:17.895000Z</updated><author><name>luke.skywalker</name><uri>https://forge.codesys.com/u/luke-skywalker/</uri></author><id>https://forge.codesys.comb95a259836720865957e950057250c66a7c8f2ca</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thank you very much for you quick reply. I didn't check the forum for an answer until now.&lt;br/&gt;
I will look into what you have said one of the following days, because I don't really have enough time now.&lt;/p&gt;
&lt;p&gt;But, again, thank you. This is very helpful.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Extra 10ms in pulse length for an Eaton XC201</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/4e68e0197e/?limit=25#1fe2" rel="alternate"/><published>2020-02-27T23:23:16.234000Z</published><updated>2020-02-27T23:23:16.234000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.com8dcbce9cfa1e379f5a77a66961f6802f2a65679a</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;This extra time is used by the controller to get the info from the inputs, and set outputs, also for communication etc.&lt;br/&gt;
This is done before every loop.&lt;br/&gt;
If you stop inside a program this is also delayed, so no good.&lt;br/&gt;
better to look for an event or skip your program when timer is not finished.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Extra 10ms in pulse length for an Eaton XC201</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/4e68e0197e/?limit=25#8078" rel="alternate"/><published>2020-02-27T23:23:11.549000Z</published><updated>2020-02-27T23:23:11.549000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.com184eca0908951a7bc6dbe20a5bb29de140004759</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;ave a look in  w &lt;a class="" href="http://www.oscat.de" rel="nofollow"&gt;www.oscat.de&lt;/a&gt; w  and use the txt version, this way you will learn ST very quick.&lt;br/&gt;
the txt version is fully in ST, however you can also use the function blocks in a self made block or in a POU.&lt;br/&gt;
Blink works with internal timeinterupt, so it will work even if you do not call the function.&lt;/p&gt;
&lt;p&gt;In your case make a function block and you can give it all the parameters in one line, and you can make global vars for anything you need.&lt;/p&gt;
&lt;p&gt;In your main program you will have to make something that asks for the time elapsed and then set a flag.&lt;br/&gt;
you can also use a timed program look in tasks for this.&lt;br/&gt;
now the blinker will inetrupt your running program to set the flag, have this running free to have the highest speed.&lt;br/&gt;
your runners should be timed also but a lot slower like T#200ms. to avoid the processor to busy.&lt;/p&gt;
&lt;p&gt;for your pulse train &lt;br/&gt;
readypuls=false&lt;br/&gt;
FOR number of repeats&lt;br/&gt;
  for number of pulses&lt;br/&gt;
    set puls on&lt;br/&gt;
    wait&lt;br/&gt;
    set puls off&lt;br/&gt;
    wait&lt;br/&gt;
  next&lt;br/&gt;
next&lt;br/&gt;
readypuls=true&lt;/p&gt;
&lt;p&gt;In another program you can ask for this readypuls&lt;br/&gt;
the wait has the disadvantage that processor stops until wait is over.&lt;br/&gt;
to avoid this use elapsed time&lt;/p&gt;
&lt;p&gt;wait:&lt;br/&gt;
if time not running then&lt;br/&gt;
  set time = now()&lt;br/&gt;
else&lt;br/&gt;
   if time+waittime &amp;lt; now()&lt;br/&gt;
      then time is elapsed&lt;br/&gt;
endif&lt;br/&gt;
endif&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Extra 10ms in pulse length for an Eaton XC201</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/4e68e0197e/?limit=25#9415" rel="alternate"/><published>2020-02-27T23:23:09.888000Z</published><updated>2020-02-27T23:23:09.888000Z</updated><author><name>luke.skywalker</name><uri>https://forge.codesys.com/u/luke-skywalker/</uri></author><id>https://forge.codesys.come787e431fb9413c0cd66c22c276e6235ccfea5a5</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Of course, I know I can implement this using SFC and, finally, so I did. But, I am curious, can I do it in ST?&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Extra 10ms in pulse length for an Eaton XC201</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/4e68e0197e/?limit=25#a1eb" rel="alternate"/><published>2020-02-27T23:23:05.192000Z</published><updated>2020-02-27T23:23:05.192000Z</updated><author><name>luke.skywalker</name><uri>https://forge.codesys.com/u/luke-skywalker/</uri></author><id>https://forge.codesys.com227afd0d96c546c42eca77d387971a62b2a44da2</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thank you very much for your quick reply. You made me look more thoroughly into the libraries. I have solved my problem using a predefined function block called BLINK, from Util.lib, available in the Eaton EasySoft Codesys.&lt;/p&gt;
&lt;p&gt;I come now with another question. Suppose I have a function block that generates N pulses and I want to call it M times from another PRG, with certain arguments. THis function block return a signal called PULSE (containing the pulse train) and a flag OK when it finishes.&lt;/p&gt;
&lt;p&gt;How do I implement this?&lt;br/&gt;
Because, if I use a FOR, it doesn't work when I call it inside the loop like FUNCTION(EN:=TRUE, PULSE_NO:=N). How can I make it wait for the OK, then go to the next instruction? I'm sorry I may look stupid, but this really works in classical programming like C. How do I implement this for a PLC in Codesys?&lt;/p&gt;
&lt;p&gt;Also, how do I save the FUNCTION.PULSE variable in another global variable real-time, for output, when calling the function?&lt;/p&gt;
&lt;p&gt;Thank you in advance and sorry for my limited knowlegde of this.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Extra 10ms in pulse length for an Eaton XC201</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/4e68e0197e/?limit=25#2892" rel="alternate"/><published>2020-02-27T23:23:03.371000Z</published><updated>2020-02-27T23:23:03.371000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.comd712f0f7128e5b8c7160f6de322c5139da8b019c</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;wrong use of the timers.&lt;br/&gt;
and the cycle time is about 5 to 10 ms.&lt;br/&gt;
when a timer is expired it is only checked when the program is on that line. (interupt is better on this.&lt;br/&gt;
nd when you start it again it will have a delay,&lt;br/&gt;
As most systems do have an RTC (which runs independent from process, you can take this time.&lt;br/&gt;
say if time &amp;gt;100 ms as last time do your thing.&lt;br/&gt;
another way is to do it in timed events in the task list.&lt;br/&gt;
however you will always have an unstable shape.&lt;br/&gt;
this is because you did not make a realtime process and the PLC is interuted for other tasks like visualisation and communication.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Extra 10ms in pulse length for an Eaton XC201</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/4e68e0197e/?limit=25#b888" rel="alternate"/><published>2020-02-27T23:22:58.760000Z</published><updated>2020-02-27T23:22:58.760000Z</updated><author><name>luke.skywalker</name><uri>https://forge.codesys.com/u/luke-skywalker/</uri></author><id>https://forge.codesys.com695c9cd7ba4ad78d0eac5775aba5440e3cccb06b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello.&lt;/p&gt;
&lt;p&gt;I am a final year student working on my final paper and a newbie with Codesys. I plan to drive a stepper motor with a Moeller/Eaton XC201, but for now I am trying to generate a pulse train at one of the outputs. There are 10 pulses per second, 50% duty cycle, followed by a 1s pause, then repeated. So, for 10 pulses per second, you must have a pulse length of 50ms (1s divided by 10 and by 2). I have implemented this using SFC and a delay function same as in the trafficlights tutorial.&lt;/p&gt;
&lt;p&gt;The only problem is that, when I see the output on the oscilloscope, the pulse length is 58 to 60ms (it depends), which is 8-10ms longer than it should be. I also tried (for testing purposes) to increase the pulse length to 100, 500, 1000ms. The result on the oscilloscope is the same, an extra 10ms (approx.).&lt;/p&gt;
&lt;p&gt;Of course, I have read that this may be influenced by the cycle time and processing time, but, for the Moeller XC201, these are under 0.05ms.&lt;/p&gt;
&lt;p&gt;What do you think may be the problem? &lt;/p&gt;
&lt;p&gt;Thank you in advance.&lt;/p&gt;
&lt;p&gt;Lucian&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>