Sign in to follow this  
Followers 0
Wadlinx79

Using indirect addressing and xfer

11 posts in this topic

Hi... firstly thanks a lot to Mr Jay Hughes for the tutorial about using indirect addressing... I'm using CJ1M, trying to create some program to save data.... for example saving data from D1100 to D2000. Let say for the first product, using indirect addressing I save the data between D1100 to D1199. When the second product detected, the data will be save between D1200 to D1299, and continue with this pattern until reaching D1900-D1999. My problem is I try to transfer the data backward. Using XFER, for the first product data (D1100-D1199) I want to transfer to D1000-D1099, continuing with the second product data transfering to D1000-D1099 and the first data shifting to D1100-1199, like using WSFT command,so the new coming product data will be save inside D1000-D1099. Also because my data area I want to use until D2000, I want to clear the oldest data (when the 10th product come, the first product data all clear). I'm new to programming plc and still need to get use in using command. Any suggestion is appreciate... thanks again and sorry for my poor english

Share this post


Link to post
Share on other sites
Please make a block diagram picture and post here as .jpg

Share this post


Link to post
Share on other sites
Yes, a block diagram would help us to understand what you want to do. It may actually help you to see what commands also.

Share this post


Link to post
Share on other sites
Hi.... I've create acrobat file about my problem. Hope this will make it clear. And also thanks for giving your time. IndirectAddressing.pdf

Share this post


Link to post
Share on other sites
I'm sorry, but we need a block diagram showing where and when you want to move the blocks of data. I'm more confused that I was about your program. Something like this:

Share this post


Link to post
Share on other sites
I have an idea what you are saying, after this weekend when I get back from my trip and return to my normal computer I will poke at it if your question hasn't been solved. At the moment I do not have CX-P on the computers I have access to.

Share this post


Link to post
Share on other sites
Thank you, I'm looking forwafd for your reply. Anyway if it's difficult maybe I just keep the data without transfering it. i also created block diagram gif file (sorry I misunderstand block diagram meaning before) to make it better. Thanks all.

Share this post


Link to post
Share on other sites
After I studied your problem more, I am very much confused about what you are trying to do. For simplicity sake, I will call the 89 data areas by number, and not worry about their addresses, but when I refer to them you can imagine them as: D1 = DM11000~DM11099 D2 = DM11100~DM11199 D3 = DM11200~DM11299 D4 = DM11300~DM11399 . . . D89 = DM19900~DM19999 Now, if I understand you right, you want it to work like this: Step1:     D2 loaded with data from P1. Step2:     D3 loaded with data from P2;     D1 loaded with data from D2. Step3:     D4 loaded with data from P3;     D2 loaded with data from D1;     D1 loaded with data from D3. Step4:     D5 loaded with data from P4;     D3 loaded with data from D2;     D2 loaded with data from D1;     D1 loaded with data from D4 Step5:     D6 loaded with data from P5;     D4 loaded with data from D3;     D3 loaded with data from D2;     D2 loaded with data from D1;     D1 loaded with data from D5. Step6:     D7 loaded with data from P6;     D5 loaded with data from D4;     D4 loaded with data from D3;     D3 loaded with data from D2;     D2 loaded with data from D1;     D1 loaded with data from D6. etc... If my assumption is correct I think you are making things MUCH too complicated for yourself. You are moving data around too much, and a simple mistake can corrupt all of your data. If you are just looking to have a data storage method, why not try incrementing the pointers and setting it so that if the increment moves the pointer beyond the stack it will be set to your starting address again (basicly a rolling pointer. Only good if the pointer isn't changed by other methods) Another option (if you have a v3.0 CPU) is to make a funtionblock that is a block shift register. Please help clarify what you want to do so I can better dig into this. Right now this ladder looks scary because its loaded in one place, then moved to a previous location where it will eventually shift through its original location again (wasted time and energy!) also this method will cause errors once you reach paper 89 and move to paper 90. One word of caution from what I saw of your ladder, when you are moving data from one location to another, then moving other data into the previous location (like a shift register) you need to move the current data out first, then the new data in second!

Share this post


Link to post
Share on other sites
Hi, You should also have a look at the 'Table' data funtions, DIM(631), SETR(635) and GETR(636). Coulpled with the use of index registers (IR) and data regesters (DR) you can make some very 'nice' code when working with table records. The use of DR,IR (indirect addressing) with XFER can be very powerful. EG: Set up Data Table(1) of 10 records of 100 Words, starting at D10000 (records will be numbered 0-9) DIM &1 &100 &10 d10000 EG: store data for record 2, with data from d0 to d99 SETR &1 &2 ir0 XFER &100 d0 ,ir0 EG Move all records up 1 (overwrite record 10), and set new data for record 0 from new data stored in d0 to d99 SETR &1 &0 ir0 SETR &1 &1 ir1 XFER &900 ,ir0 ,ir1 XFER &100 d0 ,ir0 EG Select data from Record 5, 20th word (ie 20 item) and return to d200 SETR &1 &5 ir0 MOV +20,ir0 d200 (note that DR is constant in this case - +20) .... Tables can be an easy way to manage records once you get use to the indirect address registers (IR's and DR's) etc... Nibroc Edited by Nibroc

Share this post


Link to post
Share on other sites
I agree Nibroc. THat is what type of thing I would like to steer wadlinx79 towards. Unfortunately if you look at the way he has his plan for data flow, that method wont work. I surely hope that Wad isn't looking for something as complex as he asked for.

Share this post


Link to post
Share on other sites
Hi all... Thanks to Mr Chris and Mr Nibroc for the reply... I'ved check your reply long ago but unfortunately didn't have much time to reply back... Actually I've created my own program (my own way) by doing 2 times transfer (XFER)... using D1 to transfer new data to D2,D3 and so on... but my Japanese Programmer (actually Im not japanese) didn't really like my way because he said its to complicated(by the way I understand what he say), well maybe I'll have re-created again the program.... He had explain a little how he wanted the program to be like but I still can't get it right (Japanese Engineer stail of learning is do it yourself because its your own job and responsibility). Well that's that... wish me luck .... now I'm debugging my zx-t sensor to measure thickness.... and comes new problem .... well anyway thanks again for your help.... this is the best site ever

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