1st 16F877A program in PICBasic


Results 1 to 5 of 5

Threaded View

  1. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    yes for sure. There's many way to do that.

    First of all, we will disable the PBP default configuration setting. with NOTEPAD open 16F877A.INC file in the PBP folder. It look like this
    Code:
    ;****************************************************************
    ;*  16F877.INC                                                  *
    ;*                                                              *
    ;*  By        : Leonard Zerman, Jeff Schmoyer                   *
    ;*  Notice    : Copyright (c) 2003 microEngineering Labs, Inc.  *
    ;*              All Rights Reserved                             *
    ;*  Date      : 11/07/03                                        *
    ;*  Version   : 2.45                                            *
    ;*  Notes     :                                                 *
    ;****************************************************************
            NOLIST
        ifdef PM_USED
            LIST
            include 'M16F87x.INC'   ; PM header
            device  pic16F877, xt_osc, wdt_on, pwrt_on, lvp_off, protect_off
            XALL
            NOLIST
        else
            LIST
            LIST p = 16F877, r = dec, w = -302
            INCLUDE "P16F877.INC"   ; MPASM  Header
            __config _XT_OSC & _WDT_ON & _PWRTE_ON & _LVP_OFF & _CP_OFF
            NOLIST
        endif
            LIST
    now place a ; in front of theses lines
    Code:
    device  pic16F877, xt_osc, wdt_on, pwrt_on, lvp_off, protect_off
    
    __config _XT_OSC & _WDT_ON & _PWRTE_ON & _LVP_OFF & _CP_OFF
    will look like this
    Code:
    ;device  pic16F877, xt_osc, wdt_on, pwrt_on, lvp_off, protect_off
    
    ;__config _XT_OSC & _WDT_ON & _PWRTE_ON & _LVP_OFF & _CP_OFF
    default setting are now disabled.

    Now putting your configuration fuse into your program:

    If you're using PM as assembler(wich is, as i remind, the default setting in MicroCode Studio) you'll add this line in your program header

    @ DEVICE PIC16F877A, HS_OSC

    If you get some compilation error it's because you're using MPASM as assembler so use the following

    @ __config _HS_OSC

    Everything is also well explain in this thread

    What do different clock speeds mean? (LP,XT,HS,RC)
    I hate to say that but all the explanations are in the datasheet. Different oscillator setting, different possible oscillator speed.
    In your case XT is for an crystal up to 4MHZ, HS 4MHZ & up.
    Last edited by mister_e; - 19th January 2005 at 04:26.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Presetting Configuration Fuses (PIC Defines) into your Program
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 82
    Last Post: - 15th December 2013, 10:54
  2. Replies: 1
    Last Post: - 23rd May 2009, 10:22
  3. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 09:26
  4. 16f877a
    By dirkwerk in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 19th November 2007, 23:01
  5. PIC16F684 Program question
    By Nicholas in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th December 2006, 15:30

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