Jump to content

Combining of two registers into one


Recommended Posts

Hello,

 

I am receiving a 15 byte long hex status message from a device over an RS-485 network and storing the message in an MI vector on a V570. The 5th and 6th bytes of the status message are the High and Low bytes of the value I want to display. the 5th byte stores in one MI and the 6th in the MI after (466 and 467). So if 5 is 04 and 6 is 8B I should get 1163 when converted to DEC. The values are coming in as 0004 and 008B, which if I convert gives me 262,283.

 

My question is how do I combined only the MSB of the two registers to achieve the number I am looking for? I tried mapping register bytes, but apparently this only works when the bytes are in the same register.

 

Thanks to anyone who can help me out with this.

 

Sincerely,

 

Jared

Link to comment
Share on other sites

Hello,

 

I am receiving a 15 byte long hex status message from a device over an RS-485 network and storing the message in an MI vector on a V570. The 5th and 6th bytes of the status message are the High and Low bytes of the value I want to display. the 5th byte stores in one MI and the 6th in the MI after (466 and 467). So if 5 is 04 and 6 is 8B I should get 1163 when converted to DEC. The values are coming in as 0004 and 008B, which if I convert gives me 262,283.

 

My question is how do I combined only the MSB of the two registers to achieve the number I am looking for? I tried mapping register bytes, but apparently this only works when the bytes are in the same register.

 

Thanks to anyone who can help me out with this.

 

Sincerely,

 

Jared

Hello Jared

 

So MI466 = 0004Hex and MI467 = 008BHex

 

Take MI466 shift it 8 places to the left and store the result in a spare MI(MI800).

Then bitwise or  MI467 to this in my example MI800 and this result you can store to another spare MI(MI801) and it contains then 1163.

MI466  00000000 00000100  after bitshift 8  MI 800= 00000100 00000000

                                                                       MI467 = 00000000 10001011

Result                                                             MI801=  00000100 10001011  (1163)

 

I don’t have Visilogic at the computer I’m making this post but if I'm correct you can find the bitshift and OR functions in Logic tab from ladder.

Hope this brings you to the solution?

 

Regards

Henny

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...