Config problem PIC16F886


Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 40 of 56
  1. #1
    Join Date
    Sep 2006
    Posts
    35

    Angry Config problem PIC16F886

    Can anyone please help me with configuration with PIC16F886- Want to run INTERNAL OSC 8 MHZ - ALL DIGITAL.

    Bosse

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    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

  3. #3
    Join Date
    Sep 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Default Config PIC16F886

    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.

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Oh, oops. Yes 2.47 will do.

    What kind of problem are you having with the config? Looks ok to me.
    <br>
    DT

  5. #5
    Join Date
    Sep 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    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????

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    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 ...
    Code:
    @    __config _CONFIG1, _INTOSCIO & _WDT_OFF & _MCLRE_OFF & _LVP_OFF & _CPD_OFF & _FCMEN_OFF &  _IESO_OFF
    Of if you're using a crystal now, replace _INTOSCIO with _XT_OSC or _HS_OSC.

    Don't forget to comment the config line in the 16F886.inc file in your PBP folder.
    <br>
    DT

  7. #7
    Join Date
    Aug 2004
    Posts
    64


    Did you find this post helpful? Yes | No

    Default

    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.

  8. #8
    Join Date
    Sep 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Thumbs up

    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

  9. #9
    Join Date
    Sep 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Default Error in INC file

    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

  10. #10
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bosse View Post
    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
    Hi Bosse,
    Can you post your .inc file, at least the area where you been pokin' around ? Also post the first say 8 - 10 lines of the code you are trying to get to work?
    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.

  11. #11
    Join Date
    Sep 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Unhappy

    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

  12. #12
    Join Date
    Sep 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    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

  13. #13
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    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...

  14. #14
    Join Date
    Sep 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Smile

    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

  15. #15
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bosse View Post
    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.
    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...

  16. #16
    Join Date
    Sep 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    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

  17. #17
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    That's the register setup, not the CONFIG fuse setup

  18. #18
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bosse View Post
    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
    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.

  19. #19
    Join Date
    Sep 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    Hi again skimask,

    Have also changed to MPASM assembler and it works better now

    Bosse

  20. #20
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    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...
    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 . . .
    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...
    we can hope . . .
    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.

  21. #21
    Join Date
    Sep 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    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
    Attached Files Attached Files

  22. #22
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bosse View Post
    Can not find out how to find out about the CONFIG word.
    The config fuses are explained in the 16F886 datasheet in the 'Special Features of the CPU' section.

    Have comment out the CONFIG word in the program. using MPASM assembler.
    If you comment them out in the 16F886.INC file in the PBP folder, you need to put them in your main program.
    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.

    Really wants to find out how to configure CONFIG word for 16F886.
    And again...if you read, and re-read, and re-read, and heed, this thread:
    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

  23. #23
    Join Date
    Sep 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Smile

    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

  24. #24
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    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.

  25. #25
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bosse View Post
    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
    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.

  26. #26
    Join Date
    Sep 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Smile

    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

  27. #27
    Join Date
    Sep 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Thumbs up

    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

  28. #28
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bosse View Post
    Now it is running nice - still a warning from PicKit2 - Configuration 23EC 0700
    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?

  29. #29
    Join Date
    Sep 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    Hi,

    Yes, have MPLAB Ver. 8.00.00.00 and updated PicKit2

    Shall read bak and see

  30. #30
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bosse View Post
    Hi,

    Yes, have MPLAB Ver. 8.00.00.00 and updated PicKit2

    Shall read bak and see
    MPLAB is up to 8.14.
    PicKit2...check the website for the latest.

  31. #31
    Join Date
    Sep 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    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

  32. #32
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bosse View Post
    @ __CONFIG _CONFIG1, _INTOSCIO & _WDT_ON & _PWRTE_ON &_MCLRE_ON & _LVP_OFF & _CPD_OFF & _FCMEN_OFF & _IESO_OFF
    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.

  33. #33
    Join Date
    Sep 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    Have Updated MPLAB to 8.14 and PicKit to 2.52

    Reading back 23EC 3FFF

  34. #34
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bosse View Post
    Have Updated MPLAB to 8.14 and PicKit to 2.52
    Reading back 23EC 3FFF
    If I had an '886, I'd try it to see what I get.
    Oh...wait...I've got the demo board with an '887 on it.
    When I get a chance, I'll see what it reads...

  35. #35
    Join Date
    Sep 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    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.

  36. #36
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Do you have the actual PICKIT2 or a knockoff?

  37. #37
    Join Date
    Sep 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    From Microchip, 3 months old

  38. #38
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bosse View Post
    From Microchip, 3 months old
    Forgot to add...did you get the demo version with the demo board with the '887 (or maybe '917) on it?

  39. #39
    Join Date
    Sep 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    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.

  40. #40
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bosse View Post
    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
    Hook the PICKIT2 directly to those boards, set up a program to change the CONFIG fuse values, program them, read them back, see what happens.

Similar Threads

  1. A/D conversion with PIC18F67J50
    By ScaleRobotics in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 8th May 2009, 01:48
  2. 18F4550 Bootloader enter via eeprom setting
    By bradb in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 22nd November 2008, 23:51
  3. Error 0X0000008E when connecting a 18F2550 USB HID
    By FranciscoMartin in forum USB
    Replies: 8
    Last Post: - 16th October 2008, 17:20
  4. PortE problems (PIC18F4455)
    By RubenR in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 12th July 2006, 15:26
  5. Installation sequence
    By Demon in forum General
    Replies: 23
    Last Post: - 11th July 2006, 03:56

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts