Why does the clock stop?

# Thread: Why does the clock stop?

1. ## Why does the clock stop?

I am using the internal oscillator. At power up, the PIC goes right to the freq loop, the IF - THEN statements are ineffective and portb.5 does not go low. When I bring portb.5 low, nothing happens but when portb.5 goes high, the clock stops and the power is low. Making portb.5 low again will start the clock but I don't want it to work that way.

REM THIS IS JUST TO SEE IF I CAN MAKE ANYTHING WORK
TRISA = %00010000 'PORT A ALL OUTPUTS, EXCEPT MCLR IS INPUT
TRISB = %00111111 ' PORT B ALL INPUTS EXCEPT 6 & 7 OUTPUT
OPTION_REG = %01111111 ' ENABLE WEAK PULLUP ON PORT B
START:
IF PORTB.5 = 0 THEN POO
IF PORTB.5 = 1 THEN START

POO:
LOW PORTB.5
FREQ:
TOGGLE PORTB.7
PAUSEUS 700
GOTO FREQ
END

2. Did you find this post helpful? |

The If/Then-Part is only used at the very first counts of the PIC.
If PortB.5 is low, it goes to POO, lows PortB.5 (switching from input to output) and circles in the FREQ-Part.
If PortB.5 is high, it circles inside the START-part (does nothing to the outside) and and waits for PortB.5 to go down.

What do you really want to get ?

3. Did you find this post helpful? |

## Solution

CMCON = 7 ... it's a 16F627 !!!

Alain

4. Did you find this post helpful? |
Alain, keep eyes wide open, our friend don't even use the PORTA. As BigWumpus said, is much a matter of Using LOW statement on the same pin used for the initial test.

Maybe LOW PORTB.6 could be the answer.
Last edited by mister_e; - 27th May 2006 at 15:46.

5. Did you find this post helpful? |
Heuuuuu

" TRISA = %00010000 'PORT A ALL OUTPUTS, EXCEPT MCLR IS INPUT "

You'll laugh ... I run his program on my test board !!! ... and it works ... in real life !!!

Alain
Last edited by Acetronics2; - 27th May 2006 at 15:58.

6. Did you find this post helpful? |
So, why does it run on your test board and not on mine?
And, I don't understand CIMCON = 7, it is a register so shouldn't it be
CIMCON = %0001001 ? And what does that do?

My circuit is this: except the switch only goes to ground since I enabled the internal pullups.
Hmmm, I just noticed that my schematic is not up to date: the inputs are RB4 & RB5, the outputs are RB6 & RB7.
Last edited by Russ Kincaid; - 28th May 2006 at 01:45.

7. Did you find this post helpful? |
Originally Posted by Russ Kincaid
So, why does it run on your test board and not on mine?
And, I don't understand CIMCON = 7, it is a register so shouldn't it be
CIMCON = %0001001 ? And what does that do?

My circuit is this: except the switch only goes to ground since I enabled the internal pullups.
Hmmm, I just noticed that my schematic is not up to date: the inputs are RB4 & RB5, the outputs are RB6 & RB7.
1. I see no 0,1uF-ceramic-condensator near the VSS/VDD-pins.

2. I see no bits to turn on the pull-ups inside your program.

3. Read the part on the comperators and the CMCON-register in the manual, tell use what you're CIMCON-register is.

4. Using RB4 ? You has disabled LVP in your fuses ?

...I'm dreaming of mr. eng4444 ! (he's back!!!! ;-) )
Last edited by BigWumpus; - 28th May 2006 at 19:28.

8. Did you find this post helpful? |
Hi,Russ

If you use RB2 and RB3 as switches ... and test the led outputs instead of the switches ... There's no chance it could work properly.

I know that doesn't solve the oscillator question ... but ...

Alain

PS : try to work on ONE scheme at a time ... it will be easier for us to follow you !!!

9. Did you find this post helpful? |
Bigwumpus gave me the clue: I disabled low voltage programming and it works! Thanks to all.

Russ

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts