Time between output signal and input signal

mangan

Member
Join Date
Jul 2016
Location
Malmo
Posts
5
Hi! I'm really new to plc programming and i'm trying to do a very simple task. I want to get the time elapsed from when i send an analog putput signal to when i recieve an analog input signal. I know that the event takes about ~150 ms but when i measure it i get ~300 ms. I think it has something to do with the analog input sampling but i'm not sure.

This is my code:
Code:
TONR(Timer1);

IF PosFeedback <= PosFeedback_Min & not Timer1.Reset THEN

	Timer1.TimerEnable := 0;
	FullCloseDeltaTime[1] := Timer1.ACC;
	Timer1.Reset := 1;

END_IF;

IF not move & Move_LastScan THEN
	//Start timer
	Timer1.TimerEnable := 1;
	Timer1.Reset := 0;	
		
END_IF;

Move_LastScan := move;

I start my timer when my output signal goes from 0 to 1 and when my feedback, the analog input reaches above a set value i stop the timer.

So to my question, what is causing my measured time to be 300 ms and not ~150 ms?

For my input module (rockwell's 1756 IF8 analog input) i have set the RTS to 44 ms. It is not possible to set the value any lower, then the program (Studio 5000) says that the value is to low and i must insert a new value.

I have created a trend where i can see these values and there i can see that the time is ~150-200 ms.
 
Last edited:
Thanks i found it! But apparently it is called module filter but i guess it's the same thing. I've managed to change real time sample to 11ms but when i measure the time i always get 250, 300, 350, 400 ms. Never something more specific like 267 ms or something. Just in intervalls of 50 ms. Any idea why? Looking in my trend i can see that the time is not exactly 250 or 300 and so on.
 
Last edited:
Now i tried to just time when i toggle i bit on or off and i still get answers with 50 ms interval, never anything more exact. Is there a way to get higher precision with a timer than 50 ms?
 
Last edited:
there is an internal timer (in iec it is called NOW().
and you get your answers of 50 ms because you do a this task only every 50 ms, and you want it as fast as possible (called freewheeling (on codesys)
dont use timers as they need a full cycle to reset etc.
use the systemtime
 
In the mainTask properties under configuration tab I changed type to continuous instead of periodic (with 50 ms interval). Now it's working like i wanted to.
 

Similar Topics

I have a Automation Direct Click Plus that you can buy option CPU slot modules for input/outputs. The slot modules have the options of sinking...
Replies
9
Views
2,798
i wish to know the major difference between (NPN and PNP) outputs in PLC,SENSORS etc.............
Replies
2
Views
2,881
i wish to the major difference between (NPN and PNP) outputs in PLC,SENSORS etc.............
Replies
0
Views
2,015
What is the difference between discrete, analog and relay output cards?
Replies
9
Views
4,098
Hello gentlemen, Im working on a small project on TIA Portal, about establishing a Modbus TCP connection between my ET200SP plc and a socomec...
Replies
10
Views
213
Back
Top Bottom