Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

BLINK.BAS - Trying to program PIC16F84A Please help

  1. Jun 7, 2008 #1
    BLINK.BAS - Trying to program PIC16F84A.. Please help!!

    I just got all set up with my programmer (it's a couple years old, but still seems to be functioning fine, it's the EPIC pro.) And I just bought the PICBASIC compiler. I loaded the sample program BLINK.BAS:

    loop:
    High 0 ' Turn on LED connected to PORTB.0
    Pause 500 ' Delay for .5 seconds

    Low 0 ' Turn off LED connected to PORTB.0
    Pause 500 ' Delay for .5 seconds

    Goto loop ' Go back to loop and blink LED forever
    End


    BLINK.HEX: incase this means anything to you...

    0000- 1e03 0008 0186 305f 008c 300d 0084 0180
    0008- 0a84 0b8c 2807 282c 2021 0084 3907 0684
    0010- 1003 0c84 0c84 0c84 1a04 1784 1204 018a
    0018- 0782 3401 3402 3404 3408 3410 3420 3440
    0020- 3480 3907 018a 0782 3430 3431 3432 3433
    0028- 3434 3435 3436 3437 3000 2041 3001 00a3
    0030- 30f4 2048 3000 203d 3001 00a3 30f4 2048
    0038- 282c 203a 3007 2055 283a 200c 3aff 0580
    0040- 2845 200c 0480 2844 3aff 1784 0580 2864
    0048- 00a2 205e 0064 0823 0422 1903 0008 30f7
    0050- 3eff 1d03 2850 2060 284a 1683 38f8 0581
    0058- 390f 0481 0063 300f 0481 2864 09a3 09a2
    0060- 0aa2 1903 0aa3 0008 1283 0064 0008


    Using a 16F84A
    I have MicroCode Studio set to 16F84A as well as meLabs Programmer v4.23
    I am attempting to use the internal oscillator so have set meLabs to RC.
    Watchdog timer: enabled
    Power up timer: disabled
    Code Protect: off

    I am getting a "Code Programming Error at 0000" when I try to program.

    I first erase the chip, and then read it and it reads:
    0000- 3fff 3fff 3fff 3fff 3fff 3fff 3fff 3fff
    0008- 3fff 3fff 3fff 3fff 3fff 3fff 3fff 3fff
    0010- 3fff 3fff 3fff 3fff 3fff 3fff 3fff 3fff
    0018- 3fff 3fff 3fff 3fff 3fff 3fff 3fff 3fff
    etc...

    I program the chip, it gives me the error, and it then I read it and it reads:
    0000- 1e03 3fff 3fff 3fff 3fff 3fff 3fff 3fff
    0008- 3fff 3fff 3fff 3fff 3fff 3fff 3fff 3fff
    0010- 3fff 3fff 3fff 3fff 3fff 3fff 3fff 3fff
    0018- 3fff 3fff 3fff 3fff 3fff 3fff 3fff 3fff
    etc...

    I've tried this with a half a dozen chips with the same result each time. Note that the chips have been on my shelf for a couple years too. In their anti-static packaging in a fairly dry, temperate atmosphere.

    I notice that when I load the HEX file into meLabs, it automatically calls up a XT oscillator, and I have been changing it from XT to RC. Do I need to specify RC in MicroCode IDE or in the program somewhere?

    Is there anything else I'm missing? Any help would be greatly appreciated, as I'm pretty new to this.
     
  2. jcsd
  3. Jun 7, 2008 #2

    NoTime

    User Avatar
    Science Advisor
    Homework Helper

    Welcome to PF.

    I'm not familiar with your particular setup.
    However, I have to wonder at the 3FFF.
    I would think that it should be FFFF which is the erase state for the things I have worked with.
     
  4. Jun 9, 2008 #3
    The PIC uses 14 bit words, so 3fff is correct.

    You might try turning the watchdog off.

    Was this a self build Epic or one you bought ready made?
     
  5. Feb 8, 2010 #4
    Re: BLINK.BAS - Trying to program PIC16F84A.. Please help!!

    Let's bring this back to the top of the list.. I know it's been a couple years, but I got that same programmer back out and it's doing the same thing. Now it seems to get through 4 bytes instead of just the first one though...

    This is a purchased programmer from meLabs.
    Any new thoughts or revelations on this?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: BLINK.BAS - Trying to program PIC16F84A Please help
  1. Help in pic16f84a (Replies: 1)

Loading...