BUJAR GASHI

C252 counter

7 posts in this topic

I have created everything right on counting value with C252  but i need when the proced dooes to end the value on C252 to be default liked 1543

when i use command [RST C252] the value goes to 0 , so how can i make it 1543 ?

Share this post


Link to post
Share on other sites

I actually don't use a lot of counters. I use [INCP D100]. I find it more flexibel. When I want something to happen at a value i use [ = D100 K22] or [ >= D100 K22] as condition.

If I wanted the D100 to have a preset value I'd use the MOV instruction. [MOV K1543 D100]

I actually expect that you can move a preset value to a counter with the MOV instruction. But I haven't tried it.

If C252 is a 32-bit use DMOV. But I repeat, I haven't tested it.

Share this post


Link to post
Share on other sites

I suggest you try this example:

Test_C252.jpg

Share this post


Link to post
Share on other sites

Thanks kraykov , this works well .

Another question ?

how can i put decimal after point for example 123.20  so encoder count shows me only 12345 ?

Share this post


Link to post
Share on other sites

Convert the original value to float (e.g. FLT D0 D2). Then divide by 100 (e.g. DEDIV D2 K100 D4), then you'll have a floating point number in D4/D5 with a value of abc.xy. So if the original value is 12345, the "new" value will be 123.45

Share this post


Link to post
Share on other sites

Dear Kaarent , it not working ... to the d4 and 5 it shows me only  this line --------

 

Share this post


Link to post
Share on other sites

Look at this it could do you good:

Test_C252_2.jpg

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now