HI-TECH compiler question

Discussion in 'Embedded Systems and Microcontrollers' started by ironmike828, Jun 21, 2010.

  1. ironmike828

    Thread Starter Member

    Jan 29, 2010
    13
    0
    Hi,

    I bought the PIC kit 2 programmer and i am trying to figure out how to use the compiler. I'm going through the manual for HI TECH COMPILER that I am using to try and compile C code to assembly language. The steps tell me that I need to open the 16f887.h header file, but my micro controller is a 16f690.h. First I can't locate that file, and second what exactly does that file do?
     
  2. ironmike828

    Thread Starter Member

    Jan 29, 2010
    13
    0
    i meant my microcontroller is a 16f690 and im looking for the 16f690.h header file**
     
  3. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Go to the install folder for your compiler. Then locate the quikstart.pdf in the doc folder. Here you will find out how to start a new PIC C project. You will not need to include other than htc.h file. You will not find a include file for 16f690. Since 16f690 use the pic16f685.h file. The configuration bits setting is in the end of this file.
    Which version of the HI-Tech C compiler do you have? Then you download mplab from Microchip. You will download the current version of HI-Tech C compiler also.
     
  4. ironmike828

    Thread Starter Member

    Jan 29, 2010
    13
    0
    okay so i did what you said, now when I try to build it gives me the following error messages.

    Error [800] C:\DOCUME~1\ironmike\LOCALS~1\Temp\s36k.; 45. undefined symbol "LVPDIS"
    Error [800] C:\DOCUME~1\ironmike\LOCALS~1\Temp\s36k.; 45. undefined symbol "DUNPROTECT"
    Error [800] C:\DOCUME~1\ironmike\LOCALS~1\Temp\s36k.; 49. undefined symbol "BORV40"

    I tried looking through the manuals and I'm not sure where these symbols are located. Any insight would be helpful...

    and the version is 9.70
     
  5. msr

    Active Member

    Jul 8, 2008
    62
    1
    Go to the installation directory of HITECH PICC. Then go to the "/include" folder. You'll find the file you want there!
     
  6. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    ;)
    Make a template file and paste in the configuration bits setting as a comment on the top

    Code ( (Unknown Language)):
    1. /* Configuration Mask Definitions
    2. #define CONFIG_ADDR 0x2007
    3. // Oscillator
    4. #define EXTCLK  0x3FFF // External RC Clockout
    5. #define EXTIO  0x3FFE // External RC No Clock
    6. #define INTCLK  0x3FFD // Internal RC Clockout
    7. #define INTIO  0x3FFC // Internal RC No Clock
    8. #define EC  0x3FFB // EC
    9. #define HS  0x3FFA // HS
    10. #define XT  0x3FF9 // XT
    11. #define LP  0x3FF8 // LP
    12. // Watchdog Timer
    13. #define WDTEN  0x3FFF // On
    14. #define WDTDIS  0x3FF7 // Off
    15. // Power Up Timer
    16. #define PWRTDIS  0x3FFF // Off
    17. #define PWRTEN  0x3FEF // On
    18. // Master Clear Enable
    19. #define MCLREN  0x3FFF // MCLR function is enabled
    20. #define MCLRDIS  0x3FDF // MCLR functions as IO
    21. // Code Protect
    22. #define UNPROTECT 0x3FFF // Code is not protected
    23. #define CP  0x3FBF // Code is protected
    24. #define PROTECT  CP //alternate
    25. // Data EE Read Protect
    26. #define UNPROTECT 0x3FFF // Do not read protect EEPROM data
    27. #define CPD  0x3F7F // Read protect EEPROM data
    28. // Brown Out Detect
    29. #define BORDIS  0x3CFF // BOD and SBOREN disabled
    30. #define SWBOREN  0x3DFF // SBOREN controls BOR function (Software control)
    31. #define BORXSLP  0x3EFF // BOD enabled in run, disabled in sleep, SBOREN disabled
    32. #define BOREN  0x3FFF // BOD Enabled, SBOREN Disabled
    33. // Internal External Switch Over Mode
    34. #define IESOEN  0x3FFF // Enabled
    35. #define IESODIS  0x3BFF // Disabled
    36. // Monitor Clock Fail-safe
    37. #define FCMEN  0x3FFF // Enabled
    38. #define FCMDIS  0x37FF // Disable */
     
  7. ironmike828

    Thread Starter Member

    Jan 29, 2010
    13
    0
    as you can probably tell im not very experienced when it comes to programming, t06afre the code you gave me where should I post that in to? Is it the source file or the 16f685.h file?

    Thanks in advance this is kind of coming slower to me than i thought
     
  8. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    The code I gave you is as shown in the post only a comment as it inclosed by /*.......*/
    You can paste it in at the beginning in your code. Then you pick items from it to construct a __config statement like this as an example
    Code ( (Unknown Language)):
    1.  
    2. __CONFIG(INTIO & WDTDIS & PWRTDIS & BORDIS & MCLRDIS & FCMEN  & IESODIS & UNPROTECT);
    3.  
    It is taken from the pic16f685.h file in your compiler include folder. But in the pic16f685.h file those statements are not only comments
     
  9. ironmike828

    Thread Starter Member

    Jan 29, 2010
    13
    0
    I think im in over my head here as I have never done this before and I feel like im lost even setting this up... I would like to get a book thats eazy to understand, can you point me in the right direction... there are tons of books on amazon but maybe there is a different place to start maybe online?

    Thanks for your help, its just hard for me to grasp all this, but I would really like to learn the basics before I go on.
     
  10. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Then you start learning programming C on a PC. You really do not know much about what is going on inside the PC. But then programming a MCU it is very important that you do know something about the internal architecture. The data sheet will tell you all you need. So this must always be present then programming. Your original problem was the setting of the configuration bits. You will find all you need about them in section 14 of the data sheet. Then you map that information to what I already have given you, and you will understand.
    It is also important to start simple in the beginning. Start with simple things like turning on and off LEDs.
    I also think this book will help you http://www.amazon.com/Beginners-Guide-Embedded-Programming-Microcontroller/dp/1438231598/
    By the way download the latest PICC from here. It has some important bug fixing like problems with the __delay_ms function
    http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en542849
    EDIT: You can also try this link http://www.ermicro.com/blog/?p=365
     
    Last edited: Jun 24, 2010
Loading...