Announcement

REXYGEN forum has been moved. This one is closed.
Head over to the new REXYGEN Community Forum at https://forum.rexygen.com.

Looking forward to meeting you there!
 

#1 2017-08-29 21:26:55

martijnperdaan
Member
Registered: 2016-06-24
Posts: 20

Counter

i am looking for a fuction block that count 2 signals when digitale input is high


like if a digitale input is high count signal1 + signal2       2 + 2 = 4

Last edited by tomáš čechura (2017-08-31 09:49:14)

Offline

#2 2017-08-29 21:30:12

martijnperdaan
Member
Registered: 2016-06-24
Posts: 20

Re: Counter

the input signal can be high for a couple of second bit stil he must count one time
not counting and counting untill the signal is low again


ps sorry for my bad englisch

Offline

#3 2017-08-30 08:54:22

tomáš čechura
Administrator
Registered: 2016-02-22
Posts: 371

Re: Counter

Hi martijnperdaan,

thank you for your question. The REX Control System is based on continuous execution. What do you expect to be the output of the function block when the digital input is low? Zero? Last valid value?

You can use "ADD" function block followed by multiplication "MUL". The second input of "MUL" will be connected to the digital signal. See attached screenshot.

add.png

I'm not sure if I understand clearly your problem. Please, can you describe your issue more in general? What is the aim of your current project? I will be happy to help.

Regards, Tomas

Offline

#4 2017-08-30 21:07:44

martijnperdaan
Member
Registered: 2016-06-24
Posts: 20

Re: Counter

he has to count up  like 1+ 1 = 2 when it is high voor the first time the second time he has toe count the answer 2 + 1 = 3 when the input is high at the third time he has to count 3 + 1 = 4 when the input is high

like that over and over again

Offline

#5 2017-08-31 09:55:06

tomáš čechura
Administrator
Registered: 2016-02-22
Posts: 371

Re: Counter

Hi martijnperdaan,

look at "COUNT" function block (see docs: https://www.rexcontrols.com/media/doc/P … f#page=244). The digital signal connect through "EDGE" function block to "UP" input of "COUNT" function block. "EDGE" will catch only the rising edge of the digital signal (or any edge according to the function block settings).

Hope it helps.

Regards, Tomas

Offline

#6 2017-08-31 19:09:59

martijnperdaan
Member
Registered: 2016-06-24
Posts: 20

Re: Counter

can you show me a Example

Offline

#7 2017-09-04 12:40:02

tomáš čechura
Administrator
Registered: 2016-02-22
Posts: 371

Re: Counter

Hi martijnperdaan,

just connect your digital signal to the "UP" input of "COUNT" function block. "EDGE" function block is not necessary in this case because the "COUNT" block reacts only on rising edges.

counter.png

Regards, Tomas

Offline

#8 2017-09-07 07:10:33

martijnperdaan
Member
Registered: 2016-06-24
Posts: 20

Re: Counter

But how do I count signals 1 ( 5.4) and signals 2 (3.6) together when digitale input is high

Like 5.4 + 3.6

Offline

#9 2017-09-07 14:49:19

tomáš čechura
Administrator
Registered: 2016-02-22
Posts: 371

Re: Counter

Hi martijnperdaan,

I'm sorry, I'm still not able to understand what exactly are you trying achieve. Please, can you describe the purpose of the algorithm? What are inputs, outputs, states, etc.? What problem does it solve?

Your previous post can be implemented using ADD block. What should the output look like in next period? (5.4 + 3.6)+new signal 1 + new signal 2?

Regards, Tomas

Offline

#10 2017-09-08 16:09:52

martijnperdaan
Member
Registered: 2016-06-24
Posts: 20

Re: Counter

minimal_rexlang3.cexec.mdlEierTeller.mdlmysql_ioconfig.rio

if you loke at the rexlang fuction blok you she there is a analoge input
and there is a formula that give's a aswer to output 15

if digitale input 2 (not drawd yet) is high the analoog input is goiong back to zero but at that moment i has to count the aswere from output 15 whe the answere he alreddy had whit output 15



sorry for my bad englisch

Offline

#11 2017-09-12 11:58:03

martijnperdaan
Member
Registered: 2016-06-24
Posts: 20

Re: Counter

How can I make a pulse from a digitale input ?

Offline

#12 2017-09-13 17:08:41

tomáš čechura
Administrator
Registered: 2016-02-22
Posts: 371

Re: Counter

Hi martijnperdaan,

as far as I can understand you are hopefully looking for "Sample and hold" function, am I right? If yes, have a look at "SHLD" function block - https://www.rexcontrols.com/media/doc/P … f#page=142

If not, try to write your comments in Dutch and I will do my best to answer correctly - the possibilities of Google Translator are unbelievable these days smile

And according to your last post: the digital input can be transformed to pulse by "EDGE_" function block - https://www.rexcontrols.com/media/doc/P … f#page=251

Hope it helps.

Regards, Tomas

Offline

Board footer

Powered by FluxBB