ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Intel Hex (https://www.excelbanter.com/excel-programming/421038-intel-hex.html)

Fan924

Intel Hex
 
Anyone have VB code that will convert Intel Hex to binary?

Rick Rothstein

Intel Hex
 

What is the difference between Intel Hex and ordinary Hex? For future
reference, it is always a good idea to provide examples of what you are
trying to do.

--
Rick (MVP - Excel)


"Fan924" wrote in message
...
Anyone have VB code that will convert Intel Hex to binary?



Fan924

Intel Hex
 
HEX
04 AF 30 C0 11 08 01 FF 40 5A 20 80 84 7C 88 A2
64 28 FC 4F F2 40 14 05 01 01 08 01 02 04 01 FF
00 0C 0C 3A 05 01 1E 3E 04 15 16 00 17 FE 80 03
01 8A 42 42 09 FF 93 60 4A 75 07 57 64 0D 4B 05
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF 78 FF FF FF FF
FF 37 31 FF 13 12 11 49 2F 10 7A 26 28 7A 26 28
12 A0 12 A6 12 C0 12 CA 13 76 13 98 13 A2 13 AC


Intel HEX
:100AD000005003D203F97A331206B2854FF0B5F015
:100AE000004002D204021056AF01AE00740112059C
:100AF000DD8F17743E931205CC743F932FFF740B58
:100B000093F8740C93F9120413EEF4F8EFF4F974FB
:100B10000B93FB740C93FCD3EE9BCF9CFBC2AB8F6F
:100B2000478B4888458946D2AB22751680751500DB
:100B300079007800223026012230270122157EE537

Intel HEX has a line number, then hex data, followed by a checksum of
the data on that line.

Rick Rothstein

Intel Hex
 

Do the example values represent the same data? I see 2 rows of 32 FFs in the
Hex example, but I don't see that type of repeat in the Intel Hex example.
If they do not represent the same data, then they are meaningless as
examples (it would be like saying "How do I convert base 10 numbers to base
12... here is an example of each 23 and 456?"). You don't have to give that
much data, one or two lines would be enough, but they should be of the same
underlying data.

--
Rick (MVP - Excel)


"Fan924" wrote in message
...
HEX
04 AF 30 C0 11 08 01 FF 40 5A 20 80 84 7C 88 A2
64 28 FC 4F F2 40 14 05 01 01 08 01 02 04 01 FF
00 0C 0C 3A 05 01 1E 3E 04 15 16 00 17 FE 80 03
01 8A 42 42 09 FF 93 60 4A 75 07 57 64 0D 4B 05
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF 78 FF FF FF FF
FF 37 31 FF 13 12 11 49 2F 10 7A 26 28 7A 26 28
12 A0 12 A6 12 C0 12 CA 13 76 13 98 13 A2 13 AC


Intel HEX
:100AD000005003D203F97A331206B2854FF0B5F015
:100AE000004002D204021056AF01AE00740112059C
:100AF000DD8F17743E931205CC743F932FFF740B58
:100B000093F8740C93F9120413EEF4F8EFF4F974FB
:100B10000B93FB740C93FCD3EE9BCF9CFBC2AB8F6F
:100B2000478B4888458946D2AB22751680751500DB
:100B300079007800223026012230270122157EE537

Intel HEX has a line number, then hex data, followed by a checksum of
the data on that line.



Rick Rothstein

Intel Hex
 

Alright, I did an online search to look up Intel Hex. Assuming the Hex
values' byte ordering is in correct order, this should do what you want...

NormalHex = Format(Mid(IntelHex, 10, 32), _
"@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@")


If the byte ordering is reversed, then maybe something like this will
work...

NormalHex = Format(Mid(IntelHex, 10, 32), _
"@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@")
Bytes = Split(NormalHex)
For X = 0 To 15: Bytes(X) = Mid(Bytes(X) & Bytes(X), 2, 2): Next
NormalHex = Join(Bytes)

--
Rick (MVP - Excel)


"Rick Rothstein" wrote in message
...
Do the example values represent the same data? I see 2 rows of 32 FFs in
the Hex example, but I don't see that type of repeat in the Intel Hex
example. If they do not represent the same data, then they are meaningless
as examples (it would be like saying "How do I convert base 10 numbers to
base 12... here is an example of each 23 and 456?"). You don't have to
give that much data, one or two lines would be enough, but they should be
of the same underlying data.

--
Rick (MVP - Excel)


"Fan924" wrote in message
...
HEX
04 AF 30 C0 11 08 01 FF 40 5A 20 80 84 7C 88 A2
64 28 FC 4F F2 40 14 05 01 01 08 01 02 04 01 FF
00 0C 0C 3A 05 01 1E 3E 04 15 16 00 17 FE 80 03
01 8A 42 42 09 FF 93 60 4A 75 07 57 64 0D 4B 05
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF 78 FF FF FF FF
FF 37 31 FF 13 12 11 49 2F 10 7A 26 28 7A 26 28
12 A0 12 A6 12 C0 12 CA 13 76 13 98 13 A2 13 AC


Intel HEX
:100AD000005003D203F97A331206B2854FF0B5F015
:100AE000004002D204021056AF01AE00740112059C
:100AF000DD8F17743E931205CC743F932FFF740B58
:100B000093F8740C93F9120413EEF4F8EFF4F974FB
:100B10000B93FB740C93FCD3EE9BCF9CFBC2AB8F6F
:100B2000478B4888458946D2AB22751680751500DB
:100B300079007800223026012230270122157EE537

Intel HEX has a line number, then hex data, followed by a checksum of
the data on that line.





All times are GMT +1. The time now is 01:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com