the 16F84A.INC file
Hi owali,

Originally Posted by
owali
I tried adding the following configuration code to my program.
@ DEVICE XT_OSC
@ DEVICE PIC16F84A,XT_OSC
@ DEVICE pic16F84A, INTRC_OSC_NOCLKOUT
' System Clock Options
@ DEVICE pic16F84A, WDT_ON
' Watchdog Timer
@ DEVICE pic16F84A, PWRT_ON
' Power-On Timer
@ DEVICE pic16F84A, MCLR_ON
@ DEVICE pic16F84A, BOD_ON
' Brown-Out Detect
@ DEVICE pic16F84A, LVP_OFF
' Low-Voltage Programming
@ DEVICE pic16F84A, CPD_OFF
' Data Memory Code Protect
' Set to CPD_OFF for Development Copy
' Set to CPD_ON for Release Copy
@ DEVICE pic16F84A, PROTECT_OFF
But I get errors when I compile now.
Error ... Undefined symbol 'lvp_off'
In addition to the configuration stuff, do I have to INCLUDE anything in my program?
If you are using a sample PBP program to compile, you do not have to add an INCLUDE unless the original program used one.
In Microcode Studio make sure you are using the button for Compile(ing) AND Program(ing), not the button for just Compile(ing).
Make sure you are using PIC16F84A in the "drop down" box in Microcode Studio.
Are you using:
MeLabs default (PM) Assembler
or
Microchips (MPASM) Assembler
You can place the device “inline” like this style:
@ device pic16F648A, hs_osc, wdt_off, mclr_on, lvp_off, protect_off
But, you may be trying too hard. Most of the defines are already supplied by the default *.INC file (16F84A.INC) .
See this microEngineering Labs web page:
Specifying configuration bit settings in PICBASIC PRO programs.
If you add a configuration directive to your program file, you are actually
replacing the
default configuration that the compiler would otherwise include. The easiest way to determine the correct syntax is to get examples from the compiler and assembler's built-in resource files. To that end, it's best to understand how the compiler determines the config defaults....
....The first thing the compiler looks for is a file in the PBP folder that matches the targeted PIC. If you tell it to compile for a 16F84A, it reads the file "16F84A.INC". The contents of this file are divided into 2 sections, one for each assembler. An internal variable, "PM_USED", tells the compiler which section of the file to use. In the following example, you will see that the top section ("ifdef" to "else") is meant for the PM assembler and the bottom section ("else" to "endif") is meant for the MPASM assembler.
http://www.melabs.com/support/config_defaults.htm
You do have to change from the default (DEVICE XT_OSC in the 16F84A.INC file )
by adding @ DEVICE HS_OSC to your program:
also:
DEFINE OSC 20 for your 20 MHz resonator.
Ohm it's not just a good idea... it's the LAW !
Bookmarks