Storing a couple of bytes in a word (AB SLC)

wnkook

Member
Join Date
Oct 2003
Location
Akron, Ohio
Posts
18
Hello,

I want to Store two differant values into one integer file.
IE:
1st Value = 50
2nd Value = 120

Integer = -4046

I'm breaking bits 0 thru 6 for value 1 & bits 9 to 15 for value 2

The question is: How to I store and read these two values from 1 integer address.

Just unsure of how to impliment it, do not have a plc to try it out on. Will be doing my debug at the customers during the downtime. But if I can hand check the process it should work there.

Any help would be appreciated

Thanks,

Jason
 
1. By your assigning 7 bits for each value storage you are saying that they will never be greater than 127. Make ABOSULUTELY SURE that this is correct (especially Value 2) before storing these or you'll have trouble with negatives.

2. Instead of 9 - 15, store the second value in 8 - 14 leaving the top bit of each 8 alone.

3. Storing is easy: MUL, Value 2, 256, Target - ADD Target, Value 1, Target

4. Retrieving is a little harder: MVM, Target, 00FFh, Value 1 - MVM, Target, FF00h, Value 2 - DIV, Value 2, 256, Value 2
 
Thanks

I starting trying how i could do it in a micrologix here at the shop.

Got it to where it works just about 15 lines of logic and a couple extra words for temp storage.

(was latching bits in another word based off of the bits used in value2 then doing some masked moves like you did)

Yes the value will never go past 120....

This is for Hz on a conveyor system.

I need to change the hz based on differant parts. currently i'm told everyhting is below 60 Hz on all parts.

Thanks again,

Jason
 
Why not use the Swap function. Then you could byte-allign everything. That is unless you HAVE to store data in the particular bits you named...

Use the Swap to put a low byte to the high byte (or vv) the rest can be done with MVM instructions.

Good Luck,

(8{)} ( .)

(Yosi)
 

Similar Topics

HI all, I have a backup from a Series 7000 Cognex camera. I am trying to restore and see the vision tools used in the job. Can I restore those...
Replies
0
Views
75
Hello, I have an int variable that updates the value every second. I want to store the 100 values in an array. Array should keep storing the...
Replies
7
Views
1,015
Hi I have a vision camera that I’m getting the string data P908765 from the vision on an advance trigger .which im using a S -move. Then I put...
Replies
1
Views
384
Hello You guys helped me with a similar issue some time back on storing totalized values to different tags each month. I have a similar issue...
Replies
19
Views
1,521
Is there any easy way to store a password for an email address that is changeable on the HMI that is not easily deciphered. aka, don't write it to...
Replies
0
Views
385
Back
Top Bottom