Need some help converting code for a PIC16F84 to an PIC16F886 [yes ASM]


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2007
    Posts
    12

    Default Need some help converting code for a PIC16F84 to an PIC16F886 [yes ASM]

    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:

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

    Code:
    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:

    Code:
    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.
    Attached Files Attached Files

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Maybe

    MPASM is very picky as to missing or extra spaces, and missing or extra _ _ _ characters.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    In case of doubt, the .INC is handy... look at the end. There you'll discover _CONFIG1 and _CONFIG2

    Try...
    Code:
    	__config _CONFIG1, _XT_OSC & _WDT_OFF & _PWRTE_ON
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Aug 2004
    Posts
    64


    Did you find this post helpful? Yes | No

    Default

    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

Similar Threads

  1. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  2. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  3. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  4. Converting compiled code to unsupported PIC
    By jpadfield in forum General
    Replies: 1
    Last Post: - 20th May 2005, 19:40
  5. Converting Stamp code
    By paul.mcallister in forum General
    Replies: 1
    Last Post: - 8th February 2005, 11:48

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts