It is like Oscilloscope of ones impulses(STL)

Valera

Member
Join Date
Jan 2004
Location
Saransk town Russia
Posts
147
I want to make visualisation of shape of impulse.
I have write code, now I check it on Software PLCSIM.
There is task that I am at a loss for solve.
Impulse set bits while it is exist. I want to use DB word for transfer states of bits to OP-17.
At the last line of code I simple want to see value of timer T79 it is intermediate

FUNCTION_BLOCK FB 2
TITLE =
VERSION : 0.1


VAR_INPUT
Sensor : BOOL ;
RESET : BOOL ;
END_VAR
VAR_OUTPUT
STATUS_IMPULS : WORD ;
END_VAR
VAR
_1_SHOT_MESUARE : BOOL ;
FP_60ms : BOOL ;
FP_SENSOR : BOOL ;
FP_10ms : BOOL ;
FN_10ms : BOOL ;
_10MS : BOOL ;
FP_20ms : BOOL ;
FN_20ms : BOOL ;
_20MS : BOOL ;
FP_30ms : BOOL ;
FN_30ms : BOOL ;
_30ms : BOOL ;
FP_40ms : BOOL ;
FN_40ms : BOOL ;
_40ms : BOOL ;
FP_50ms : BOOL ;
FN_50ms : BOOL ;
_50ms : BOOL ;
_60ms : BOOL ;
FP_RESET : BOOL ;
FN_6xSms : BOOL ;
FP_7xSms : BOOL ;
FN_7xSms : BOOL ;
FP_8xSms : BOOL ;
FN_8xSms : BOOL ;
FP_9xSms : BOOL ;
FN_9xSms : BOOL ;
FP_10xSms : BOOL ;
FN_10xSms : BOOL ;
_7xSms : BOOL ;
_8xSms : BOOL ;
_9xSms : BOOL ;
_10xSms : BOOL ;
FP_500ms : BOOL ;
Shot_500ms : BOOL ;
END_VAR
VAR_TEMP
REGISTER : DWORD ;
END_VAR
BEGIN
NETWORK
TITLE =Product presence time 560S2

