confusion about PIC24F program memory organization

Thread Starter

bug13

Joined Feb 13, 2012
1,954
Hi guys

We need to use a PIC24 we need a lot of IOs. Never use a PIC24 before, so I google and found this doc from Microchip:
PIC18F to PIC24F Migration: An Overview

There is an interesting graph on page 7 in the pdf, it says the PIC24F is "physically organized as 24 bits wide", but the PC address on the table only increase 2 every 3 bytes.

My question is:

If a PIC24F has 1000KB flash. Does it mean I can only actually use 750KB of the 1000KB, because the one instruction take up 1 phantom byte + 3 bytes (instruction).

or, if a PIC24F has 1000KB flash. I can actaully store 1500KB of data, because the address only increase 2 for every one instruction (3 bytes).

Capture.PNG
 
I've only messed with one PIC24 so far so I could be wrong... I would imagine if it says 1000kb you're going to have 1000kb. I do remember seeing how to read and write the third byte in the datasheet for the one I messed with. I'm thinking the whole "phantom byte" thing is due to the PIC24s being 16 bits and when reading or writing program memory you still have to give it a 16 bit value to work with.

There are PIC18 with just as much IO as a PIC24 so that is a bit confusing on your end.
 
I need about 90 IOs, I don’t seem to find a pic18 have that many IOs.
That is a lot of IO. I wasn't trying to discourage in any way. The 16 bit is why I used the one I did and it was fun learning it. Anyways...

I checked out the datasheet and calculated it out real quick for the 24fv32ka304 I used. Using the memory organization chart (page 37 of datasheet if you feel the urge) here is what I came up with: 11264 instructions * 3 bytes each = 33,792 bytes or actually 33k bytes. It is listed as 32k bytes so maybe they round down to the nearest 8 or whatever. Unless my calculations are wrong in any way.

Have you considered flip flops or the like to multiplex your IO or does it have to be individual pins? Just a thought.

Good luck!
 

John P

Joined Oct 14, 2008
1,897
The easiest way to increase pin count is with shift register chips--the 74HC595 for output and the 74HC165 for input, and you can connect them directly to an SPI port. But then you have to allow extra time for the I/O to occur, and maybe that's not acceptable.
 
Last edited:

Thread Starter

bug13

Joined Feb 13, 2012
1,954
That is a lot of IO. I wasn't trying to discourage in any way. The 16 bit is why I used the one I did and it was fun learning it. Anyways...

I checked out the datasheet and calculated it out real quick for the 24fv32ka304 I used. Using the memory organization chart (page 37 of datasheet if you feel the urge) here is what I came up with: 11264 instructions * 3 bytes each = 33,792 bytes or actually 33k bytes. It is listed as 32k bytes so maybe they round down to the nearest 8 or whatever. Unless my calculations are wrong in any way.

Have you considered flip flops or the like to multiplex your IO or does it have to be individual pins? Just a thought.

Good luck!
Most of the IOs need to be multiplex as inputs and outputs. So I think they have to be individual pins. Also there are some timing requirements on switching between inputs and outputs as well.
 
Top