1. murph909

    Thread Starter New Member

    Apr 24, 2011
    9
    0
    Hi everybody
    So I just installed mplab on my home computer and am trying to build and run a c program that I created at school so I can work on it. Im using pickit2 and pic16f887, with the hitech compiler. When I installed mplab from microchip.com on this computer, and installed hitech, everything seemed fine. I tried to build my program and keep getting these 5 error messages, referring to the config line at the top of my code. the problem isnt with the code, because this code worked no problem at school. Im not sure what the issue is.

    Error [800] test.as; 45. undefined symbol "PWRTEN"
    Error [800] test.as; 45. undefined symbol "WDTDIS"
    Error [800] test.as; 45. undefined symbol "INTCLK"
    Error [800] test.as; 45. undefined symbol "BORDIS"
    Error [800] test.as; 45. undefined symbol "LVPDIS"
    this is the line in my code:
    __CONFIG(LVPDIS & BORDIS & INTCLK & WDTDIS & PWRTEN);

    Im thinking I either dont have something installed or am missing a file.

    Any ideas?
     
  2. DerStrom8

    Well-Known Member

    Feb 20, 2011
    2,428
    1,328
    Have you included the header files? Those are important so that the compiler can "know" what all those symbols mean.
     
  3. cheezewizz

    Active Member

    Apr 16, 2009
    82
    10
    I'm going to go out on a limb here and assume you're using Hitech C. If you're using a slightly older guide but a recent version of the compiler then the way you set the config bits is done slightly diferrently. Either define _LEGACY_HEADERS to use the old school way or look in the include file for your chip. E.g PWRTEN is now done with PWRTE_ON, WDTDIS is now done with WDTE_OFF, i'm sure you can figure out the rest...
     
  4. murph909

    Thread Starter New Member

    Apr 24, 2011
    9
    0
    DerStrom8, yes I have, this is what the start of the code looks like:
    #include <htc.h>
    #include <string.h>
    __CONFIG(LVPDIS & BORDIS & INTCLK & WDTDIS & PWRTEN);
     
  5. DerStrom8

    Well-Known Member

    Feb 20, 2011
    2,428
    1,328
    I am pretty sure you have to include (for one thing) p16f887.h, etc. Then again, I have only used C18, so it may be different for hitech.
     
  6. cheezewizz

    Active Member

    Apr 16, 2009
    82
    10
    By including <htc.h> that's sufficient if the chip's set in project settings. It's just the names have changed from one version to the next. Just #define _LEGACY_HEADERS near the top should fix it...
     
  7. murph909

    Thread Starter New Member

    Apr 24, 2011
    9
    0
    Cheezewizz, I know it should work like I have it no problem, its the way it worked at school and my buddy installed this on his computer and didnt have to change the code at all.

    I added #define _LEGACY_HEADERS at the top and it didnt fix it

    DerStrom8, again all I know is that the code worked with out including that at school no problem, and nobody in the class has been including it all year so im thinking no.

    Honestly, im completely new with programming and know very little about it. My instructor sucked
     
  8. cheezewizz

    Active Member

    Apr 16, 2009
    82
    10
    I realise this, but perhaps your friend was using a different version of the compiler. what version of hitech c are you using at home right now?
     
  9. murph909

    Thread Starter New Member

    Apr 24, 2011
    9
    0
  10. cheezewizz

    Active Member

    Apr 16, 2009
    82
    10
    okey dokey try changing
    Code ( (Unknown Language)):
    1. __CONFIG(LVPDIS & BORDIS & INTCLK & WDTDIS & PWRTEN);
    for
    Code ( (Unknown Language)):
    1. __CONFIG(LVP_OFF & BOREN_OFF & FOSC_INTRC_CLKOUT & WDTE_OFF & PWRTE_ON);
    as i've said, it's just that the definitions that these values map to have changed between versions...
    btw doing it the other way (ie not changing the code) _LEGACY_HEADERS would have needed to be defined before the #include <htc.h> because it will cause it to use a different include...
     
  11. murph909

    Thread Starter New Member

    Apr 24, 2011
    9
    0
    your brilliant! haha I had the legacy headers thing after it so I just moved that to the first line of code and it worked

    Thanks a lot:)
     
Loading...