8 posts in this topic

Hi,

I can’t find an answer to the following and I was advised to ask it here.

I’m programming an Omron CJ2M with an MD212 high speed I/O card. I usually do all my programming in Structured text, simply because I like it a lot over ladder or sft.

Now, if I want to read the hight speed counter (incremental encoder), I have to make a ladder section and use the PRV instruction to store the present value in a chosen location.
The manual says the current PV is stored in A271, but I can’t get a readout there. Apparently the only way to read it is through this instruction.

Does anyone know if there is an equivalent to the PRV instruction for Structured text? or another way perhaps? Again, when I check the actual memory adress, there’s no value there withouth the use of the PRV instr.

Share this post


Link to post
Share on other sites

The counter value is a double word starting at A270.  Monitor A270 as a DINT and you will see the value.  A271 would only contain the most significant bits and would only change when the counter exceeds 65535.  I believe that you do not need to use the PRV instruction to update this address if everything is configured and wired properly.  

Share this post


Link to post
Share on other sites

Thanks for your input, I will check out your suggestion on monday

 

Share this post


Link to post
Share on other sites

You're only the third person I heard ever promote the use of structured text.
But that's fine I seem to be the only person for thousands of miles to be able to understand it.

Share this post


Link to post
Share on other sites
On 10/20/2019 at 9:08 PM, NevergoldMel said:

You're only the third person I heard ever promote the use of structured text.
But that's fine I seem to be the only person for thousands of miles to be able to understand it.

Structured text is incredibly valuable for specific situations such as calculations and loops, etc.  However I find it very tedious for boolean operations and greatly prefer ladder for that case.

Share this post


Link to post
Share on other sites

Maybe it’s a European thing :shrug:

Like Michael said, in certain cases it’s very useful. In my current project for example, I work with large amounts ascii strings and data set in Lwords, which need to be shifted or moved and referenced in various ways


Also I have remote in- and outputs from 40 individual stations for which I use arrays and lots of FOR TO loops and CASE statements  to make things easier to implement en modify. 

In my opinion, once you get the hang of it the possibilities are endless and it’s much less time consuming to write, especially when using loops.

Edited by andepand

Share this post


Link to post
Share on other sites

Oh and btw, thanks Michael,  reading A 270 as a DINT made me recieve some numbers

Share this post


Link to post
Share on other sites

I've only used it for creating function blocks for alternate PID equations, odd pump curves, a rather odd pH vs flow equation, and such oddball things crazy P.E.'s come up with.
 

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