BLINK.BAS - Trying to program PIC16F84A Please help

  • Thread starter chien_fu
  • Start date
  • Tags
    Program
In summary, the programmer is not working and the code is getting error messages when trying to program the chip. It is possible that the watchdog timer or code protect is off. It is also possible that the chip has been on the shelf for a while and may not be properly programmed.
  • #1
chien_fu
4
0
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.
 
Engineering news on Phys.org
  • #2
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.
 
  • #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?
 
  • #4


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?
 

FAQ: BLINK.BAS - Trying to program PIC16F84A Please help

What is BLINK.BAS and what does it do?

BLINK.BAS is a program written in the BASIC programming language that is designed to control the blinking of an LED using a PIC16F84A microcontroller. It is commonly used as a starting point for beginners learning how to program microcontrollers.

What is the PIC16F84A microcontroller?

The PIC16F84A is a type of microcontroller, which is a small computer on a single integrated circuit. It is commonly used in electronic devices and can be programmed to perform a variety of tasks.

How do I use BLINK.BAS to program the PIC16F84A?

To use BLINK.BAS, you will need a computer with a BASIC compiler and a PIC programmer. First, open the BLINK.BAS program in your BASIC compiler and make any necessary modifications. Then, connect the PIC programmer to your computer and the PIC16F84A microcontroller. Finally, use the PIC programmer to upload the BLINK.BAS program to the microcontroller.

Can I modify BLINK.BAS to control more than one LED?

Yes, you can modify BLINK.BAS to control multiple LEDs by making changes to the code. The number of LEDs that can be controlled will depend on the capabilities of the PIC16F84A microcontroller.

Is BLINK.BAS compatible with other microcontrollers?

BLINK.BAS is specifically designed for the PIC16F84A microcontroller, but it can be modified to work with other microcontrollers as well. However, the code may need to be adjusted to account for the differences in hardware and programming languages.

Back
Top