PDA

View Full Version : Timer 1 kills PIC



jpeakall
- 11th January 2009, 17:36
Hi All,

I am using a PIC 16F628A, PicBasicPro and an MELABS serial programmer. When I start playing with timer 1, I killl the PIC. I can erase and read, but not reprogram. I know it is in the T1CON register, and I see poast relating to this issue, but I cn't seem to find out specifically what I am doing wrong. Here is what I think is relavent in the code:

@ DEVICE HS_OSC,MCLR_ON,LVP_OFF,WDT_OFF,PROTECT_OFF
T1CON = %00001010

T1CON.0 = 1
pause 100
T1CON.0 = 0

I see something about giving he timer time to start up, so a pause at the very begining of the program? I also see something about OSC settings, should I be using the internal OSC @ 4mHz, even though am clocking the chip @ 20mHz?


Is there anyway to salavge the chips?

Darrel Taylor
- 11th January 2009, 22:22
I doubt that it's related to Timer1.
I use Timer1 all the time and have never had a similar problem.

I would suspect LVP (Low Voltage Programming) RB4.

What do you have attached to RB4?
It should be connected to something that provides a LOW voltage on power-up.

When the chip is erased, LVP is automatically enabled.
If the pin is left floating or has a HIGH level on the pin, the chip will not program anymore.

Placing a resistor from RB4 to ground will solve the problem...
If that is the problem.


Added: Are you using an external crystal for Timer1?
T1CON = %00001010 enables Timer1's External oscillator, and those pins are also the clk and data pins for ICSP.
The programmer may have problems if there's a crystal attached.

<br>

jpeakall
- 12th January 2009, 04:03
Nothing is attached to RB4, other than the programmer. I'll add a 10k pulldown. I do have a resonator attached to the clock pins. The funny thing is it happened to two chips, add the T1CON line and boom, it refuses to program. I'll go try your suggestions.

Thanks!

EDIT: Just recovered both of the chips. I plugged them directly into the programmer. Thanks, now at least I can figger out what is going on without destroying chips.

Thanks again!