Sign in to follow this  
Followers 0
GooF

indirect adressing of bits and words in a function block

6 posts in this topic

hello, i'm new in programming omron. i think i know the basics. now i have a special problem. i want to great a function block with an input variable of type int. the input variable shall be the first word of a cio area. example: - the input variable is &3200 - in the function block i want to work with 3200, 3201, 3202 and 3203 (it is input adress +0, +1, +2 and +3) the problem is, i dont know how to do this with bits. extended example: - the input variable ist &3200 - in the function block i want to work with all bits of the word 3200 and the full word 3201, 3202 and 3203 (it is input adress +0, +1, +2 and +3) for the word i have several ways for indirect adressing: - working with ir and dr with an internal variable on adress 0 - an internal variable on adress 0 with array but i have no idea to address bits and words. is there a good solution? thanks (sorry for my bad english)

Share this post


Link to post
Share on other sites
The PLC is a CJ2H.

Share this post


Link to post
Share on other sites
thanks. this works. i found a second solution by using a user data type. works fine. but there is a new question. now i want to define which memory area i want to use. example: - the first input variable defines the memory area (D, W, H, EM0, ...) - the second input variable defines the first word in the area (like the &3200 in the first example) in the function blocks of the omron lib, the variables are called AreaID and AreaNo. the AreaID is a number for a memory area. they use the standard symbols like P_CIO or P_EM0 for define the area. in the function block, the AreaID is compared with the Number of the standard symbols and if the compare is true, a IR is loaded with the first word of the memory area. sorry, i cant explain it in good words. short version: - a input variable AreaID, the parameter for Area_ID ist P_EM0 (P_EM0 is the symbol for A461, the value is #0050) - in the function block, the AreaID is compared with several values - if the AreaID is compared with #0050, compare ist true and the IR0 is loaded with the Pointer on EM0_0 - this compares exists for every memory area my question: is this the only way for define a memory area?

Share this post


Link to post
Share on other sites
Hi, I answered to a similar question earlier, see link to topic. http://forums.mrplc.com/index.php?showtopic=20988&st=0&p=101206entry101206

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
Sign in to follow this  
Followers 0