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.

PIC 16f877 hex file size... i am a little confused

Status
Not open for further replies.

GraveYard_Killer

New Member
i have a program for my PIC16f877 in hex file, and it is 25.4KB as seen on the properties of windows explorer and the compiler says that i had used total of 3296 words. how do i know if the PIC's flash memory will be full by just looking at the size of the hex file or the total number of words used?

i read the PIC16f877 has 8k X 14words. in my interpretation, PIC can handle (8*14k)= 112k of words? are my interpretations correct? TIA
 
GraveYard_Killer said:
i have a program for my PIC16f877 in hex file, and it is 25.4KB as seen on the properties of windows explorer and the compiler says that i had used total of 3296 words. how do i know if the PIC's flash memory will be full by just looking at the size of the hex file or the total number of words used?

The number of words is what matters, the HEX file will be far larger, and the size of it's not of much help to you.

i read the PIC16f877 has 8k X 14words. in my interpretation, PIC can handle (8*14k)= 112k of words? are my interpretations correct? TIA

No :!:

The 16F877 is a 14 bit PIC, this means that each program memory location is 14 bits wide - and can hold a single instruction.

This means you have a total of 8,192 available program locations, the 8K refered to in the datasheet.

You should also be aware that memory is paged in 2K sections, you need to set extra bits in a register when you jump between pages. If you're using a high level compiler, this should already do that for you.
 
thanks for the reply.

last question. how many words am i limited in pic16f877? i mean, how many available total words may i program into a blank pic16f877?
 
Nigel Goodwin said:
You should also be aware that memory is paged in 2K sections, you need to set extra bits in a register when you jump between pages. If you're using a high level compiler, this should already do that for you.

What would happen if we didn't set those bits??? I'm about to code a digital alarm clock up and i'll guarantee that it will be over the 2000 words mark. MPLAB is a low-level compiler isn't it??
 
pike said:
What would happen if we didn't set those bits??? I'm about to code a digital alarm clock up and i'll guarantee that it will be over the 2000 words mark. MPLAB is a low-level compiler isn't it??

MPLAB isn't a compiler at all, it calls MPASM - which is an ASSEMBLER.

If your code goes over a 2K barrier you have to set the paging bits for any jumps or calls that cross the boundary - if you don't they won't jump to the correct address.

For a very crude illustration - assuming you have a routine at address 2200 (I'm ignoring the fact of binary 2K for this illustration) and you call it from address 5 (just after the interrupt address). It will jump to address 200, and NOT 2200 - which is VERY likely to cause problems in your code!.

Again, bear in mind the values were for simplicity, and not actual correct figures!.

There's a MACRO you can use that sets the paging bits for you, but it adds a fair few lines throughout a program.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top