vasekd Posted November 13, 2017 Report Posted November 13, 2017 Hi all, how can I use indirect addressing in FB for CPU CJ2. For instance in this simple example (without using D500)
IO_Rack Posted November 13, 2017 Report Posted November 13, 2017 Since it is tag based, you'll have to use an Array instead. Edit the variable then click on Advanced.
Crossbow Posted November 13, 2017 Report Posted November 13, 2017 My understanding is that if the address is prefixed with @, the actual address referenced is based on the value in that register. So your second move command isn't writing to D500, it's looking at D500 and writing to the address indicated inside. So based on your example code, The value 123 is written to D1500.
vasekd Posted November 13, 2017 Author Report Posted November 13, 2017 Yes, I know it. But I need make it in FB ( It is onpy example. It will be more comlex function with start address as parameter - I will set start address on input FB and fuction use address space from it.)
Michael Walsh Posted November 15, 2017 Report Posted November 15, 2017 On 11/13/2017 at 8:26 AM, IO_Rack said: Since it is tag based, you'll have to use an Array instead. Edit the variable then click on Advanced. I second this comment. Use an array inside the FB with a variable as the index.
vasekd Posted November 15, 2017 Author Report Posted November 15, 2017 Thank you very much. Now it's quite understandable for me . I'll try it tomorrow.
innoaloe Posted November 16, 2017 Report Posted November 16, 2017 For FB typically we use the IR and DR register for indirect addressing. Although compared to the Decimal-based reference above (The @ tag) it's more complicated to use. But pretty reliable I'd say
Michael Walsh Posted November 16, 2017 Report Posted November 16, 2017 20 hours ago, innoaloe said: For FB typically we use the IR and DR register for indirect addressing. Although compared to the Decimal-based reference above (The @ tag) it's more complicated to use. But pretty reliable I'd say Yes, I tried to provide the simplest (although perhaps less capable) solution. If he does not need to access memory by address specifically (as many Omron FBs require to access memory for specific modules or functions), then this is much simpler.
vasekd Posted November 17, 2017 Author Report Posted November 17, 2017 Thank you for the explanation. It made me learn to use IR, DR. I think it will be a good solution for my program.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now