AN #_1_SHOT_MESUARE;
A #Sensor;
FP #FP_SENSOR;
S #_1_SHOT_MESUARE;
//10ms mesuaring
A #_1_SHOT_MESUARE;
FP #FP_10ms;
L S5T#20MS;
SE T 69;
A T 69;
FN #FN_10ms;
A #Sensor;
S #_10MS;
//20ms mesuaring
A #_1_SHOT_MESUARE;
FP #FP_20ms;
L S5T#40MS;
SE T 70;
A T 70;
FN #FN_20ms;
A #Sensor;
S #_20MS;
//30ms mesuaring
A #_1_SHOT_MESUARE;
FP #FP_30ms;
L S5T#60MS;
SE T 71;
A T 71;
FN #FN_30ms;
A #Sensor;
S #_30ms;
//40ms mesuaring
A #_1_SHOT_MESUARE;
FP #FP_40ms;
L S5T#80MS;
SE T 72;
A T 72;
FN #FN_40ms;
A #Sensor;
S #_40ms;
//50ms mesuaring
A #_1_SHOT_MESUARE;
FP #FP_50ms;
L S5T#100MS;
SE T 73;
A T 73;
FN #FN_50ms;
A #Sensor;
S #_50ms;
//60ms mesuaring
A #_1_SHOT_MESUARE;
FP #FP_60ms;
L S5T#120MS;
SE T 74;
A T 74;
FN #FN_6xSms;
A #Sensor;
S #_60ms;
//7xS mesuaring
A #_1_SHOT_MESUARE;
FP #FP_7xSms;
L S5T#140MS;
SE T 75;
A T 75;
FN #FN_7xSms;
A #Sensor;
S #_7xSms;
//8xS mesuaring
A #_1_SHOT_MESUARE;
FP #FP_8xSms;
L S5T#160MS;
SE T 76;
A T 76;
FN #FN_8xSms;
A #Sensor;
S #_8xSms;
//9xS mesuaring
A #_1_SHOT_MESUARE;
FP #FP_9xSms;
L S5T#180MS;
SE T 77;
A T 77;
FN #FN_9xSms;
A #Sensor;
S #_9xSms;
//10xS mesuaring
A #_1_SHOT_MESUARE;
FP #FP_10xSms;
L S5T#200MS;
SE T 78;
A T 78;
FN #FN_10xSms;
A #Sensor;
S #_10xSms;
// Transfef status impulses to output for OP operation panel
// To this time I did't check it on real
LAR1 #REGISTER;
LAR1 P##STATUS_IMPULS;
A #_10MS;
= L [AR1,P#0.0];
A #_20MS;
= L [AR1,P#0.1];
A #_30ms;
= L [AR1,P#0.2];
A #_40ms;
= L [AR1,P#0.3];
A #_50ms;
= L [AR1,P#0.4];
A #_60ms;
= L [AR1,P#0.5];
A #_7xSms;
= L [AR1,P#0.6];
A #_8xSms;
= L [AR1,P#0.7];
A #_9xSms;
= L [AR1,P#1.0];
A #_10xSms;
= L [AR1,P#1.1];
LAR1 #REGISTER;
//Then in OP you can evaluate output parametr #STATUS_IMPULSE
//by bit to bit. And on OP this must view like
// there was impulse output of sensor like ___0ms_||||||||||||||50ms_____
// on display of OP you can see ||||_ _ _ _ _ _
// and you can evaluate sharp op impulse without osscilloscope


//Start shot mesuaring
A #RESET;
FP #FP_RESET;
R #_1_SHOT_MESUARE;
R #_10MS;
R #_20MS;
R #_30ms;
R #_40ms;
R #_50ms;
R #_60ms;
R #_7xSms;
R #_8xSms;
R #_9xSms;
R #_10xSms;
R #Shot_500ms;

//Mesuare impulse at ones timers
//500ms mesuaring
AN #Shot_500ms;
A #_1_SHOT_MESUARE;
FP #FP_500ms;
L S5T#500MS;
SE T 79;
A T 69;
S #Shot_500ms;
L T 79;
T MW 168;





END_FUNCTION_BLOCK
 
All work OK, exept code that is writing to #STATUS_IMPULS through indirect register addressing.
What is wrong?
Have somebody any ideas?
I know there is simple solving for this task, But I want to use one word. Now I try to use memory word as parametr.
 
TAR1 #REGISTER //If this code here is for restoring ar1 you should use the tar1 instruction

LAR1 P##STATUS_IMPULS

A #_10MS
= [AR1,P#0.0] //Remove L in front of every statment
A #_20MS
= [AR1,P#0.1]
A #_30ms
= [AR1,P#0.2]
A #_40ms
= [AR1,P#0.3]
A #_50ms
= [AR1,P#0.4]
A #_60ms
= [AR1,P#0.5]
A #_7xSms
= [AR1,P#0.6]
A #_8xSms
= [AR1,P#0.7]
A #_9xSms
= [AR1,P#1.0]
A #_10xSms
= [AR1,P#1.1]

LAR1 #REGISTER

I'm not exactly sure what your problems are but if you want to write to the P##STATUS_IMPULS you should remove the L in front of the Ar1 instuction. L is local data (Temp stack). Notice that you will write to the instansdb and not directly to the STATUS_IMPULS but it will work none the less.
 
Thanks very much.
Today I get the same result but by almoust at a random. I have PLCSIM software, and I try remove L and got OK result.
Then must I use instruction TAR1 for saving contents of AR1 before I modify it? (I did it because I read something in book)
 
And maybe I should use without group of timers ones timer.
Like start timer then evaluate it's value and compare with constant.

But if I use instr
==I;
and time at the moment of check will be like:
time is equal of constant (that I set in ==I)
| |or this time is equal of constant
___||___|____||
time check instruction

It is my stream of consciousness

And what about the IDEA of VISUAL of shape of signal???
 

Similar Topics

Hi, We've been doing a lot of work to get our DH+ networks back as they should be, following years of poorly executed modifications. We've...
Replies
3
Views
1,546
Good Morning , I'm really trying to get our guys to use good wiring practices . It seems like it is hard to get them to understand the...
Replies
3
Views
1,566
Hey Guys, Need a little help measuring electrical noise which is causing our encoder reading to flicker. i need help setting up oscilloscope to...
Replies
9
Views
3,161
Hi all, I am interested in buying a handheld or at least portable scope/DMM for home hobby and one I could use at work as well. Interested in...
Replies
9
Views
3,037
So I've been given the task to update some of our test equipment. We currently have some old crt scopes (which I like) and it seems nearly...
Replies
8
Views
5,338
Back
Top Bottom