Why does the clock stop?



THE BOOK of DT's INTERRUPTS is an organization of interrupt service routines and other works written by Darrel Taylor, RIP.

Interrupt routines are arranged per Darrel's original list. Darrel Taylor's Instant Interrupts are an extension of the work of Tim Box whom in October of 2002 wrote INT_CTRL.pbp

Many of the forum members felt this is a long overdue project.

THE BOOK of DT's INTERRUPTS
will be a valuable resource and a tribute to Darrel Taylor the "Fanatical Contributor".

THE BOOK of DT's INTERRUPTS is located at http://dt.picbasic.co.uk/

+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Jan 2006
    Location
    New Hampshire, USA
    Posts
    107

    Default 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. #2
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Default

    Your routine has some bugs:

    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 ?
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,588


    Did you find this post helpful? Yes | No

    Wink Solution

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

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    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.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,588


    Did you find this post helpful? Yes | No

    Default

    Heuuuuu

    What about MCLR ???

    " 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 !!!

    see : http://www.picbasic.co.uk/forum/showthread.php?t=3944

    Alain
    Last edited by Acetronics2; - 27th May 2006 at 15:58.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  6. #6
    Join Date
    Jan 2006
    Location
    New Hampshire, USA
    Posts
    107


    Did you find this post helpful? Yes | No

    Default

    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.
    Attached Images Attached Images  
    Last edited by Russ Kincaid; - 28th May 2006 at 01:45.

  7. #7
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Angry

    Quote 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!!!! ;-) )
    Give us more informations, if you want to get some help. Just list your program here!
    Last edited by BigWumpus; - 28th May 2006 at 19:28.
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  8. #8
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,588


    Did you find this post helpful? Yes | No

    Default

    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 !!!
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  9. #9
    Join Date
    Jan 2006
    Location
    New Hampshire, USA
    Posts
    107


    Did you find this post helpful? Yes | No

    Default

    Bigwumpus gave me the clue: I disabled low voltage programming and it works! Thanks to all.

    Russ

Similar Threads

  1. Clock using Instant Interrupts
    By PICpocket in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th February 2009, 21:43
  2. EM4095 Chip, get Clock and Data signals?
    By mindthomas in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 19th August 2008, 06:27
  3. Shiftout/in
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 23rd August 2007, 11:48
  4. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  5. LCD Clock, Interrup
    By Patrick in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 16th July 2006, 16:00

Posting Permissions

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