Sign in to follow this  
Followers 0
professor_jonny

memory adressing method questions.

6 posts in this topic

HI there What I'm wanting to know is there another method for adressing memory do find d1000 for example? I want to decode a number entered in the socket service data area to find the string length of the data stored in that location. In the socket service parameter area (d30024 and d30025) for eth unit 0 defines the left and right most data address to pick data to send or recieve via eithernet. If i put #8200 #0000 it will read from address d0 for the data to send for example or If i put #8203 #e800 it will read from address d1000 How do i find the string length that d30024 and d30025 point to by decoding the data stored there? I know I can bit shift to get the value #03e8 or &1000 from those two channels but i dont know how to use it to locate address d1000. is this what indirect adressing is for using the @ and * symbols in instructions ? i would of thaugh this would be classed as direct binary adressing rather than indirect and im a little confused. If i stored #03e8 in d10 (the output of bit shifting d30024 and d30025 and then used LEN$ @d10 d20 would this then give me the string lenght of the data that d30024 and d30025 point to that happens to be from starting from d1000? If not how would I acomplish that? if so how do i address the w memory or cio etc...? I wish to send many blocks of data and the string length for each block is variable and the amount of blocks to send is variable also. If i could just type in the start address, how many blocks of data and the distance between blocks starting position and it could figure out all the string lenghts and locations by simple addition from the last block to find the next one. Edited by professor_jonny

Share this post


Link to post
Share on other sites
Yes. You could have tested it faster than it took you to write the post though. @D is indirect addressing using integer values as the pointer. *D is indirect addressing using BCD values as the pointer. When using indirect addressing pointer is a variable location that you can change. When you are not using indirect addressing, the address that you are using (in the LEN$ instruction in this instance) is fixed. Each of these methods allows you to only point at D memory locations. If you need higher functionality indirect addressing, or you need to do indirect addressing in memory areas besides the D area, read up on using IR and DR.

Share this post


Link to post
Share on other sites
I guess yes it took longer to write than try but in my defence i was at home not at work at the time Thanks for your reply I'm on the right track now.

Share this post


Link to post
Share on other sites
I have now found out that you cant put indirect addressing inside function blocks

Share this post


Link to post
Share on other sites
For future reference: You can use simulator in CX-Programmer to test this kind of thing...even at home. Assuming that you have CX-One on the PC that you have with you.

Share this post


Link to post
Share on other sites
You can use IR and DR indirect addressing methods inside function blocks, but not @D and *D. You could also use the AT functionality to point a variable at a specific D address and then configure and array and use a pointer as the index. Like this (pic below is the inside of the FB): I used all internal variables in my example so that you could see them all in the same picture. Pointer and Test_Condition would likely be inputs and Result would likely be an output. Setting Array_of_D up as having an AT setting of D0 and being an array of Words with 5000 members gives you access to D0 - D4999 using Pointer as the index from 0-4999.
1 person likes this

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