CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Hex file for a slightly different target

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
TL



Joined: 15 Sep 2003
Posts: 75

View user's profile Send private message

Hex file for a slightly different target
PostPosted: Tue Jan 05, 2010 4:28 am     Reply with quote

I have an old hex file for a PIC18F6720 target but no source files. As this chip is becoming old, I’m trying to replace it with a PIC18F6722 target because it is cheaper.

How do I modify my old hex file for a PIC18F6722 target without getting error messages on the PM3 programmer or other programmers?

Thank you.

NOTE:
I have actually imported this old hex file into MPLAB and selected PIC18F6722 for the device and created a program entry for the PM3 programmer. I programmed the PIC18F6720 target but got the following error message:

Failed!
....... address expected read
pgm 00000 006A3B 00000


Despite the above error message, the PIC18F6720 target worked on my application.

Will I get the above error message for a PIC18F6722 target using the PM3 programmer?

I cannot find "006A3B" in my old hex file? Where is that come from?

What does the above "pgm" line mean? I couldn't find it in the MPLAB-HELP-PM3.
Ttelmah
Guest







PostPosted: Tue Jan 05, 2010 6:04 am     Reply with quote

First, the programmer error, has nothing to do with the hex file....
You can write anything into a chip. 'God save the queen' if you want. The programmer couldn't care, and neither could the chip (within the limitation that for example, you couldn't put a 16bit value into a memory cell tht only holds 14bits). Having written it, the programmer attempts to verify that what is really in the chip, matches what _it_ has written. The lines you print, show that it doesn't.....

Now, the lines are saying, that these are the very first couple of memory locations. 'address = 0'. To 'find' the data, the easiest way, is not to look at the hex file. Reading a hex file, is hard. There is nothing to stop to from containing (for example), one byte to write to the first byte of memory, in one line, and then the byte for the second location, in another line. Bytes don't have to appear in the order that they finally end up in the chip. Easiest way, is to simply load the hex file into MPLAB, and then look at the program memory window, with the 'opcode hex' option selected. You then get a window, representing the memory contents, with the data put in the same order as it'd appear in the final chip. Makes things a lot easier.....

The error could represent a number of possible things. The first, is that the chip is simply faulty. However this makes it then working, unlikely. The other obvious one, is that code protection is enabled in the hex file, so your programmer writes the data, and then can't verify it. MPLAB, will allow you to check this, by simply selecting 'configure', 'configuration bits', and seeing if any of the protection bits are set. In this case, you would be best to write the chip with the bits turned off, verify, and then turn them on.

As for whether it'll work, it is difficult to know. Realistically, 'try it'. Things that are different, are the low voltage detect module, which has extra features for detecting high voltage on the 6722. There is also an ECCP option on the later chip, but this defaults to working like the standard CCP, so shouldn't cause a problem. There are a few extra features regarding low power opration, but most default to behaving like the older chip, unless deliberately modified. One are you should look at with care, are any errata on the later chip, since unless these are the same, it is unlikely that your code will handle these.

Best Wishes
TL



Joined: 15 Sep 2003
Posts: 75

View user's profile Send private message

PostPosted: Thu Jan 07, 2010 3:28 pm     Reply with quote

Hi Ttelmah,

Thank you for your comments. Yes, you made an interesting comment on code protection of the hex file. I have removed it and now I'm getting some minor differences in CONFIG bits between expected and read.

I'll probably get a 6722 sample and modify the CONFIG bits in the original hex file to match the ones in the 6722 target, and see what happens.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group