nerdegutta
- Joined Dec 15, 2009
- 2,684
As I said, the code is for PIC16F628.
I'm using the above configuration words in my PIC16F628.
I'm using the above configuration words in my PIC16F628.
True, but the OP is using a PIC16F84a so lets give him some code he can use.As I said, the code is for PIC16F628.
Using which compiler and which version?I'm using the above configuration words in my PIC16F628.
The example from Nerdegutta was a good example. Not many are using the obsolete, and antiquated 16f84. The OP must by him self bring him up to data by reading the needed documentation. Like data sheet. And familiarize him self with the header file contentTrue, but the OP is using a PIC16F84a so lets give him some code he can use
what does it mean sir?
im still learning how to compile using hi-tech c with the link sent to me.
tnx again
Warning [176] C:\Documents and Settings\Administrator\My Documents\pic16F84 projects\16F84A_delay (100)\srv.c; 32.0 missing newline
Warning [361] C:\Documents and Settings\Administrator\My Documents\pic16F84 projects\16F84A_delay (100)\srv.c; 25.1 function declared implicit int
Warning [337] C:\Documents and Settings\Administrator\My Documents\pic16F84 projects\16F84A_delay (100)\srv.c; 31.0 line does not have a newline on the end
Error [800] ; 0. undefined symbol "FOSC_XT"
Error [800] ; 0. undefined symbol "CP_OFF"
Error [800] ; 0. undefined symbol "PWRTE_ON"
Error [800] ; 0. undefined symbol "WDTE_OFF"
********** Build failed! **********
The version of MPLAB is not that critical I run version 8.60 no problem. From your postings I can see that you use HI-TECH C version 9.81 which is the latest. Have you created a project as shown in the quickstart.pdf I pointed your to. In MPLAB Always use a project.your right maybe my compiler does not suit the file. Where can you get the update version of mplab? is V 9.81 free? im using V8.66 and got it for free. i think what im going to do is upgrade my software for it to work. By the way what compiler do you use?
Agreed, but this was what I had at hand at the time, and I figured the PIC's was not so different.True, but the OP is using a PIC16F84a so lets give him some code he can use.
I'm using MPLAB 8.63, HI-TECH C V9.80.Using which compiler and which version?
Here are some copy paste from some of the header files:It certainly does not compile under HiTecC V9.81, all the config bit names are wrong, even for the PIC16F628a. See the relevant HiTec header files (pic16f628a.h or pic16f84a.h) for the correct config bit names.
// Configuration Mask Definitions
#define CONFIG_ADDR 0x2007
// Protection of flash memory
#define PROTECT 0x1FFF
#define UNPROTECT 0x3FFF
// Protection of EEPROM data memory
#define CPD 0x3EFF
#define UNPROTECT 0x3FFF
// Low voltage programming enable
#define LVPEN 0x3FFF
#define LVPDIS 0x3F7F
// Brown out detection enable
#define BOREN 0x3FFF
#define BORDIS 0x3FBF
// Master clear reset pin function
#define MCLREN 0x3FFF
#define MCLRDIS 0x3FDF
// Power up timer enable
#define PWRTEN 0x3FF7
#define PWRTDIS 0x3FFF
// Watchdog timer enable
#define WDTEN 0x3FFF
#define WDTDIS 0x3FFB
// Oscillator configurations
#define RCCLK 0x3FFF
#define RCIO 0x3FFE
#define INTCLK 0x3FFD
#define INTIO 0x3FFC
#define EC 0x3FEF
#define HS 0x3FEE
#define XT 0x3FED
#define LP 0x3F
#define CONFIG_ADDR 0x2007
/*osc configurations*/
#define RC 0x3FFF // resistor/capacitor
#define HS 0x3FFE // high speed crystal/resonator
#define XT 0x3FFD // crystal/resonator
#define LP 0x3FFC // low power crystal/resonator
/*watchdog*/
#define WDTEN 0x3FFF // enable watchdog timer
#define WDTDIS 0x3FFB // disable watchdog timer
/*power up timer*/
#if defined (_16C84)
#define PWRTEN 0x3FFF /* enable power up timer*/
#define PWRTDIS 0x3FF7 /* disable power up timer */
#else
#define PWRTDIS 0x3FFF /* disable power up timer */
#define PWRTEN 0x3FF7 /* enable power up timer */
#endif
#if defined (_16CR83) || defined(_16CR84)
#define DP 0x3F7F // data code is protected
#define PROTECT 0x008F // program code is protected
// alternative definition
#define DATPROT 0x3F7F // use DP
#define DATUNPROT 0x3FFF // use UNPROTECT
#elif defined (_16C84)
#define PROTECT 0x3FEF // program code is protected
#elif defined (_16F83) || defined(_16F84) || defined(_16F84A)
#define PROTECT 0x000F // program code is protected
#endif
#define UNPROTECT 0x3FFF // do not protect the code
New header file generation (9.81) Header files in the 9.81 version are now generated from a central database rather than being hand crafted. This may mean that the names of some SFRs or bits within SFRs in the new header files may be different to those in the header files that were previously used by the compiler. The header files that were previously shipped with the compiler are no longer maintained, but are supplied with this version of the compiler and can be used by defining the macro _LEGACY_HEADERS. Ideally, this macro should be defined using the compiler’s -D option, or in the Define macros field in the Compiler tab
of the MPLAB IDE Build Options dialog. If you use a #define to define this, make sure you place this above the line which includes <htc.h>. The legacy include files are located in the legacy directory, inside the include directory of the compile
#include <htc.h>
__CONFIG(XT & WDTDIS & PWRTDIS & BORDIS & LVPEN & WRTEN &
DEBUGEN & DUNPROT & UNPROTECT);
void init(void)
{
// port directions: 1=input, 0=output
TRISB = 0b00000000;
}
char counter;
void main(void)
{
counter = 0;
init();
while (1){
PORTB = counter;
_delay(10000);
counter++;
}
}
Error [499] ; . undefined symbol:
__delay (tutorial1.obj)
About the changing in the headerfiles from V9.80 to V9.81 I was not aware of that. Thanks for the "heads-up"In MPLAB Always use a project.
They have also changed the __config settings. Almost every config word name has been changed. The __config settings are now in the start of the header file not the end.About the changing in the headerfiles from V9.80 to V9.81 I was not aware of that. Thanks for the "heads-up"