hex file problem


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2011
    Posts
    30

    Default hex file problem

    i have a very strange and one can say an ironic problem.


    i have this simple code of checking led high:
    '************************************************* ***************
    '* Name : UNTITLED.BAS *
    '* Author : [select VIEW...EDITOR OPTIONS] *
    '* Notice : Copyright (c) 2011 [select VIEW...EDITOR OPTIONS] *
    '* : All Rights Reserved *
    '* Date : 5/22/2011 *
    '* Version : 1.0 *
    '* Notes : *
    '* : *
    '************************************************* ***************
    @ DEVICE pic16F877a, WDT_OFF ' Watchdog Timer
    @ DEVICE pic16F877a, PWRT_OFF ' Power-On Timer
    @ DEVICE pic16F877a, BOD_OFF ' Brown-Out Detect
    @ DEVICE pic16F877a, LVP_OFF ' Low-Voltage Programming
    @ DEVICE pic16F877a, CPD_OFF ' Data Memory Code Protect
    @ DEVICE pic16F877a, PROTECT_OFF ' Program Code Protection

    DEFINE OSC 20

    red_LED Var PortB.0

    LOW red_LED

    START:
    HIGH red_LED
    GOTO START
    ok.now the hex it is generating i used proteus to check the led it is working fine in that.but when i burn the same hex file in my pic no 5v on picb.0. im a newbie in this.plz help me in this regard!

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


    Did you find this post helpful? Yes | No

    Default Re: hex file problem

    Very first thing I see is a missing config for HS_OSC . . .
    Then your loop never turns off the LED, and do not forget a pause so you can see it go off
    or use the command toggle with a pause.

    NOT REQUIRED with HIGH / LOW are tris registers as those statements automatically set tris
    for you, But It is good practice to set port status first, then set tris to make ports inputs or outputs
    in that order, like so
    PortB = %00000000
    TrisB = %10000000
    in this case PortB.7 is unaffected by the tris, but all other PortsB are set low and then as outputs
    That way when they become outputs they do so in the state you want them, in this case all low.
    Last edited by Archangel; - 24th May 2011 at 09:53. Reason: add add add
    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.

  3. #3
    Join Date
    Mar 2011
    Posts
    30


    Did you find this post helpful? Yes | No

    Default Solved

    thanks a lot sir.you saved my day.n i just wana ask one more think.it is that i am using PULSIN function.so for that particular function do i have to add any configuration fuses or not???

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


    Did you find this post helpful? Yes | No

    Default Re: hex file problem

    Copy Paste from the book:

    The resolution of PULSIN is dependent upon the oscillator frequency. If
    a 4MHz oscillator is used, the pulse width is returned in 10us increments.
    If a 20MHz oscillator is used, the pulse width will have a 2us resolution.

    Defining an OSC value has no effect on PULSIN. The resolution always
    changes with the actual oscillator speed.
    PULSIN normally waits a maximum of 65535 counts before it determines
    there is no pulse. If it is desired to wait fewer or more counts before it
    stops looking for a pulse or the end of a pulse, a DEFINE can be added:
    DEFINE PULSIN_MAX 1000
    This DEFINE also affects RCTIME in the same manner.

    ‘ Measure high pulse on Pin4 stored in W3
    PULSIN PORTB.4,1,W3

    So the short answer is I do not think so, beyond the configs stated including the HS_OSC. I am guessing you have commented out the default configs in the 16F877A.inc file in PBP root directory.
    Set up a word variable to store your results.
    whatever number you get multiply by 2 micro seconds and that is your result at 20 mhz osc. Pulsin sets the tris like High / Low does.
    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.

  5. #5
    Join Date
    Mar 2011
    Posts
    30


    Did you find this post helpful? Yes | No

    Default Re: hex file problem

    ok.got it.thanks a lot sir!

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