Jump to content

hex string seperation


Recommended Posts

I'm trying to error catch incomming code. It comes in as a hex representation of ascii. (05 30 36 44...)

To make sure nothing gets lost the last to bits before the termination bit are a Xor calculation of all previous bits.

The problem is the formatting, here's an example:

Incomming string: 0546 4630 5244 3030 3030 3738 3243 0D

Xor of relevent bits = 2C This is one bit I now need to seperate the bit to match it with the 32 43 for 2 C.

I can't figure a way to seperate it since it is just 1 bit.

Thanks,

Nate

Link to comment

QUOTE(67nate @ Jun 29 2007, 09:34 PM)

Hi Nate

I think you are mixing bits and bytes a bit. (if you didnt just type bit instead of byte??) in any case, to clarify things: your "XOR'ed" value 2C = 3243 in HEX as you stated, which is 2 bytes, thous 16 bits (therefore the name "hex" = 16) and is written to the memory like this

(Pretending this is a 16 bit system, though computers usually have 32/64 bits).

(msb) 0011 0010 0100 0011 (lsb)

= 3243(HEX)

= 2^13 + 2^12 + 2^9 + 2^6 + 2 + 2^1 + 2^0

=12867(Decimal value)

=50 67(Decimal value written in byte pairs)

And another thing: Every string character represents a byte, and therfor 8 bits. so when you have 2 characters "2C" it is actually 2 bytes, 2x8=16 bits (im guessing there is no "NULL" terminator in your string since its in hex??

Gah, im starting to confuse myself...)

Provided a picture and a small .vi, trying to sort things out...

Hope this poor explanation vas somewhat useful.. :P im not good at explaining stuff...

Cheers

X

http://forums.lavag.org/index.php?act=attach&type=post&id=6279''>http://forums.lavag.org/index.php?act=attach&type=post&id=6279'>http://forums.lavag.org/index.php?act=attach&type=post&id=6279

Link to comment

Hi again, thanks for the help but I want to get the 2C and the 3243 in the same format so I can see if they are equal. I can't open your VI (I have only 7.1) so I'm not sure if those wires went down to do anything. I'm also not sure how to attach a picture. Anyway here is what I have I want string and XOR checksum to be the same.

Thanks,

Nate

P.S. I could add a screen shot if someone told me how. What would the URL be?

Link to comment

I'm trying to split the string. If I imput my own string I want to be able to split the check and append it to my string. So if the Xor check is 23 (one byte) I want to be able to change it to 32 33 (two bytes the first being the 2 and the second being the 3)

If there is a way to change the xor check from a hex string to a decimal sting without converting the value [23 (hex) = 23 (decimal)] that would work great.

Thanks,

Nate

Link to comment
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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...

Important Information

By using this site, you agree to our Terms of Use.