Jump to content

Recommended Posts

Hi,

 

I'm trying to use a PIC18F85J50 and I ran across something in the datasheet that I'm not sure how to do. It says the following about the configuration words:

 

"Configuration data is stored in the four words at the top

of the on-chip program memory space, known as the

Flash Configuration Words. It is stored in program

memory in the same order shown in Table 25-2, with

CONFIG1L at the lowest address and CONFIG3H at

the highest. The data is automatically loaded in the

proper Configuration registers during device power-up.

When creating applications for these devices, users

should always specifically allocate the location of the

Flash Configuration Word for configuration data. This is

to make certain that program code is not stored in this

address when the code is compiled."

 

Does "at the top of the program memory space" mean starting with 0x0000?

How do I allocate these locations? Also the table of locations doesn't make sense to me. What does the following mean?

 

Configuration Byte | Code Space Address | Configuration Register Address

CONFIG1L | XXXF8h | 300000h

CONFIG1H | XXXF9h | 300001h

CONFIG2L | XXXFAh | 300002h

CONFIG2H | XXXFBh | 300003h

CONFIG3L | XXXFCh | 300004h

CONFIG3H | XXXFDh | 300005h

 

Thanks,

Moses

Link to post
Share on other sites
Hi,

 

I'm trying to use a PIC18F85J50 and I ran across something in the datasheet that I'm not sure how to do. It says the following about the configuration words:

 

"Configuration data is stored in the four words at the top

of the on-chip program memory space, known as the

Flash Configuration Words. It is stored in program

memory in the same order shown in Table 25-2, with

CONFIG1L at the lowest address and CONFIG3H at

the highest. The data is automatically loaded in the

proper Configuration registers during device power-up.

When creating applications for these devices, users

should always specifically allocate the location of the

Flash Configuration Word for configuration data. This is

to make certain that program code is not stored in this

address when the code is compiled."

 

Does "at the top of the program memory space" mean starting with 0x0000?

How do I allocate these locations? Also the table of locations doesn't make sense to me. What does the following mean?

 

Configuration Byte | Code Space Address | Configuration Register Address

CONFIG1L | XXXF8h | 300000h

CONFIG1H | XXXF9h | 300001h

CONFIG2L | XXXFAh | 300002h

CONFIG2H | XXXFBh | 300003h

CONFIG3L | XXXFCh | 300004h

CONFIG3H | XXXFDh | 300005h

 

Thanks,

Moses

As the table you show says the configuration memory begins at 300000h. You access this memory by using the "pragma" command. The documentation that comes with BoostC gives a good description of how to do it or you could take a look at the example at http://www.sourceboost.com/Products/BoostC...icConfig.h.html to see a working example.

Link to post
Share on other sites

Hmmm, not quite what I was asking. These chips store the configuration data in program memory and then load it into configuration memory on power up. The data sheet says to allocate or reserve the space in the program memory for the configuration data so it doesn't get used for something else. I don't know how to do this. The configuration memory starts at 300000h but the config data is actually stored in code space at XXXF8h - whatever that address means.

Link to post
Share on other sites
Hmmm, not quite what I was asking. These chips store the configuration data in program memory and then load it into configuration memory on power up. The data sheet says to allocate or reserve the space in the program memory for the configuration data so it doesn't get used for something else. I don't know how to do this. The configuration memory starts at 300000h but the config data is actually stored in code space at XXXF8h - whatever that address means.

 

No, the config data is stored at 300000h and above, this is memory reserved for config data and is not accessible by the normal program.

The contents of address 300000h is XXF8h where the XX part is your configuration word.

 

As long as you include the system.h header in your program and tell the IDE which chip are using, you don't have to worry about memory addressing. The SouceBoost linker knows about your chip's memory layout and won't put program data where it shouldn't.

Link to post
Share on other sites

Those cheeky chappies at Microchip have added a new twist to keep us on our toes. This series of chips requires config words in program space which are automagically loaded into 0x300000 on power up.

 

 

See table 5. 1 on page 68 of the data sheet, this shows the program memory locations to store the config words.

Link to post
Share on other sites
Those cheeky chappies at Microchip have added a new twist to keep us on our toes. This series of chips requires config words in program space which are automagically loaded into 0x300000 on power up.

 

 

See table 5. 1 on page 68 of the data sheet, this shows the program memory locations to store the config words.

 

I was aware of the new twist and I was trying to figure out how to do what I needed to make it work. Thanks for the pointer to page 68! That had more of what I needed, and the stuff I posted had most of the rest. The Programming Specs datasheet has more information and I think I have it figured out. The XXXF8 etc is because the configuration words are stored at the end of the program space, and that is different on different chips in the family depending on how much memory that chip has. So on my chip with 32K mem the address is 7FF8 and on the chips with 128K mem it is 1FFF8.

 

The header file for the 18f85J50 has the config words at the wrong address which is probably why my PICKit2 software said there was no configuration words in the hex file. I'm going to try putting the correct addresses in and see if it fixes it.

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...