Sign in to follow this  
Followers 0
mracer

Moving data and reseting len bit

12 posts in this topic

I would like to ask for input from the site on this programming problem I have. This is what I am trying to do. I have a bar code reader that sends a string file to st10.0 in a micrologix 1100. In order for the reader to send the next data set, It need to see a “0” in the st10.len bit in the ML1100. I have set up some code to move the data around based of the size of the string. That is if st10.len = 5, it will copy the data to st10:2 (Employee number) This data will be used with Plantmetics to track machine operating data. That is all working. What I am having a problem with is clearing st10.0.len so the next data can be sent and now loosing the first data set. I’m not that informed on how to use a “one shot” relay/contact. I am looking for someone to spark the thought process and get me out of this writer’s block I am in. Thanks everyone I have gained much by reading what you all post. Racer

Share this post


Link to post
Share on other sites
Can you post your program or at least a snippet of what you have? I don't think I'm quit following you.

Share this post


Link to post
Share on other sites
What is going on if the machine operator uses a scanner to input his ID number, work order number, and a reason code if needed. I have code setup to copy that data to a new location based of the "len" bit. The problem i am having is clearing the data out so the next file will up load from the bar code reader. If I clear it manually, the next data is sent. I don't have it here at home sorry. I'm also not good at explaining myself sorry. Racer Edited by mracer

Share this post


Link to post
Share on other sites
No its probably me. I've been looking at this computer all day. I'll look at it tomorrow with fresh eyes

Share this post


Link to post
Share on other sites
So, in the rung above the COPY operation you describe, I think you should add an EQU instruction that compares the source (ST:10) and destination (ST:2) and if they match, trigger a one-shot to an output instruction to RES ST:10.LEN. That way, on the next scan ofter the copy takes place, the LEN will be rest to zero and you are ready to go. The ONS can be assigned any discreet memory bit address, typically something like B3:1/0. Hope that helps. Bill

Share this post


Link to post
Share on other sites
I might be wrong but... I don't think you can RES ST:10.LEN The .LEN part is read only, created by the ML1100 as is counts string bytes. What I did was keep one ST empty. Then if I need to "Clear" a ST I COP the empty one into it. Since it's empty the .LEN is zero. That seems to work for me.

Share this post


Link to post
Share on other sites
Don't have actual machine to work with but I seem to recall in RS500 having to keep a "null string" or empty zero length around for clearing strings when I needed the len = 0. This is due in part to if your old string was abcdefgh and your new string is abcde the fgh are still hanging around and you get corrupt data if all you do is zero the length.

Share this post


Link to post
Share on other sites
That is probably correct, Bob. For Mracer: I think the general consensus here is that you need to do the compare as I described above, then cause the "source" to be reset using a MOV or COP instruction to get a null value into the source, and you'll be good to go. Let us know. Bill

Share this post


Link to post
Share on other sites
I have tryed to add a snap shot, but I can't seem to get it to work. sorry I understand how to copy the blank data to the st10 file but I'm not sure how to make sure that the data has been moved so I don't over write it too soon. Edited by mracer

Share this post


Link to post
Share on other sites
Tested this on an SLC 5/04 I have, but the concept should be solid for an ML1100. Strings.zip

Share this post


Link to post
Share on other sites
Thanks Bob, I did get something working right at the end of the day today. I'll take a look at what you have and see how I'm doing. I wound up using a timer with the cop. The the timer DN is the rung higher so the st10 gets reset before it is scanned. seemed to work OK. I could never get the one shot to work right. If i could figure out how to dost it on here I would. Racer

Share this post


Link to post
Share on other sites
Use the following instruction: MOV 0 ST10:5.LEN This moves zero into the length. Rick DeMorrow Real Time Automation

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