PDA

View Full Version : BLINK.BAS - Can't make it work!!!! Please help!!



chien_fu
- 7th June 2008, 17:42
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.

Darrel Taylor
- 7th June 2008, 20:06
Well, first off ... The 16F84A doesn't have an Internal Oscillator.
RC mode is for an external Resistor and Capacitor.
But that doesn't explain your problem programming them.

Are you programming it in a Zif socket?
Or is the chip "In Circuit"?

If In-circuit, what else is connected to RB6, RB7 and MCLR?
<br>

chien_fu
- 7th June 2008, 20:13
huh.. good to know about the oscillator.. I'll have to look into that.
I am not using a zif socket, but it is not in-circuit either, I am just using the 18-pin socket on the EPIC programmer. I think my ZIF is not working for some reason. The chip reads all 0000's when I try to use the ZIF.

Darrel Taylor
- 7th June 2008, 21:17
In the same folder as EPICWIN.EXE

There's a file named EPIC.HTM. Open it with a web browser.
Look at the section labeled EPIC Troubleshooting

One of them usually fixes most problems.
<br>