Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC 16F84 to 16F628a question

Status
Not open for further replies.

lompa

New Member
hi i have a PIC board with input and output pins down the sides, this board was designed for the 16f84, i know the 16f628a uses the same pins but i have found that the 16f628a has an internal oscillator, My board has a 4mhz crystal on it.

The question

can i just stick the 16f628a in place of the 16f84 or do i need to remove the oscillator?

if i can just stick the 16f628a in place do i need to disable the internal oscillator or will it just sort itself out?

thanks
 
lompa said:
hi i have a PIC board with input and output pins down the sides, this board was designed for the 16f84, i know the 16f628a uses the same pins but i have found that the 16f628a has an internal oscillator, My board has a 4mhz crystal on it.

The question

can i just stick the 16f628a in place of the 16f84 or do i need to remove the oscillator?

if i can just stick the 16f628a in place do i need to disable the internal oscillator or will it just sort itself out?

The 628 is the modern repalcement for the obselete 84, just as with the 84 you have to set the config fuses for the oscillator you wish to use. Simply set it to XT as you do for the 84.

If you check on the MicroChip website there's a 'migration document', giving details of what you need to change for upgrading from 84 to 628. Basically you just need to disable the comparators, it takes two lines, if you check my tutorials they all do it, and it's clearly commented.

So add the two lines to your source code, alter the header lines and config fuse settings, and reassemble the code. That's all you need to do!, there's no hardware changes at all.
 
thanks for the help, im actually using basic to program the chip, do i still have to follow the same steps? but just do it with basic coding?

thanks
 
lompa said:
thanks for the help, im actually using basic to program the chip, do i still have to follow the same steps? but just do it with basic coding?

If you're using a BASIC compiler all you should need to do is tell your compiler what chip you are using, the compiler should produce the correct code automatically. Presuming your compiler supports the chip of course?.
 
Nigel Goodwin said:
lompa said:
thanks for the help, im actually using basic to program the chip, do i still have to follow the same steps? but just do it with basic coding?

If you're using a BASIC compiler all you should need to do is tell your compiler what chip you are using, the compiler should produce the correct code automatically. Presuming your compiler supports the chip of course?.

it wont know i am using a 4mhz external osc though, what happens if the internal ones runs and the external one?

thanks for the help
 
Question to Nigel

Nigel,

The 628 pic has it's own power-up timer reset. I am having a problem with one application where this 100mS delay is too short as the supply comes up slower and cause the micro to lock up sometimes. What is the correct thing to do, go back to external timing components? Also when should brown-out bit be enabled?

Thanks TO
 
lompa said:
Nigel Goodwin said:
lompa said:
thanks for the help, im actually using basic to program the chip, do i still have to follow the same steps? but just do it with basic coding?

If you're using a BASIC compiler all you should need to do is tell your compiler what chip you are using, the compiler should produce the correct code automatically. Presuming your compiler supports the chip of course?.

it wont know i am using a 4mhz external osc though, what happens if the internal ones runs and the external one?

thanks for the help

They can't both run, the design on the PIC means only one oscillator option can be selected.

Anything like this is down to your particular BASIC compiler, how do you currently tell it to use a 4MHz oscillator?. The 16F84 has a number of different oscillator options, if the right one isn't selected it won't work - the 628 is no different, it needs telling which option to use.

As you're using BASIC, this is ENTIRELY down to the compiler, the instructions should tell you how to do it.
 
Re: Question to Nigel

TheOne said:
Nigel,

The 628 pic has it's own power-up timer reset. I am having a problem with one application where this 100mS delay is too short as the supply comes up slower and cause the micro to lock up sometimes. What is the correct thing to do, go back to external timing components? Also when should brown-out bit be enabled?

My first thought is to sort your PSU out!.

Failing that, use an external reset circuit that will hold the reset pin low for longer than the PSU takes to come up.
 
The PSU I have no control over as this board get's installed by various customers on their own power supplies. I can only make a recommendation to the supply they should use but customers often like to follow their own will.

Also can someone indicate when the brown-out bit should be used. I have read somewhere that enabling this sometimes causes more problems than it is supposed to fix?
 
TheOne said:
The PSU I have no control over as this board get's installed by various customers on their own power supplies. I can only make a recommendation to the supply they should use but customers often like to follow their own will.

I should try the external reset route then?.

Also can someone indicate when the brown-out bit should be used. I have read somewhere that enabling this sometimes causes more problems than it is supposed to fix?

It makes the PIC reset more readily if the power supply drops briefly, a sudden reduction in voltage might be enough to crash the PIC, but not enough to cause a reset. The brown-out option makes the reset more agressive. If the power supply used is really bad it may well cause the PIC to reset frequently - giving the impression that it's causing more problems than it cures, but really it's the duff PSU that's the problem.
 
Nigel Goodwin said:
lompa said:
Nigel Goodwin said:
lompa said:
thanks for the help, im actually using basic to program the chip, do i still have to follow the same steps? but just do it with basic coding?

If you're using a BASIC compiler all you should need to do is tell your compiler what chip you are using, the compiler should produce the correct code automatically. Presuming your compiler supports the chip of course?.

it wont know i am using a 4mhz external osc though, what happens if the internal ones runs and the external one?

thanks for the help

They can't both run, the design on the PIC means only one oscillator option can be selected.

Anything like this is down to your particular BASIC compiler, how do you currently tell it to use a 4MHz oscillator?. The 16F84 has a number of different oscillator options, if the right one isn't selected it won't work - the 628 is no different, it needs telling which option to use.

As you're using BASIC, this is ENTIRELY down to the compiler, the instructions should tell you how to do it.



At the begining of your code , you should set the config fuses.
One of these being " xt_osc or hs_osc" to set external xtal.

the following is copied from the proton manual

configuration fuse settings vary from PICmicro to PICmicro, however, certain settings are standard to most PICmicro types. These are: -

WDT_ON Enable the internal Watchdog timer.
WDT_OFF Disable the internal Watchdog timer.
HS_OSC Use a High-speed crystal (Xtals over 4MHz) .
XT_OSC Use a standard crystal (4MHz or under).
LP_OSC Use a low frequency crystal (KHz range).
PWRTE_ON Enable power up timer.
PWRTE_OFF Disable power up timer.

Example

' Disable the Watchdog timer and specify an HS_OSC etc, on a PIC16F877 device
CONFIG HS_OSC , WDT_OFF , PWRTE_ON , BODEN_OFF , LVP_OFF , WRTE_ON , CP_OFF , DEBUG_OFF
 
Hello,
I am new in microcontrollers and all projects I did were with PIC16F84A. I want to migrate one project (fading up/down LED) to a PIC16F627A, and I don’t know how to do that. I searched on the microchip web page, but didn’t find it.
Any help is welcome.
José Flor
 
Last edited:
Gayan Soyza said:
Here look at this link it has done with 628A.

**broken link removed**
Great Gayan,
I did a very long code with a lot of PWM.
How do I change that code for Fade up and down in a total of 10 seconds?
Cheers
José Flor
 
Ups,
I figured out the problem.
I did a few changes in the code but I was burning the original code. Being the case I couldn’t see it working differently.
I'm sorry for this inconvenient.
José Flor
 
Status
Not open for further replies.

Latest threads

Back
Top