PDA

View Full Version : Need some help converting code for a PIC16F84 to an PIC16F886 [yes ASM]



Trickae
- 26th September 2007, 15:13
I wanted to expand on some pre-existing code so I could insert a ones, tens, hundreds button to a speed alert system.

The problem is the code is for a PIC16F84 with only an UP and DOWN button. As its impractical to cycle up and down to set a speed limit of say 40 or 60 or 80 (which would be quite common ) I wanted to add 3 extra buttons. With limited PINS i've decided to use a PIC16F886 and have 28 pins at my disposal.

I tried to compile the code in MPLAB for an 84 with the PIC hardware specified to an 886 and changed the header file from:



list P=16F84
#include "p16f84.inc"
__config _XT_OSC & _WDT_OFF & _PWRTE_ON


to



list P=16F886
#include "p16f886.inc"
__config _XT_OSC & _WDT_OFF & _PWRTE_ON


But its not liking the last line.
I get the following error:



Error[126] C:\PIC LAB\SPEED3.ASM 64 : Argument out of range (not a valid config register address)


Does anyone know what to do?

I also realize I may have to remap pins.
However the 84 uses two bi-directional ports PORTA AND PORTB - and the 886 has an additional port which i can use for extra inputs. So i'm hoping theres no remapping necessary.

I just need 3 pins for the extra buttons and the EUSART

If you need to see the corrected code I can post it here in 4-5 posts or attach it as a word document, however I can't guarantee the spacing will be perfect. Below is the latter.

thanks in advance guys.

Archangel
- 26th September 2007, 23:06
MPASM is very picky as to missing or extra spaces, and missing or extra _ _ _ characters.

mister_e
- 27th September 2007, 01:46
In case of doubt, the .INC is handy... look at the end. There you'll discover _CONFIG1 and _CONFIG2

Try...
__config _CONFIG1, _XT_OSC & _WDT_OFF & _PWRTE_ON

Ruben Pena
- 16th October 2007, 01:01
Hi:
The 16f84 has not ADC neither comparators, the 16f886 has. You need the appropiate instructions to disable that functions.
Greetings..
Ruben de la Pena