problem with MCS


Closed Thread
Results 1 to 3 of 3
  1. #1
    James1's Avatar
    James1 Guest

    Default problem with MCS

    Hi -

    I am trying to program PIC16F877A(16Mhz) bootloader. The language in which I have written the code is Basic, and the compiler is Microcode studio.
    The program gets compiled correctly producing a hex file. Now when I download the hex fie in the controller the controller doesn't respond to the code.

    The code is :

    '************************************************* ***************
    '* Name : UNTITLED.BAS *
    '* Author : [select VIEW...EDITOR OPTIONS] *
    '* Notice : Copyright (c) 2010 [select VIEW...EDITOR OPTIONS] *
    '* : All Rights Reserved *
    '* Date : 11/23/2010 *
    '* Version : 1.0 *
    '* Notes : *
    '* : *
    '************************************************* ***************

    @ device PIC16F877A,HS_OSC
    @ device PIC16F877A,WDT_OFF
    @ device PIC16F877A,PWRT_OFF
    @ device PIC16F877A,DEBUG_OFF
    @ device PIC16F877A,CPD_OFF
    @ device PIC16F877A,PROTECT_OFF

    loop: high 1
    pause 20
    low 1
    pause 20
    goto loop

    end


    Is this the problem with the configuration bits or it is something else(compiler). If you know some other Basic compiler, please send me the link so that I can
    download it.

  2. #2
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Smile

    Hi James1,

    Start by adding "DEFINE OSC 16"

    You told the compiler you are using a high speed oscillator with the HS_OSC but you didn't tell it what speed.

    Next make your pause statements at least 1000 initially. All you will see with pause 20 is a light or led that's always on.

    This should get you going.

    BobK

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


    Did you find this post helpful? Yes | No

    Default

    Hi James,
    @ device PIC16F877A,HS_OSC

    Speed costs something, nearly always, in this case it is energy, the config HS, XT . . . are essentially power settings for the oscillator, Bob correctly pointed you to the DEFINE OSC 16 which is supposed to always be in UPPERCASE as he has shown. What this does mostly, is allows PBP to set the timing of it's commands to the correct value so pause 1000 really is 1 second and so serial communications are sent at the programmed value.
    BTW you must be using a version of PBP prior to the latest release of 2.60 as the word "loop" is now a RESERVED word, when you upgrade you will have to use some other method, something like MyLoop or MainLoop. Might be a good idea to start now so as to get out of the habit and make your programs compatible so when Later on you decide to reuse some old code it will compile without error. IMHO
    HTH
    JS
    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.

Members who have read this thread : 1

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