Difference between coding for PIC16F84 and PIC16F84A

Discussion in 'Embedded Systems and Microcontrollers' started by frenchvanilla, May 18, 2013.

  1. frenchvanilla

    Thread Starter New Member

    May 18, 2013
    I'm new with coding and programming microcontrollers. And I'm currently working on a combination lock program that requires only two push buttons and 4 LEDs as indicators. I found a site that provides the program, but uses a PIC16F84 microcontroller. In my case, I have to use a PIC16F84A. To my knowledge the only difference between the two PICs are the delay. However, when I tried changing the delay, the build was unsuccessful. I hope someone can help me with this. This was the program that I found on the internet that uses the PIC16F84 > http://www.piclist.com/techref/piclist/cheapic/combo.htm. But I only made slight changes to it, like the processor and what not. But I wasn't sure whether to change the ports. But in my project I'm only using Port B as my input/output. Can someone please point out on where to change the programs so it could be compatible to PIC16F84A? In my project I use a 4MHz crystal oscillator, not following the project from the website that I just shared.
  2. Markd77

    Senior Member

    Sep 7, 2009
    The delays need to be around 122 times longer. Probably the easiest way is to recalculate them. There's no problem having three separate delay subroutines instead of what is in the original code, plenty of code space.
    Try this:
    I imagine you tried using numbers larger than 255 in the original routine, which causes problems because that is the largest number an 8 bit register can hold.
    You also need to change

    in the config to

    _XT_OSC or _HS_OSC

    I forget which, it's in the datasheet in the oscillator section.