Newbie need Help 16F627a


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Hi azmax100,

    FYI it really should work with either MPASM or the PM assembler. Look in your 16F628.INC and see if all config options are the same for both the PM & MPASM config settings.

    It may be that you have some config options set different in the MPASM config line.

    For example - say your 16F628.INC file has something like this

    Code:
      NOLIST
        ifdef PM_USED
            LIST
            include 'M16F62x.INC'   ; PM header
            device  pic16F628, hs_osc, wdt_on, pwrt_on, mclr_off, lvp_off, protect_off
            XALL
            NOLIST
        else
            LIST
            LIST p = 16F628, r = dec, w = -302
            INCLUDE "P16F628.INC"   ; MPASM  Header
            __config _XT_OSC & _WDT_ON & _PWRTE_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF
            NOLIST
        endif
            LIST
    Now let's say you're using the default PM assembler & not MPASM. When you compile, PBP knows you're using the PM assembler, so it uses these configuration settings --

    device pic16F628, hs_osc, wdt_on, pwrt_on, mclr_off, lvp_off, protect_off

    With a 20MHz crystal, you want/need the hs_osc setting. If you do not have a pull-up resistor on the PIC /MCLR pin, you also want the mclr_off setting.

    Why? Because HS_OSC provides a higher drive level required by the higher speed 20MHz crystal. XT_OSC provides a lower drive level, which may or may not work.

    MCLR_OFF turns OFF the external reset function on the /MCLR pin, so the external pull-up resistor isn't necessary.

    Now, let's say you have no external pull-up, and you're using the 20MHz crystal, and you switch to use the MPASM asembler.

    Again, when you compile, PBP will now know you're using the MPASM assembler, and it will now use the config settings shown above that look like this --

    __config _XT_OSC & _WDT_ON & _PWRTE_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF

    Now it doesn't work because you have _XT_OSC (which doesn't provide enough drive to work with your 20MHz crystal), and you have the reset function enabled for the /MCLR pin with no pull-up to Vcc, and /MCLR is floating.

    That would for sure cause erratic behaviour.

    Just FYI. Config settings make a BIG difference.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    Hi azmax100, . . .



    Just FYI. Config settings make a BIG difference.
    This area seems to trap more new programmers than all the others, and is the most neglected, (by the current group of book authors), subject I have seen. This is one of those areas I am sure BRUCE will not neglect in his book. BTW Bruce, how is that coming ?
    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.

Similar Threads

  1. Newbie making an ignition timer
    By ChrisHelvey in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 5th August 2012, 17:45
  2. Newbie: Temperature measurements
    By Budda in forum General
    Replies: 10
    Last Post: - 30th March 2007, 09:56
  3. PIC Newbie
    By azmax100 in forum Schematics
    Replies: 7
    Last Post: - 23rd February 2007, 04:52
  4. request for a newbie forum
    By nimonia in forum Forum Requests
    Replies: 1
    Last Post: - 20th May 2006, 09:01
  5. 16F627A portA4 problem?
    By markedwards in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd October 2005, 19:54

Members who have read this thread : 0

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