Can anyone please help me with configuration with PIC16F886- Want to run INTERNAL OSC 8 MHZ - ALL DIGITAL.
Bosse
Can anyone please help me with configuration with PIC16F886- Want to run INTERNAL OSC 8 MHZ - ALL DIGITAL.
Bosse
You'll need to have PBP 2.50 for this series of chips.
Code:OSCCON = %01110001 ; Internal 8 mhz Osc ANSEL = 0 ; All Digital ANSELH = 0
DT
Thank you Darrel,
I have PBP 2.47 - in Microengineering labs homesite they declare that PBP 2.47 can compile F886 ???
Have used PIC16F88, but need more I/O so decided to try F886 but have real problem with config word
@ DEVICE PIC16F886, INTOSCIO,WDT_OFF,MCLR_OFF,LVP_OFF,PROTECT_OFF,BOD_ OFF,CPD_OFF,IESO_OFF,FCMEN_OFF,PWRT_OFF
So I have to update to PBP 2.50 - will do that soonest possible.
Can I compile in MPASM and then use the file?
Thanks again
Last edited by Bosse; - 22nd August 2008 at 18:55.
Oh, oops. Yes 2.47 will do.
What kind of problem are you having with the config? Looks ok to me.
<br>
DT
Hi Darrel,
Always get a lot of messages that the config is not correct.
Now I have decided to use Crystal and will be very greatful for help with configuration word(s)
Have used a PIC16F876A before without any problem, think it can be that the F886 have 2 config words????
Are you using the default PM assembler, or MPASM?
For PM, the CONFIG2 word is set using the DEVICE2 pseudo-op. But not setting config2 will not cause an error. And your DEVICE line above looks OK (if using PM).
If you are using MPASM then it would be ...Of if you're using a crystal now, replace _INTOSCIO with _XT_OSC or _HS_OSC.Code:@ __config _CONFIG1, _INTOSCIO & _WDT_OFF & _MCLRE_OFF & _LVP_OFF & _CPD_OFF & _FCMEN_OFF & _IESO_OFF
Don't forget to comment the config line in the 16F886.inc file in your PBP folder.
<br>
DT
Hi Bosse:
If you are using the port A as digital, you will need to disable too the
comparators.
CM1CON0 = 0
CM2CON0 = 0
Greetings...
Ruben de la Pena V.
Thank you very much Darrel and Ruben,
I use PM assembler. Have decided to use a ceramic resonator (20 MHz)
Wants ALL DIGITAL if possible.
Will try your configuration recommendations
Thanks again
Bosse
Hi,
Now I have done something ?????
Get the error: Error 16F886.INC 15 : [201] ''' expected
Have changed the INC file, but changed it back to original again, so now when I try to compile get this error.
Use PM and PicBasic Pro with MicroCode Studio Pro.
Please is there anybody how can help me solve the problem
Bosse
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Hi Joe,
First I tries to get Config O.K. so have only a small program for testing config words. Wants ALL digital. Working with a project with MAXIMS iButton chips, works perfect with 16F88.
;************************************************* ***************
;* 16F886.INC *
;* *
;* By : Leonard Zerman, Jeff Schmoyer *
;* Notice : Copyright (c) 2006 microEngineering Labs, Inc. *
;* All Rights Reserved *
;* Date : 05/26/06 *
;* Version : 2.47 *
;* Notes : *
;************************************************* ***************
NOLIST
ifdef PM_USED
LIST
include 'M16F88x.INC' ; PM header
device pic16F886, xt_osc, wdt_on, mclr_on, lvp_off, protect_off
XALL
NOLIST
else
LIST
LIST p = 16F886, r = dec, w = -302
INCLUDE "P16F886.INC" ; MPASM Header
__config _CONFIG1, _XT_OSC & _WDT_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF
NOLIST
endif
LIST
Think the INC file is O.K - But can not understand why it stops working????
'@ DEVICE PIC16F886, INTOSCIO, WDT_ON,MCLR_OFF,LVP_OFF,PROTECT_OFF,BOD_OFF,CPD_OF F,IESO_OFF,FCMEN_OFF,PWRT_ON
'DEFINE OSC 8
OSCCON = %01110001 ' Internal 8 mhz Osc
ANSEL = 0 ' All Digital
ANSELH = 0
'ADCON1 = $0F
'ADCON0 = 0
TRISC = 0
RUN:
PORTC.0 = 1
pause 1000
PORTC.0 = 0
PAUSE 1000
goto RUN
END
Do you recomend to use MPASM assembler? Have now tried more than 2 weeks with this problem.
PORTA is reserved for furure use - PORTA.1 = Input
PORTB %??001111 - RB6 and RB7connected to progsocket for PicKit2.
PORTC %11100100 - RC3 = SCK - RC4 = SDA 24LC256
Would be very great ful for all help and advices
Thanks in advance
Bosse
Hi Joe,
Forget to tell you the Warning from PicKit2.
Warning: Some configuration words not in hex file.
Ensure default values above right are acceptable.
Configuration 2FF9 0700
Bosse
http://www.picbasic.co.uk/forum/showthread.php?t=543
What it boils down to....
Method one:
Comment out the config settings in the inc file, put the actual config settings in your source code prefixed by either an @ or inside an ASM block. Use this method if you frequently change this setting or that setting a lot.
Method two:
Comment out the original config settings in the inc file, add in your own config settings to that same inc file in the same place. I use this method since I almost always use the PICs in the same way (i.e. HS_PLL for the 18F, MCLR on, and so on and so on)
Method three (and others)...
Lots of different methods for doing this sort of thing. The 2 above are the 2 that I use.
Check the particular PICs .INC file in the MPASM directory for your particular PICs various options...
Hi Skimask,
Thank you !
Now it starts working, have changed the config in the 16F886.INC file and moved the configuration over to the real program. But still have the warning from PicKit2.
Have to work on and make some small changes and see if the warnings will go away.
I'm not proffessional, but have learned very much from this forum and are very greatful for all your help.
Thank you ALL
Bosse
Probably means that you typed something in wrong, missing a space here or there, have an extra ' character, maybe a " character in there somewhere that shouldn't be...
Post the real CONFIG part that you're using. We can guess at your problem all day. Could be that the tire pressure is low...we'll never know...
Hi skimask,
Have changed to INTOSCIO in 16F886.INC and have the following config in program
OSCCON = %01110001 '; Internal 8 mhz Osc
'OSCCON = %01100000
ANSEL = 0 '; All Digital
ANSELH = 0
CM1CON0 = 0
CM2CON0 = 0
ADCON1 = $0F
ADCON0 = 0
TRISA = %00000010
TRISB = %00001111
TRISC = %11100100
The program will not work perfect yet ???
Bosse
According to that CONFIG word, and according to the PIC16F886 datasheet, this is your configuration:
DEBUG mode is OFF
RB3 is I/O
Fail Safe Clock is ON
Int/Ext Clock Switching is ON
BOR is ON
CPD is OFF
CP is OFF
RE3/MCLR is MCLR
PWRT is OFF
WDT is ON
Oscillator mode is INTRC, ClkOut on OSC2, R/C input on OSC1
All Write Protects are Off
What's not right?
I'd be betting it's your spelling of INTRC. Check the 16F886 INC file in the MPASM directory to figure out how to spell it so the assembler is happy.
Hi again skimask,
Have also changed to MPASM assembler and it works better now
Bosse
Just got back from dinner . . . That is why I asked him to post the .inc file and first 8 lines or so, to see if he introduced an extra character . . .
we can hope . . .Post the real CONFIG part that you're using. We can guess at your problem all day. Could be that the tire pressure is low...we'll never know...
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Hi skimask, Joe and Darrel
Can not find out how to find out about the CONFIG word. Have comment out the CONFIG word in the program. using MPASM assembler. Now I'm really confused. Have been lucky with my other programs for other Controllers, that I can see now.
Really wants to find out how to configure CONFIG word for 16F886.
;************************************************* ***************
;* 16F886.INC *
;* *
;* By : Leonard Zerman, Jeff Schmoyer *
;* Notice : Copyright (c) 2006 microEngineering Labs, Inc. *
;* All Rights Reserved *
;* Date : 05/26/06 *
;* Version : 2.47 *
;* Notes : *
;************************************************* ***************
NOLIST
ifdef PM_USED
LIST
include 'M16F88x.INC' ; PM header
device pic16F886, xt_osc, wdt_on, mclr_on, lvp_off, protect_off
XALL
NOLIST
else
LIST
LIST p = 16F886, r = dec, w = -302
INCLUDE "P16F886.INC" ; MPASM Header
__config _CONFIG1, _INTOSC & _WDT_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF
NOLIST
endif
LIST
I wants to have 8 MHz Internal Oscillator, my PCB have 4k7 resistor to MCLR pin so think MCLR have to be ON?
Also want ALL I/O to be DIGITAL.
Have printed out the INC file from the MPASM directory and the PDF file for 16F886 from MicroChip. Have much to read, but if I understand all???
What can I do to get it work?
Include a short version of the program.
All the Best
Bosse
The config fuses are explained in the 16F886 datasheet in the 'Special Features of the CPU' section.
If you comment them out in the 16F886.INC file in the PBP folder, you need to put them in your main program.Have comment out the CONFIG word in the program. using MPASM assembler.
If you don't put them in your main program, you can temporarily/permanently set them in the 16F886.INC file in the PBP folder.
And again...if you read, and re-read, and re-read, and heed, this thread:Really wants to find out how to configure CONFIG word for 16F886.
http://www.picbasic.co.uk/forum/show...ght=presetting
You will understand what needs to go where...
Get the list of available/recognized config fuses settings from the 16F886.INC file in the MPASM folder...just like the thread says to do...
;************************************************* ***************
;* 16F886.INC *
;* *
;* By : Leonard Zerman, Jeff Schmoyer *
;* Notice : Copyright (c) 2006 microEngineering Labs, Inc. *
;* All Rights Reserved *
;* Date : 05/26/06 *
;* Version : 2.47 *
;* Notes : *
;************************************************* ***************
NOLIST
ifdef PM_USED
LIST
include 'M16F88x.INC' ; PM header
device pic16F886, xt_osc, wdt_on, mclr_on, lvp_off, protect_off
XALL
NOLIST
else
LIST
LIST p = 16F886, r = dec, w = -302
INCLUDE "P16F886.INC" ; MPASM Header
__config _CONFIG1, _INTOSC & _WDT_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF
If you're going to put the config fuses in your program, comment out the above line
If you're going to make the config fuses temporarily/permanent, change the above line to what you need using the available settings in the 16F886.INC in the MPASM folder
NOLIST
endif
LIST
Hi skimask,
Thank you very much for all your help, now I will change the config in the INC file.
Wish you all the best
Bosse
HI BOSSE,
Time to ask, what is / is not working? Your file compiles nicely here, only changes I see are as follows: add, OSCTUNE = %00000000 ' SET OSC TO CALIBRATED VALUE
VRCON = 0 and change to OSCCON = %01110101 , these may in fact do nothing differently, but I would try them. Does your circuit come alive and do anything ? Have you tried adding a heartbeat code just so you can see if life exists? Simple LED works wonders.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Ya Know, I would only add an <b><font color=red> ; </b></font color> there. What I would do is save the configs you want saved as a file, call it 16F886 Setup and open it for each new project, then when you get ready to compile just save it as your new project's name: MyNewProject.BAS
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Hi Joe,
Thank you for your help. Was working yesterday to 06.30 in the morning, so today I have not tried out the new settings. Will do it tomorrow and belive it will work now. Have tried with LEDs and sometimes 2 LEDs lights when only one should. Will send you info about my progress tomorrow.
Many thanks again ALL of you
Bosse
Hi everybody - especially you how have helped me, MANY THANKS!!
Now it is running nice - still a warning from PicKit2 - Configuration 23EC 0700
But can not see any problem when program runs - have hardtested all functions and NO problem to see.
All the Best to you all
Bosse
I think, but I'm not sure...
The datasheet says that the upper 2 bits of the CONFIG1 register should read as 1's (even though they're not used), and the same thing for most of CONFIG2.
This leads me to believe that your config word should be $E3ECFFFF when read back off the chip.
Have you got the latest versions of MPLAB, PICKIT2 firmware and software loaded up?
Hi,
Yes, have MPLAB Ver. 8.00.00.00 and updated PicKit2
Shall read bak and see
Hi again skimask,
This is my configuration now, will move it to the INC file when there is no warnings.
@ __CONFIG _CONFIG1, _INTOSCIO & _WDT_ON & _PWRTE_ON &_MCLRE_ON & _LVP_OFF & _CPD_OFF & _FCMEN_OFF & _IESO_OFF
Define OSC 8 ' Set Xtal Frequency
OSCCON = %01110001 ' Internal 8 mhz Osc
ANSEL = 0 ' All Digital
ANSELH = 0
CM1CON0 = 0 ' Think ? don't need
CM2CON0 = 0 ' Think ? don't need
ADCON0 = 0
ADCON1 = $0F ' Think ? don't need
Have to try change bit by bit until no warnings from PicKit2
Anything below this line isn't going to have an effect on your CONFIG fuses.
They are 2 separate entities...
And when I said read back, I meant the actual config word data as read back using the PICKIT2, not the data you are trying to push out to the PIC using the programmer.
EDIT: Just checked your CONFIG against the '886/887 datasheet. When reading back the PIC after programming the config word, you should readback $E3ECFFFF, if it's actually being programmed to those values.
Last edited by skimask; - 9th September 2008 at 20:54.
Have Updated MPLAB to 8.14 and PicKit to 2.52
Reading back 23EC 3FFF
Will be very greatful for your help, can see that 16F887 have exact the same CONFIG words.
Have used 16F876A before without problems, but they dont have internal oscillator.
Have 2 demo board - one with 16F688 and one with 16F887
Clock is now 02.30 in the morning here in Norway, so have to go to sleep
Last edited by Bosse; - 10th September 2008 at 01:29.
Bookmarks