convert from 16f84a to 16f628a need help

Status
Not open for further replies.

xxxxxx025

New Member
i have 16f84 program and i want to convert this program 16f628a need help icant do this.

this att. have 16f84 codes and 16f84,16f628a simulating program
 

Attachments

  • Desktop.rar
    28 KB · Views: 210
UPGRADING FROM PIC16F84 TO PIC16F628
If you are upgrading from a PIC16F (or C) 84 (A), the pinout is below. Note all the port pins are in the same positions on both chips. Port B is identical. Port A on the PIC16F84 has 4 in/out and 1 "input and "half-output". The PIC16F628 has 6 in/out, one "input and half-output" (RA4) and 1 input only (RA5).

The thing you have to remember is:
On both the PIC16F84 and PIC16F628, RA4 is an "input and half-output". When used as an output, these pins will only sink 25mA and source 0mA. To make the pin source, connect the base of a transistor to the pin and put the transistor in emitter-follower mode by connecting the collector to the positive rail as in the diagram below. RA5 on a PIC16F628 is input only.
MAKING RA4 SOURCE A CURRENT
RA4 will not deliver a current to a load. To make it deliver a current, the following circuit can be used. Place a 2k2 on the base, to positive. When the pin is HIGH (or as an input) the emitter will source (deliver) 25mA (or more) as the base is being pulled HIGH by the 2k2. The current via the emitter is equal to the base current multiplied by the gain of the transistor. When the output of the micro is LOW, the base will be pulled low by the pin and the emitter will be low. The circuit below will not allow for sinking a current. But it makes the pin source just like the other outputs. Don't forget, the maximum current for the chip, via all the pins is less than 250mA, to prevent overheating.


Note: the first temporary storage file for PIC16F84 is 0Ch.
Note: the first temporary storage file for PIC16F628 is 20h.
 
Simple. Change the config word to this (assuming you're using a 4MHz crystal) -

Code:
		__config		_LVP_OFF & _BOREN_OFF & _PWRTE_ON & _WDT_OFF & _XT_OSC

Then add these instructions just before the first two instructions in your code to disable the on chip comparator -

Code:
		org			0x000		;reset vector
		goto			START

START		movlw			0x07		;disable on chip comparator
		movwf			CMCON

		;rest of code goes here

Everything else should be the same. Setting up the config word as shown above and disabling the comparator essentially makes it the same as a 16F84A so nothing else should be needed unless you decide to use some of the F628A's on chip peripherals.
 
Last edited:
And when you are about to load the code into the 16F628, be sure to choose 16F628 in the list of PICs.

I use ic_prog, but I expect the others are similar
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…