+ Reply to Thread
Results 1 to 15 of 15

Thread: PIC 16F84 to 16F628a question

  1. #1
    lompa Newbie
    Join Date
    Aug 2004
    Posts
    64

    PIC 16F84 to 16F628a question

    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


  2. #2
    Super Moderator Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent
    Join Date
    Nov 2003
    Location
    Derbyshire, UK
    Posts
    29,370

    Re: PIC 16F84 to 16F628a question

    Quote Originally Posted by lompa
    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.
    PIC programmer software, and PIC Tutorials at:
    http://www.winpicprog.co.uk

  3. #3
    lompa Newbie
    Join Date
    Aug 2004
    Posts
    64

    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

  4. #4
    Super Moderator Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent
    Join Date
    Nov 2003
    Location
    Derbyshire, UK
    Posts
    29,370

    Quote Originally Posted by lompa
    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?.
    PIC programmer software, and PIC Tutorials at:
    http://www.winpicprog.co.uk

  5. #5
    lompa Newbie
    Join Date
    Aug 2004
    Posts
    64

    Quote Originally Posted by Nigel Goodwin
    Quote Originally Posted by lompa
    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

  6. #6
    TheOne Newbie
    Join Date
    Oct 2004
    Location
    USA
    Posts
    464

    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

  7. #7
    Super Moderator Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent
    Join Date
    Nov 2003
    Location
    Derbyshire, UK
    Posts
    29,370

    Quote Originally Posted by lompa
    Quote Originally Posted by Nigel Goodwin
    Quote Originally Posted by lompa
    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.
    PIC programmer software, and PIC Tutorials at:
    http://www.winpicprog.co.uk

  8. #8
    Super Moderator Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent
    Join Date
    Nov 2003
    Location
    Derbyshire, UK
    Posts
    29,370

    Re: Question to Nigel

    Quote Originally Posted by TheOne
    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.
    PIC programmer software, and PIC Tutorials at:
    http://www.winpicprog.co.uk

  9. #9
    TheOne Newbie
    Join Date
    Oct 2004
    Location
    USA
    Posts
    464

    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?

  10. #10
    Super Moderator Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent
    Join Date
    Nov 2003
    Location
    Derbyshire, UK
    Posts
    29,370

    Quote Originally Posted by TheOne
    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.
    PIC programmer software, and PIC Tutorials at:
    http://www.winpicprog.co.uk

  11. #11
    martinH Newbie
    Join Date
    Sep 2004
    Posts
    28

    Quote Originally Posted by Nigel Goodwin
    Quote Originally Posted by lompa
    Quote Originally Posted by Nigel Goodwin
    Quote Originally Posted by lompa
    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

  12. #12
    joseflor Newbie
    Join Date
    Sep 2007
    Location
    Australia
    Posts
    5

    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 by joseflor; 6th September 2007 at 09:18 AM.

  13. #13
    Gayan Soyza Excellent Gayan Soyza Excellent Gayan Soyza Excellent Gayan Soyza Excellent Gayan Soyza Excellent Gayan Soyza Excellent
    Join Date
    Oct 2006
    Location
    Colombo
    Posts
    1,612
    Blog Entries
    1

    Here look at this link it has done with 628A.

    http://sandiding.tripod.com/pwm.html

  14. #14
    joseflor Newbie
    Join Date
    Sep 2007
    Location
    Australia
    Posts
    5

    Quote Originally Posted by Gayan Soyza
    Here look at this link it has done with 628A.

    http://sandiding.tripod.com/pwm.html
    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

  15. #15
    joseflor Newbie
    Join Date
    Sep 2007
    Location
    Australia
    Posts
    5

    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

+ Reply to Thread

Tags for this Thread