Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

inside a hex file

Status
Not open for further replies.

overmind

New Member
hi im trying to create a downloader for my PIC. im using ccs compiler for my codes and im planning to create a downloader to download my hex file directly to the PIC. can somebody with a kind heart tell me or give a link as to how the hex file works? i mean how does it create the hex file? what is the basic operation involved? thanks in advance..
 
Ehh do you mean bootloader?? Im nit shure what you mean when you asy downloader...
 
hi.. yeah.. its a bootloader that i want to create. i want to use vb.. and thanks for the links futz. i'll look at it right now..
 
hi... my problem now is that how can i convert the hex file so that i can download it to the pic.. i believe i still have to do some manipulation on the hex file so that the pic can understand it. any ideas? thanks..
 
let me rephrase my question.. i am using a pic and a ccs compiler. as i understand, you write codes in c using ccs. then when you compile it, you create a hex file and then the hex file should be downloaded to the microcontroller.. my question is, how does other bootloaders do this? how do they transfer the hex file to the pic. what kind of manipulations do they perform on the hex file for it to be understood by the pic? please help..
 
overmind said:
let me rephrase my question.. i am using a pic and a ccs compiler. as i understand, you write codes in c using ccs. then when you compile it, you create a hex file and then the hex file should be downloaded to the microcontroller.. my question is, how does other bootloaders do this? how do they transfer the hex file to the pic. what kind of manipulations do they perform on the hex file for it to be understood by the pic? please help..

The HEX file is a standard Intel ASCII format, extended for the PIC's specific needs - the format is fairly simple, and is fully explained in the MPASM and MPLAB helpfiles.
 
I'll give a overly simple explanation.

Bootloader or programmer software reads the HEX text file, picks out a word(in ASCII, like e.g. 3F85) representing a 14-bit binary value, then send it out bit by bit in serial fashion 0010..... You will need to refer the datasheet to know the order the bits are sent, either MSB or LSB first.

The hardware on the programmer then set the logic level of its pin high/low according to the value of each serial bit it received. This level is read by the PIC and it will write it into its flash memory after it has gathered all 14-bits.
 
overmind said:
hi im trying to create a downloader for my PIC. im using ccs compiler for my codes and im planning to create a downloader to download my hex file directly to the PIC. can somebody with a kind heart tell me or give a link as to how the hex file works? i mean how does it create the hex file? what is the basic operation involved? thanks in advance..

It sounds like you want one PIC to download to another, it that correct? If you just want a bootloader, you would use the one that came with CCSC, no?
 
hi.. thank you for all your replies.. you have really helped me. But i have a few questions.

eblc1388 said:
You will need to refer the datasheet to know the order the bits are sent, either MSB or LSB first.

in the hex file created by the ccs compiler, how do i know where is the MSB or LSB? e.g. this is an excerpt from a hex file created by ccs. 10 00 00 00 00 30 8A 00 9A 28 00 00 23 30 84 00 83 13 00 08 FF. in the data part in bold, how do i know which ones are the LSB and MSB? and also in the microcontroller part, im using 16f877 pic, i tried looking at the datasheet, but it doesnt indicate how it wants to receive the data. MSB or LSB first.. please help.. thanks.

BeeBop said:
It sounds like you want one PIC to download to another, it that correct? If you just want a bootloader, you would use the one that came with CCSC, no?

no. i want to download from my PC to PIC. and i want to create a bootloader thats why im trying to understand the basic principles involved with this..
 
3v0 said:
Are you doing this because you want to or because you need to ?

CCS already has a bootloader to program into the PIC EX_BOOTLOADER.C /loader.c
and a program SIOW.EXE that runs on the PC to download the program.

You still need a way to program the bootloader on to the PIC initially...
 
Based on his previous posts he has a custom 16F877 board with what appears to be a bootload on it.
Pretty sure he does not have a hardware programmer.
 
overmind said:
10 00 00 00 00 30 8A 00 9A 28 00 00 23 30 84 00 83 13 00 08 FF. in the data part in bold, how do i know which ones are the LSB and MSB?

Your binary data are(in hex): 0x3000, 0x008A, 0x289A, 0x0000, 0x3023,.... with the checksum 0xFF at the end. These are placed into each address location of the PIC flash memory. Notices that because every word is 14-bit wide, the two MSDs would have to be in the range 0x00~0x3F.

To understand how one can handle these data and actually send them into the PIC, you need to get hold of the Microchip programming Spec document 39589b. It is for 16F87XA. I searched but there is no such document for 16F87X. Read it until you understand its content.
 
Status
Not open for further replies.

Latest threads

Back
Top