
adccommunitymod (AutomationDirect) asked a question.
Created Date: September 05,2006
Created By: InnoMach
**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****
I am struggling with an application that should be easier than I seem to be making it. Any help would be wonderful! I am loading 300 values into V2000 - Vxxx from an external app. Essentially, I have 100 sets of data 3 parts long. I want to cycle through this data 3 memory locations at a time. I just can't quite seem to figure out how to move the 3 memory locations and then, on the call for the next part, move the next 3. My problem seems to be the addressing of memory locations. Following is a short example: V2000 = 3 (part type) V2001 = 1870 (BCD length value) v2002 = 1 (load new material) this would comprise part #1. Part #2 uses V2003-V2005 and so on. My hangup is figuring how to index from V2007 to V2010 automatically. I was trying to just add 3 to a pointer value that would indicate the starting position for the next 3 word transfer. Hope the explaination is enough, and I am sure there is some very simple method to this, but this is my first go around with Koyo/AD and I am unfamiliar with all the little details. Thanks in advance for any insight!
Created Date: September 05,2006
Created by: franji1
It appears you 've learned about "pointers ", I'm hoping the only issue was that you used ADD BCD (ADD) vs. ADD Binary (ADDB) when "adding 3 ". Use the ADDB version (pointers are in binary, not BCD).
You should have something like
LDA 02000
OUT V1400
LDA O2001
OUT V1401
LDA 02002
OUT V1402
is the init code where V1400 thru V1402 are your 3 "pointers " to your CURRENT 3 data values
Then just do binary math on those 3 locations when you want to move to the next one:
LD V1400
ADDB K3
OUT V1400
LD V1401
ADDB K3
OUT V1401
LD V1402
ADDB K3
OUT V1402
or better yet, take advantage that these 3 pointers are pointing to 3 contiguous locations:
LD V1400
ADDB K3
OUT V1400
ADDB K1 // bump V1400's pointer value by 1 to get the proper pointer value for V1401
OUT V1401
ADDB K1 // similar logic for V1402
OUT V1402
The only part left is to know when to "trigger " the increment to "the next part " along with when to "reset " back to the base V2000 addresses.
I recommend using PD coil or differential contact to make an "event " based occurence of these two situations - you do not want to be doing these pointer calculations on every scan (unless it is possible that you DO need to do these adjustments from one scan to the next).
Created Date: September 05,2006
Created by: InnoMach
okay... perhaps I don't have pointers down quite the way I thought I did. I worked your suggestion into the program and get the following result (which probably works perfectly and I just don't know what I am doing with it!).
..|SP0|.......LDA 2000
.OUT V1400
..|C31|.......LD V1400
.ADDB K3
.OUT V1400
What I end up with is a value in V1400 of 400, and it increments by 3 each trigger event (C31). How do I use this value in a mov box to transfer the value? My appologies if I am being dense here! Thanks so much for the push in the right direction and with just a tad more help, I might just avoid an impending ulcer! http://forum1.automationdirect.com/board/smile.gif
Created Date: September 05,2006
Created by: InnoMach
Nevermind on the last post.... I got it. Thank you so much for the time and the assistance!
Created Date: September 05,2006
Created by: InnoMach
I am struggling with an application that should be easier than I seem to be making it. Any help would be wonderful!
I am loading 300 values into V2000 - Vxxx from an external app. Essentially, I have 100 sets of data 3 parts long. I want to cycle through this data 3 memory locations at a time. I just can't quite seem to figure out how to move the 3 memory locations and then, on the call for the next part, move the next 3. My problem seems to be the addressing of memory locations. Following is a short example:
V2000 = 3 (part type)
V2001 = 1870 (BCD length value)
v2002 = 1 (load new material)
this would comprise part #1. Part #2 uses V2003-V2005 and so on. My hangup is figuring how to index from V2007 to V2010 automatically. I was trying to just add 3 to a pointer value that would indicate the starting position for the next 3 word transfer.
Hope the explaination is enough, and I am sure there is some very simple method to this, but this is my first go around with Koyo/AD and I am unfamiliar with all the little details.
Thanks in advance for any insight!