View previous topic :: View next topic |
Author |
Message |
doryme
Joined: 16 Oct 2010 Posts: 20
|
How to set Configuration bits?! |
Posted: Fri Nov 26, 2010 10:59 am |
|
|
Hello
I am making a small project to write/read in/from external memory. I am using PIC16F877A.
The simulation on Proteus 7.7 is working very well but I get this error:
Code: | Configuration word bits CP(A) (bits 4-5, 0b00) and CP(B) (bits 12-13, 0b10) should be identical. |
After searching, I found that I should set the configuration bits, CP1:CP0, to 0.
My question is how to do that? What is the code? how can I program these bits using CCS and using Assembly?
Thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Nov 26, 2010 5:33 pm |
|
|
The config bits are set with the #fuses statement. The allowable fuse
values are given at the top of the 16F877A.H file.
Look in the 16F877A data sheet, in the section on "Special Features of the
CPU". Then look in the Config bits section. It will show the bit layout of
the config word.
Then compile your program. Look at the end of the .LST file. It shows
the fuses, and it shows the Hex value of the config word. Compare this
config word to the bit layout given in the PIC data sheet. You can then
tell if CCS is setting the config bits the way you want. If not, look at the
allowable settings in the .H file and choose some different ones, that
might be better. Re-compile and check the .LST file again. Do this until
you get it right. |
|
|
|