Searching \ for '[PIC:] Trying to interpret a .hex file' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'Trying to interpret a .hex file'.

Exact match. Not showing close matches.
PICList Thread
'[PIC:] Trying to interpret a .hex file'
2004\06\13@173641 by Anthony Toft

flavicon
face
It's driving me nuts!!!

I am trying to decode a hex file in Java, I read each line, and am
trying to decode the address. The line I am particularly interested in
is the configure bits, in a 16F627a hex file the address is 0x400e,
instead of 0x2007 (it is one bit shifted to the left). also the config
bits seem to be byte swapped (but the address and count not...

Any insights would be welcome...

Anthony
--
Anthony Toft <spam_OUTtoftatTakeThisOuTspamcowshed.8m.com>

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam@spam@mitvma.mit.edu with SET PICList DIGEST in the body

2004\06\14@002238 by Wouter van Ooijen

face picon face
> I am trying to decode a hex file in Java, I read each line, and am
> trying to decode the address. The line I am particularly interested in
> is the configure bits, in a 16F627a hex file the address is 0x400e,
> instead of 0x2007 (it is one bit shifted to the left). also the config
> bits seem to be byte swapped (but the address and count not...

A .hex file by itself is byte-oriented. The 12 an 14 bit PICs however
are word-oriented, and low-byte first.

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestspamKILLspammitvma.mit.edu

2004\06\14@094721 by Anthony Toft

flavicon
face
> A .hex file by itself is byte-oriented. The 12 an 14 bit PICs however
> are word-oriented, and low-byte first.

Once I got over the fact that the words where in fact 16 bit words of the pc and
the address needs to be divided by 2, and not the 14bit words of the PIC, the
problems went away (kinda).

Also the little endian-ness of the byte ordering is not a problem (now I know
it's there) as I can swap or not. So Wouter, does the Wisp628 take the bytes in
little or big endian form?

Anthony

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam.....mitvma.mit.edu

2004\06\14@101138 by Wouter van Ooijen

face picon face
> Also the little endian-ness of the byte ordering is not a
> problem (now I know
> it's there) as I can swap or not. So Wouter, does the Wisp628
> take the bytes in
> little or big endian form?

Wisp628 does not take a .hex file, it has its own communication format,
in which a 14 bit word is represented by 4 hexadecimal characters, in
high-to-low ordening.

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products

--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestspam_OUTspamTakeThisOuTmitvma.mit.edu

2004\06\14@102211 by Anthony Toft

flavicon
face
> Wisp628 does not take a .hex file, it has its own communication format,
> in which a 14 bit word is represented by 4 hexadecimal characters, in
> high-to-low ordening.

big endian, so I will have to switch them around :)

Thanks

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestspamspam_OUTmitvma.mit.edu

2004\06\14@124918 by Jan-Erik Soderholm

face picon face
Anthony Toft wrote :

> Wouter wrote :
> > Wisp628 does not take a .hex file, it has its own communication
> > format, in which a 14 bit word is represented by 4 hexadecimal
> > characters, in high-to-low ordening.
>
> big endian, so I will have to switch them around :)
>
> Thanks

Hi !
I have to ask,
are you writing something to replace XWisp (or XWisp2) ?

Since I'm using the Wisp682, I'm interested in keeping in
tuch with anything in that area...

Jan-Erik.

--
http://www.piclist.com hint: To leave the PICList
@spam@piclist-unsubscribe-requestKILLspamspammitvma.mit.edu

2004\06\14@131652 by Anthony Toft

flavicon
face
> I have to ask,
> are you writing something to replace XWisp (or XWisp2) ?

No, as an exercise for myself, I am writing a Java interface for the wisp628. I
will confer with Wouter once it's done with respect to his wishes for
distribution.

--
http://www.piclist.com hint: To leave the PICList
KILLspampiclist-unsubscribe-requestKILLspamspammitvma.mit.edu

2004\06\14@133351 by Jan-Erik Soderholm

face picon face
Anthony Toft wrote :

> > I have to ask,
> > are you writing something to replace XWisp (or XWisp2) ?
>
> No, as an exercise for myself, I am writing a Java interface
> for the wisp628. I will confer with Wouter once it's done with
> respect to his wishes for distribution.

OK, but then, what does this "interface" do ?
(That xwisp or xwisp2 doesn't do...)

I'm only asking to see if this could be something to add to
my "Wisp628-toolbox"... :-)

Jan-Erik.

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestTakeThisOuTspammitvma.mit.edu

2004\06\14@135842 by Wouter van Ooijen

face picon face
> I will confer with Wouter once it's done with respect
> to his wishes for distribution.

Wisp628 legal aspects summary:
- The Wisp628 firmware, circuit and PCB are (c)
- use of the Wisp628 firmware and circuit are allowed for DIY (details
on the webpage)
- for non-DIY use of the firmware and circuit buy pre-programmed
16F628(A) chips, or contact me for another arrangement
- I don't know whether a communication protocol can/should be
copyrightable at all, but the Wisp628 comms protocol sure is not
- my PC software (XWisp.py and wisp.pas/wisp.exe) is free for all
- most alternative PC software is free too

So no need to contact me for my wishes about your PC software, but of
course I don't object when you make it free software.

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products

--
http://www.piclist.com hint: To leave the PICList
spamBeGonepiclist-unsubscribe-requestspamBeGonespammitvma.mit.edu

2004\06\17@074909 by hilip Stortz

picon face
can someone please define "big endian" and "little endian" for me, i
understand that some machines have high byte first and small byte last,
and some are the other way around, which of these are which when using
the "endian" terminology?  fwiw, i have always preferred high to low
value order of bytes, since that's the way we write ordinary human
interpretable numbers, and it makes the most sense to me
computationally.  obviously there must be some logical or implementation
advantage to having them what i consider "backwards" that i don't
understand or know, that information would be appreciated as well.

Anthony Toft wrote:
{Quote hidden}

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2004\06\17@083931 by hael Rigby-Jones

picon face
>-----Original Message-----
>From: Philip Stortz [RemoveMEmadscientist.at.largespamTakeThisOuTEARTHLINK.NET]
>Sent: 17 June 2004 10:35
>To: PICLISTEraseMEspam.....MITVMA.MIT.EDU
>Subject: Re: [PIC:] Trying to interpret a .hex file
>
>
>can someone please define "big endian" and "little endian" for
>me, i understand that some machines have high byte first and
>small byte last, and some are the other way around, which of
>these are which when using the "endian" terminology?  fwiw, i
>have always preferred high to low value order of bytes, since
>that's the way we write ordinary human interpretable numbers,
>and it makes the most sense to me computationally.  obviously
>there must be some logical or implementation advantage to
>having them what i consider "backwards" that i don't
>understand or know, that information would be appreciated as well.

Little Endian has the Least Significant word at the lowest address, Big
Endian has the Most Significant word at the lowest address.

On a PIC, the "endianess" is determined by the software functions that
handle multi-byte calculations, i.e. you could store the LSB at the highest
or lowest address.  On 16/32 etc bit micro's the achitecture of the mico
itself determines this.

Regards

Mike




=======================================================================
This e-mail is intended for the person it is addressed to only. The
information contained in it may be confidential and/or protected by
law. If you are not the intended recipient of this message, you must
not make any use of this information, or copy or show it to any
person. Please contact us immediately to tell us that you have
received this e-mail, and return the original to us. Any use,
forwarding, printing or copying of this message is strictly prohibited.
No part of this message can be considered a request for goods or
services.
=======================================================================
Any questions about Bookham's E-Mail service should be directed to
EraseMEpostmasterspambookham.com.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2004\06\17@091452 by Sergio Masci

picon face
----- Original Message -----
From: Philip Stortz <RemoveMEmadscientist.at.largeEraseMEspamEraseMEEARTHLINK.NET>
To: <RemoveMEPICLISTspam_OUTspamKILLspamMITVMA.MIT.EDU>
Sent: Thursday, June 17, 2004 10:35 AM
Subject: Re: [PIC:] Trying to interpret a .hex file


{Quote hidden}

Have a look at:
http://xcprod.com/titan/ASM-DOC/COMPILER/endian.html

Also try adding a 16 bit variable to a 32 bit variable where you have a pointer
to each variable and  the CPU only has an 8 or 16 bit accumulator and carry.

Regards
Sergio Masci

http://www.xcprod.com/titan/XCSB - optimising PIC compiler

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2004\06\17@093521 by Anthony Toft

flavicon
face
> >have always preferred high to low value order of bytes, since
> >that's the way we write ordinary human interpretable numbers,

Yes, humans are big endian

> >and it makes the most sense to me computationally.  obviously
> >there must be some logical or implementation advantage to
> >having them what i consider "backwards" that i don't
> >understand or know, that information would be appreciated as well.

When you get into hardware, there is some efficiency to be gained with little
endian, the main example being when you perform multibyte arithmetic you can
take an address and add the LSByte, increment the addresses and the next
significant etc. In a big endian machine, you take the address, add the number
of bytes and subtract to move to the more significant bytes.

> On a PIC, the "endianess" is determined by the software functions that
> handle multi-byte calculations, i.e. you could store the LSB at the highest
> or lowest address.  On 16/32 etc bit micro's the achitecture of the mico
> itself determines this.

Yep, in 8 bits endian-ness rarely comes into the equation, but bigger than that
(line in the case of the 14bit program words) there _can_ be issues. I
originally posted the question with regards to the config bits (14 bits) that
I had calculated as 0x3F2A (IIRC) but in the hex file as 0x2a3F. Not an issue
as it's easy to switch them round, but I didn't know if I needed to (Wouter's
answer was I didn't).

Off topic but very related...
Intel is little endian, Sun, SGI and Motorola 680x0 are all big endian (those
are the ones I know with a degree of certainty)

All interchangable file formats and network communications specify what they
use (usually big endian) and sometimes refer to it as "network byte order".

Most C libraries (most as I can't honestly say "all") implement functions to
switch between network and host order, sometimes they do nothing (in the case of
SPARC). Java doesn't, it's part of the input stream specification.

{Quote hidden}

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2004\06\17@095823 by David VanHorn

flavicon
face
At 09:35 AM 6/17/2004 -0400, Anthony Toft wrote:

>> >have always preferred high to low value order of bytes, since
>> >that's the way we write ordinary human interpretable numbers,
>
>Yes, humans are big endian

That is probably the clearest way to define this, that I've ever seen. :)

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2004\06\17@100014 by hilip Stortz

picon face
thank you!  i'm glad the definitions are at least logical to me, it
makes thought much less confusing when definitions make sense.

Michael Rigby-Jones wrote:
--------
{Quote hidden}

---------

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2004\06\17@100721 by hilip Stortz

picon face
so are pc's little or big endian?  from your example, apparently some
find incrementing a counter more "logical" even if it means the storage
format is "less logical", by my thinking at least.  myself, i've never
had much preference for increment or decrement, after all, stacks to one
and heaps to the other, and both are often used in the same software
environment.  i can see where there would have been a little endian
preference on very early machines that had autoincrement instructions
but not autodecrement instructions, and on machines that still only have
one.  i must admit i'm mostly familiar with the 68k family which i find
delightful even in assembly.

Anthony Toft wrote:
{Quote hidden}

---------------

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2004\06\17@102625 by Anthony Toft

flavicon
face
> so are pc's little or big endian?  from your example, apparently some

Intel's 8, 16 and 32 bit processor (8088->pentium) are little endian as are the
compatibles. I don't know about the Opteron and Itanium for sure, but my money
is on little endian.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2004\06\17@102833 by Ken Pergola

flavicon
face
part 1 830 bytes content-type:text/plain; (decoded 7bit)


FYI:

The origin behind the terms little-endian and big-endian is an interesting
read:


Quoted from http://www.maxmon.com/1726ad.htm:

"In 1980, a famous paper written by Danny Cohen entitled "On Holy Wars and a
Plea for Peace" used the terms big-endian and little-endian to refer to the
two techniques for storing data. These terms, which are still in use today,
were derived from that part of Gulliver's tale whereby two countries go to
war over which end of a hard-boiled egg should be eaten first -- the little
end or the big end!"


Best regards,

Ken Pergola


P.S.

Attached is the Intel Hexadecimal Object File Format Specification

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.




part 2 29255 bytes content-type:application/pdf; (decode)

2004\06\17@103758 by hilip Stortz

picon face
sounds typical, and highly amusing.  it's much like the chronically
over-blown war between pc and mac users (i prefer macs, but i'll be
using both very soon, and i certainly can make either work most of the
time, pc's just fight you a little more).

Ken Pergola wrote:
{Quote hidden}

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2004\06\17@104242 by Dave Tweed

face
flavicon
face
Philip Stortz <EraseMEmadscientist.at.largespamspamspamBeGoneEARTHLINK.NET> wrote:
> can someone please define "big endian" and "little endian" for me, i
> understand that some machines have high byte first and small byte last,
> and some are the other way around, which of these are which when using
> the "endian" terminology?

"Big-endian" means the big end (MSB) of the number is at lower addresses,
while "little-endian" means the little end (LSB) appears first.

> fwiw, i have always preferred high to low value order of bytes, since
> that's the way we write ordinary human interpretable numbers, and it
> makes the most sense to me computationally.  obviously there must be some
> logical or implementation advantage to having them what i consider
> "backwards" that i don't understand or know, that information would be
> appreciated as well.

When adding or subtracting multiple-precision numbers, you need to start
processing at the little end of the number, so it makes a certain amount
of sense to store them little-endian so you get to that part first.

Also, if you number bits right-to-left within a word in the order of their
significance, it makes it more consistent to also number the byte/words in
order of their significance by storing them little-endian.

Intel, being first on the scene with single-chip microprocessors, chose
little-endian, for any or all of the above reasons. Motorola had to go
with big-endian in order to avoid patent problems.

-- Dave Tweed

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2004\06\17@105910 by Russell McMahon

face
flavicon
face
> Intel, being first on the scene with single-chip microprocessors, chose
> little-endian, for any or all of the above reasons. Motorola had to go
> with big-endian in order to avoid patent problems.

Grew up on Motorola 6800 family. Big Endian has made much more sense ever
since :-)
Mother Duck syndrome.


           RM

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2004\06\17@165050 by Vince Herman

picon face
Of little to no value, the terminology comes from
Gulliver s Travels, where the Lilliputians main
political issue was whether to eat their eggs from the
big end or the little end. :)
I guess that this is borderline [OT] ?
--- Philip Stortz
<RemoveMEmadscientist.at.largeKILLspamspamEARTHLINK.NET> wrote:
{Quote hidden}

__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2004\06\17@173933 by Alex Harford

face picon face
I missed the OP but an excellent page on endianness is at wikipedia:
http://en.wikipedia.org/wiki/Endianness

On Thu, 17 Jun 2004 13:50:10 -0700, Vince Herman <vincehermanSTOPspamspamspam_OUTyahoo.com> wrote:
>
> Of little to no value, the terminology comes from
> Gulliver s Travels, where the Lilliputians main
> political issue was whether to eat their eggs from the
> big end or the little end. :)
> I guess that this is borderline [OT] ?

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2004\06\17@192559 by Bill Westfield

face picon face
> can someone please define "big endian" and "little
> endian" for me, i  understand that some machines have high byte first
> and small byte last, and some are the other way around, which of these
> are which when using  the "endian" terminology?

You want to see the early-arpanet document "IEN137 - On Holy Wars and a
Plea for Peace"; I'm pretty sure that's the first instance of tying the
"endian" term to computer architecture.

BillW

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2004\06\17@222013 by Lee Jones

flavicon
face
>>> have always preferred high to low value order of bytes, since
>>> that's the way we write ordinary human interpretable numbers,

> Yes, humans are big endian

But even humans do math in little endian fashion.  Take the case
of addition of a multi-digit number.  You sum the rightmost digit
column first, have 1 digit of result, and a carry.  Then you do
the adjacent column of digits plus the carry digit from the just
completed column.  Repeat until all digit columns are done.  That
is little endian arithmetic.

                                               Lee Jones

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2004\06\17@225200 by Anthony Toft

flavicon
face
> But even humans do math in little endian fashion.  Take the case
> of addition of a multi-digit number.  You sum the rightmost digit
> column first, have 1 digit of result, and a carry.  Then you do
> the adjacent column of digits plus the carry digit from the just
> completed column.  Repeat until all digit columns are done.  That
> is little endian arithmetic.

_All_ arithmetic is done this way or you have to multi-pass it (abacus
math is done this way when) Endian-ness usually only refers to the order
in which bytes are stored.

BTW date formats are an example of humans _not_ using the normal big
endian order, Europeans use little endian (d/m/y) Japanese big endian
(y/m/d) and Americans 'middle endian' (m/d/y) and you won't believe how
much confusion that caused me when I moved here :) Even now 8 years
later I still use month names to avoid confusing myself.


--
Anthony Toft <spamBeGonetoftatSTOPspamspamEraseMEcowshed.8m.com>

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2004\06\19@102219 by dr. Imre Bartfai

flavicon
face
On Thu, 17 Jun 2004, Anthony Toft wrote:

> BTW date formats are an example of humans _not_ using the normal big
> endian order, Europeans use little endian (d/m/y) Japanese big endian
> (y/m/d) and Americans 'middle endian' (m/d/y) and you won't believe how
> much confusion that caused me when I moved here :) Even now 8 years
> later I still use month names to avoid confusing myself.
>
FYI: Hungarian is the most consequent big endian I know. Not only date but
all structures of life are treated as big endian: postal addresses (city,
street, number), name (family name, surname), of course date (y.m.d) &c.

Regards,
Imre

--
http://www.piclist.com hint: To leave the PICList
KILLspampiclist-unsubscribe-requestspamBeGonespammitvma.mit.edu

More... (looser matching)
- Last day of these posts
- In 2004 , 2005 only
- Today
- New search...