[SOLVED] [Moved] Config bits in HI-TECH C Compiler for PIC10/12/16 MCUs (Lite Mode) V9.83

Status
Not open for further replies.

bimalkamal

Member level 1
Joined
Nov 27, 2011
Messages
32
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,529
A request to the members.
Anyone please give an answer to show how I can change the config bits in HI-TECH C Compiler for PIC10/12/16 MCUs (Lite Mode) V9.83

The following two lines giving errors (But was ok in older version)

#include <htc.h>
__CONFIG(MCLRDIS & UNPROTECT & BORDIS & WDTDIS & PWRTEN & INTIO);


After building I get :-------

Error [800] ser2.as; 45. undefined symbol "INTIO"
Error [800] ser2.as; 45. undefined symbol "PWRTEN"
Error [800] ser2.as; 45. undefined symbol "WDTDIS"
Error [800] ser2.as; 45. undefined symbol "BORDIS"
Error [800] ser2.as; 45. undefined symbol "UNPROTECT"
Error [800] ser2.as; 45. undefined symbol "MCLRDIS"

********** Build failed! **********
 

Re: Config bits in HI-TECH C Compiler for PIC10/12/16 MCUs (Lite Mode) V9.83

The issue you are experiencing is due to the use of the incorrect #defines or symbols for the __CONFIG() statement.

I usually add the appropriate device specific header file to the project and reference it for the correct #defines to use while coding.

The device specific header files can be found in the following path, modify to your particular installation:

C:\Program Files\HI-TECH Software\PICC\9.83\include

For instance if you were coding for a PIC16F877A, then you would add the pic16f877a.h header file to the project window.

Open it within MPLAB to find the correct #defines:

Code:
#warning Header file pic16f877a.h included directly. Use #include <htc.h> instead.
#endif

/* header file for the MICROCHIP PIC microcontroller
 *  16F877A
 */


#ifndef __PIC16F877A_H
#define __PIC16F877A_H

//
// Configuration mask definitions
//


// Config Register: CONFIG
#define CONFIG               0x2007
// Oscillator Selection bits
// RC oscillator
#define FOSC_EXTRC           0xFFFF
// HS oscillator
#define FOSC_HS              0xFFFE
// XT oscillator
#define FOSC_XT              0xFFFD
// LP oscillator
#define FOSC_LP              0xFFFC
// Watchdog Timer Enable bit
// WDT enabled
#define WDTE_ON              0xFFFF
// WDT disabled
#define WDTE_OFF             0xFFFB
// Power-up Timer Enable bit
// PWRT disabled
#define PWRTE_OFF            0xFFFF
// PWRT enabled
#define PWRTE_ON             0xFFF7
// Brown-out Reset Enable bit
// BOR enabled
#define BOREN_ON             0xFFFF
// BOR disabled
#define BOREN_OFF            0xFFBF
// Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit
// RB3/PGM pin has PGM function; low-voltage programming enabled
#define LVP_ON               0xFFFF
// RB3 is digital I/O, HV on MCLR must be used for programming
#define LVP_OFF              0xFF7F
// Data EEPROM Memory Code Protection bit
// Data EEPROM code protection off
#define CPD_OFF              0xFFFF
// Data EEPROM code-protected
#define CPD_ON               0xFEFF
// Flash Program Memory Write Enable bits
// Write protection off; all program memory may be written to by EECON control
#define WRT_OFF              0xFFFF
// 0000h to 00FFh write-protected; 0100h to 1FFFh may be written to by EECON control
#define WRT_256              0xFDFF
// 0000h to 07FFh write-protected; 0800h to 1FFFh may be written to by EECON control
#define WRT_1FOURTH          0xFBFF
// 0000h to 0FFFh write-protected; 1000h to 1FFFh may be written to by EECON control
#define WRT_HALF             0xF9FF
// In-Circuit Debugger Mode bit
// In-Circuit Debugger disabled, RB6 and RB7 are general purpose I/O pins
#define DEBUG_OFF            0xFFFF
// In-Circuit Debugger enabled, RB6 and RB7 are dedicated to the debugger
#define DEBUG_ON             0xF7FF
// Flash Program Memory Code Protection bit
// Code protection off
#define CP_OFF               0xFFFF
// All program memory code-protected
#define CP_ON                0xDFFF

Using the above #defines the correct __CONFIG() statement would be:

Code:
__CONFIG(CP_OFF  & BOREN_OFF & WDTE_OFF & PWRTE_ON & FOSC_HS );

You can not disable the MCLR on a PIC16F877A nor does it have an internal oscillator, therefore the disable MCLR #define was omitted and the oscillator set to High Speed Oscillator (FOSC_HS).

BigDog
 
Re: Config bits in HI-TECH C Compiler for PIC10/12/16 MCUs (Lite Mode) V9.83

Once again BigDogGuru magic worked!!!!!!!!!!

Now its compiling without any error.
 

how to set config bits in 16f887 as it have MCLR enable/disable capability and also internal osc,

I am getting problem to use internal osc, and also gives problem with original LCD.C problem, it gives busy statement while simulate on Proteus, so i change __delay_us(E_Delay) to __delay_us(10); and it works well, but i think i am unable to set the bits for internal osc, can u plz help for complete config file that i can work with?

Code:
I am using MPLAB 8.85 with HiTech C 9.83
#include "Includes.h"
#include <pic16f887.h>
// Configuration word for PIC16F877
__CONFIG( FOSC_INTRC_NOCLKOUT & MCLRE_OFF & BOREN_ON & WDTE_OFF & PWRTE_ON & CP_OFF 
		& LVP_OFF & CPD_OFF   & IESO_OFF & CPD_OFF & FCMEN_OFF & BOR4V_BOR40V);
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…