PDA

View Full Version : blinking stops



lerameur
- 22nd September 2006, 14:05
hello,

I just finish building the easyProgrammer. I am now
doing test. I was able to program a few chip with a
led blinking program.
But it blinks for a few seconds only,10
sec with a 16F648 and the same with a F88.
i use the program in the picbasic compiler pro on page 6.
Althought I see that there is setting of the clock anywhere

ken

keithdoxey
- 22nd September 2006, 14:39
Can you post your ENTIRE code so we can see if there are any errors in it.

lerameur
- 22nd September 2006, 15:16
oK HERE IT IS:

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

Low PORTB.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


aslo, I tried this code I found on google and it works fine:

pragma target chip 16f628 -- no 16f818 support yet
pragma target fuses 0x3F22
pragma target clock 20_000_000
pragma target osc hs

include jpic
include jlib

var bit LED is pin_a0
pin_a0_direction = output

asm bsf status, 5
var volatile byte ADCON1 at 0x9F = 0x06 -- disable port a analog functions
asm bcf status, 5

forever loop
LED = low
delay_10ms( 25 )
LED = high
delay_10ms( 25 )
end loop

ErnieM
- 22nd September 2006, 15:17
Hey, that's better then most programs do the first time thru!!!

The code on page 6 doesn't have much to go wrong with it. 10 seconds sounds too long for something like the watchdog to fire, but I believe that will be on by default.

What are you powering this with? Could the power be off after 10 secs?

lerameur
- 22nd September 2006, 15:27
there is a 12v battery to the breadboard, and a LM7805 regulating the circuit at 5.0 volt. 4 Mhz oscillator with 22pf cap.s

Like i says it does work fine with the *.jal program I found at http://www.voti.nl/blink/code/b818-2.jal

but my program do not work for more then 10- to 20 seconds

ken

lerameur
- 22nd September 2006, 16:01
I have to add, if I unplug the power and wait like 5 minutes, then i get another series of 30 seconds blinking.
If I just unhook the battery for a few seconds and put back the power, then it just barely flash and shut off.
It seems some sort of memory is being unloaded and no power and filled up when it is activated.
I has to do with the program , because it is working fine with the jal version


k

ErnieM
- 22nd September 2006, 16:37
Interesting problem. Same code 2 different compilers, 2 diffrent results.

Here's something to look at: Fire up MPLAB, select the device type to match your PIC, then import the hex code for each version in turn.

See if there are any differences in the config bits.

lerameur
- 22nd September 2006, 17:16
Actually the Jal version I used his hex file. it is programmed in jal. I am trying to programin basic and it do not work.
Another interesting fact, I just used MikroC with this program:
(I adjusted Mikroc to my pic chip and at 4 Mhz)

void main() {
PORTB = 0;
TRISB = 0;

while(1) {
PORTB = ~PORTB;
Delay_ms(500);
}
}

it did work for a few minutes, i thought I had it, but after my diner it had stopped :(

then I tried the jal version again and it did work for a long, after that I disconnected it
http://www.voti.nl/blink/code/b818-2.jal

DanPBP
- 23rd September 2006, 08:11
Do you have a 10k resistor connected to MLCr and + ?

That drove my crazy the first time I played with pics.

Regards,
Daniel.

lerameur
- 23rd September 2006, 15:53
Yes.. that was what someone told me yesterday afternoon. It is now working. I spent like 10 hours on this yesterday, all i needed was a resistor...pffff unbelievable. I will have to read on that, MCLR

ken