HI-TECH compiler question

Thread Starter

ironmike828

Joined Jan 29, 2010
13
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?
 

t06afre

Joined May 11, 2009
5,934
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.
 

Thread Starter

ironmike828

Joined Jan 29, 2010
13
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
 

msr

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

t06afre

Joined May 11, 2009
5,934
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.
;)
Make a template file and paste in the configuration bits setting as a comment on the top

Rich (BB code):
/* Configuration Mask Definitions
#define CONFIG_ADDR 0x2007
// Oscillator 
#define EXTCLK  0x3FFF // External RC Clockout
#define EXTIO  0x3FFE // External RC No Clock
#define INTCLK  0x3FFD // Internal RC Clockout
#define INTIO  0x3FFC // Internal RC No Clock
#define EC  0x3FFB // EC
#define HS  0x3FFA // HS
#define XT  0x3FF9 // XT
#define LP  0x3FF8 // LP
// Watchdog Timer 
#define WDTEN  0x3FFF // On
#define WDTDIS  0x3FF7 // Off
// Power Up Timer 
#define PWRTDIS  0x3FFF // Off
#define PWRTEN  0x3FEF // On
// Master Clear Enable 
#define MCLREN  0x3FFF // MCLR function is enabled
#define MCLRDIS  0x3FDF // MCLR functions as IO
// Code Protect 
#define UNPROTECT 0x3FFF // Code is not protected
#define CP  0x3FBF // Code is protected
#define PROTECT  CP //alternate
// Data EE Read Protect 
#define UNPROTECT 0x3FFF // Do not read protect EEPROM data
#define CPD  0x3F7F // Read protect EEPROM data
// Brown Out Detect 
#define BORDIS  0x3CFF // BOD and SBOREN disabled
#define SWBOREN  0x3DFF // SBOREN controls BOR function (Software control)
#define BORXSLP  0x3EFF // BOD enabled in run, disabled in sleep, SBOREN disabled
#define BOREN  0x3FFF // BOD Enabled, SBOREN Disabled
// Internal External Switch Over Mode 
#define IESOEN  0x3FFF // Enabled
#define IESODIS  0x3BFF // Disabled
// Monitor Clock Fail-safe 
#define FCMEN  0x3FFF // Enabled
#define FCMDIS  0x37FF // Disable */
 

Thread Starter

ironmike828

Joined Jan 29, 2010
13
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
 

t06afre

Joined May 11, 2009
5,934
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
Rich (BB code):
__CONFIG(INTIO & WDTDIS & PWRTDIS & BORDIS & MCLRDIS & FCMEN  & IESODIS & UNPROTECT);
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
 

Thread Starter

ironmike828

Joined Jan 29, 2010
13
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.
 

t06afre

Joined May 11, 2009
5,934
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:
Top