Support Forums
Falling Edge

Hi All,

Below is a job I wrote for detecting when 5 pulses are counted at an input, it works fine, but what I really need is to detect the falling edge, how is this done? Can with a xD input also?

The output results are attached.

Thanks

BEGIN"MIMIC"
RS1S
RA"Sched_A"(….)1S
LOGONA

1HSC("Counter_1",LM)

RB"Sched_B"(….)1HSC(5)
LOGONB

5DSO("WriteALogicState_1",R,100)=1

END

5cb98d2c4abd9

Hi All, Below is a job I wrote for detecting when 5 pulses are counted at an input, it works fine, but what I really need is to detect the falling edge, how is this done? Can with a xD input also? The output results are attached. Thanks BEGIN"MIMIC" RS1S RA"Sched_A"(….)1S LOGONA 1HSC("Counter_1",LM) RB"Sched_B"(….)1HSC(5) LOGONB 5DSO("WriteALogicState_1",R,100)=1 END ![5cb98d2c4abd9](serve/attachment&path=5cb98d2c4abd9)

Good morning FrankI,

Both the high speed and low speed counters are designed to count on a rising edge.
Looking at the screen it appear the input frequency is about 6 Hz so you could try:

BEGIN"MIMIC"

RA1-E 'Trigger schedule A on the falling edge of digital input 1
1CV=1CV+1
If(1CV=5){5DSO("WriteALogicState_1",R,100)=1; 1CV=0}

END

Good morning FrankI, Both the high speed and low speed counters are designed to count on a rising edge. Looking at the screen it appear the input frequency is about 6 Hz so you could try: BEGIN"MIMIC" RA1-E 'Trigger schedule A on the falling edge of digital input 1 1CV=1CV+1 If(1CV=5){5DSO("WriteALogicState_1",R,100)=1; 1CV=0} END

Here are two solutions - Thanks for the help in getting me started.

Solution #1
1) This counts 24 falling edges(1-E) on the "1D" input, increments "1CV". When the terminal count is reached (24);
a) Light the "Attn" LED (1WARN)
b) Log the count (1F2)
c) Reset the channel variable (1CV=0)
d) Fire schedule 2 (XB)

2) Schedule_2 (B) generates a 10mS pulse on digital output 5D

BEGIN"config"
RS1S
RA"Schedule_1"(...)1-E
LOGOFFA
ALARMR1((CALC("Calculation_1~",=1CV,LM)=1CV+1)>24)1WARN"?1F2"{1CV=0;XB;}
RB"Schedule_2"(...)5S
LOGOFFB
5DSO("WriteALogicState_1",R,10)=1
END

Solution #2 - uses only one schedule
BEGIN"config"
RS1S
RA"Schedule_1"(....)1-E
LOGONA
' User defined
1CV=1CV+1
ALARM1((CALC("ALARM~",LM)=1CV)>5)"Event triggered on Logger ! at @ on #, ?N value is ?V ?U."{4DSO(R,1000)=0 1CV=0;}
END

Here are two solutions - Thanks for the help in getting me started. Solution #1 1) This counts 24 falling edges(1-E) on the "1D" input, increments "1CV". When the terminal count is reached (24); a) Light the "Attn" LED (1WARN) b) Log the count (1F2) c) Reset the channel variable (1CV=0) d) Fire schedule 2 (XB) 2) Schedule_2 (B) generates a 10mS pulse on digital output 5D BEGIN"config" RS1S RA"Schedule_1"(...)1-E LOGOFFA ALARMR1((CALC("Calculation_1~",=1CV,LM)=1CV+1)>24)1WARN"?1F2"{1CV=0;XB;} RB"Schedule_2"(...)5S LOGOFFB 5DSO("WriteALogicState_1",R,10)=1 END Solution #2 - uses only one schedule BEGIN"config" RS1S RA"Schedule_1"(....)1-E LOGONA ' User defined 1CV=1CV+1 ALARM1((CALC("ALARM~",LM)=1CV)>5)"Event triggered on Logger ! at @ on #, ?N value is ?V ?U."{4DSO(R,1000)=0 1CV=0;} END
19
2
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft