Problems with 12F675


Closed Thread
Results 1 to 40 of 67

Hybrid View

  1. #1
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default ...still not work...

    OOps ! I have a big problem : but1 don't work proper ! I double/triple check all ; I change the button, but nothing... After a few press on but1 or EVEN on but2, but1 became inopperating ! If press but2, rel2 go high and but1 stop him, but don't make rel1 high ! Or, if rel2 go low because of overload, but1 don't work not at all ! Must disconnect power source for 're-starting' him...
    But2 works verry fine, but but1 don't !!! I really don't understand ! I check everything for so many times, I change even PIC...Please, help...again...

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hi fratello,
    2 changes for you to try.
    1.turn WDT timer on in your config.
    2.You have used: Call check in several places, change them to
    GoSub check
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Check the T1CON assignment.
    Make sure it has 8-digits.
    Code:
    T1CON = %00110100
    If it's not 8 digits, or if the digits are different, along with disabling the rel1 output on GP5, it may also make it difficult to re-program the chip.
    <br>
    DT

  4. #4
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default

    Thanks for reply ! The code posted by Mr.Darrel works fine with this two modifications :
    ' @ Sleep
    ' GPIF=0 'Clear port change interrupt flag
    Here are something wrong...and, of course, it's only my fault...

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Great !
    Now I have a related question for Darrel . . .
    Sleep vs @ sleep
    PBP vs ASM ?
    I tried both on John's T flusher code and only @sleep would work
    Am I correct, sleep works with some time designation I. E. Sleep 60 , and @ SLEEP works with interrupts ?
    Last edited by Archangel; - 4th August 2009 at 05:19.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    SLEEP vs. @ SLEEP vs. NAP

    PBP's SLEEP command is designed to work with the Watch Dog Timer.
    It sets the WDT prescaler to an appropriate divisor then internally does an @ SLEEP.
    When it wakes-up it decrements a counter and if that counter is still greater than zero, it goes back to sleep.

    The processor may have to go through several hundred or even thousands of sleep/wake cycles before execution of the program will resume. It all depends on the specified period.

    If the WDT is disabled and you are relying on port change interrupts to wake the PIC it will take just as many of those interrupts before the program resumes execution.

    If you are using ASM Interrupts, the ISR will be called on each wake-up. This also may happen several hundred times before the rest of the program can see what happened in the interrupt.

    If you are using ON INTERRUPT, no interrupts will be serviced until after the complete SLEEP command has finished.<hr>
    @ SLEEP in assembly language, simply puts the processor to sleep for 1 sleep/wake cycle. Program execution will resume immediately on the first wake-up. Or if interrupts are enabled, it will jump to the ISR first, then resume were it left off. Although if interrupts are enabled, you <strike>must have 2 NOP's</strike> should have 1 NOP after the @ SLEEP statement to allow the pipeline to load the ISR's first instruction.<hr>
    PBP's NAP command operates much like @ SLEEP, except it changes the WDT prescaler according to the specified period (12F-16F only) before executing an @ SLEEP internally.

    It only waits one sleep/wake cycle.

    hth,
    DT

  7. #7
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    @ SLEEP in assembly language, simply puts the processor to sleep for 1 sleep/wake cycle. Program execution will resume immediately on the first wake-up. Or if interrupts are enabled, it will jump to the ISR first, then resume were it left off. Although if interrupts are enabled, you must have 2 NOP's after the @ SLEEP statement to allow the pipeline to load the ISR's first instruction.
    Thank You Darrel,
    1 sleep / wake cycle ? still not causing sparks across my synapses, Is that OSC/4, Arbitrary countdown of WDT, something conjured using black cat bones and herbs? AND IF WDT is not enabled, will it sleep forever waiting for an interrupt? And if so will that interrupt wake it up?
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  8. #8
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    1 sleep / wake cycle ? still not causing sparks across my synapses, Is that OSC/4, Arbitrary countdown of WDT, something conjured using black cat bones and herbs? ...
    1 sleep/wake cycle is the process of putting the PIC to sleep, and having it wake-up from one of many reasons.

    If that reason is due to the WDT, it may be more like "Black DOG bones".
    The WDT isn't very accurate in most PIC's. And it varies from one Family to another. But essentially it's the base period of the WDT, multiplied by the Prescaler.

    AND IF WDT is not enabled, will it sleep forever waiting for an interrupt? And if so will that interrupt wake it up?
    Yup! She'll pull a "Sleeping Beauty" until a Prince comes along for a kiss.

    Available Princely possibilities are ...
    From the Midrange Reference.



    Also, Bruce pointed out that the datasheets recommend 1 NOP after @ SLEEP instead of 2.

    Not sure why I thought it was two.
    <br>
    DT

  9. #9
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by fratello View Post
    OOps ! I have a big problem : but1 don't work proper ! I double/triple check all ; I change the button, but nothing... After a few press on but1 or EVEN on but2, but1 became inopperating ! If press but2, rel2 go high and but1 stop him, but don't make rel1 high ! Or, if rel2 go low because of overload, but1 don't work not at all ! Must disconnect power source for 're-starting' him...
    But2 works verry fine, but but1 don't !!! I really don't understand ! I check everything for so many times, I change even PIC..
    Some problem !!!!

  10. #10
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default

    I change the resistors from transistors base with 2k2 instead 4k7; nothing !!!
    I change the transistors (BC337) with others (2SC1815; 2SC9014) but the results are all the time the same : after couple of pressing on but1 OR but2 (doesn't matter !) but2 (and rel2) works fine but but1 (rel1-of course) became inopperating !
    Attached Images Attached Images  
    Last edited by fratello; - 8th August 2009 at 14:27. Reason: ...picture of two modules

  11. #11
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hi Fratello,
    Ok, in the crude drawing I posted, R3 is selected to limit the current going through the relay coil. r1 is selected to limit current going into the transistor's base, and R2 is the trick. R2 needs to be smaller than R3, but not so low a value so as to inhibit the transistors operation. R2 will increase the ON current, but should help drive the transistor to "cut off".
    in this link:http://engr.astate.edu/jdg/Electroni...orBiasing.html
    Scroll down to Figure 5.
    RC is your relay coil represented as a resistor
    R1 is the resistor from the pic port, I know it is shown as connected to Vcc, but when your port goes high that is exactly what you have
    R2 is the "pulldown resistor, causing cutoff
    RE is the current limiting resistor for the load.
    Attached Images Attached Images  
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  12. #12
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default

    The problem are sure somewhere in the code ! The same code, how I say earlier, work if @SLEEP (and just this command !!!) is disabled !!!
    Like in the previous code, which work - for real !- just after adding little pause in different places, I think this code is good, but need...something, I don't know what ! I spend all my day trying different variant of code...with pause from 20 to 100, but useless...I don't lose my hope ! Cheers !

  13. #13
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default



    If it is a 78L05 ... then that's where your 3mA is going. (Quiescent Current)
    <br>
    DT

  14. #14
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default

    Hi Mr.Darrel !
    Maybe I can't explain verry clear !
    If @SLEEP command is 'enable', the repause current is 2.5 mA (like without PIC !). But, after couple of press of but1 or but2, but1 don't work more ! Need to disconnect power !
    If @SLEEP is 'disable' (by ' in front of her), the repause current is 3.5 mA, and but1 and but2 works without problems ! I do not change nothing in schematic !
    Just use @SLEEP (2.5 mA ; problems with but1) or not (3.5 mA ; not problems)
    Sorry for my poor english...

Similar Threads

  1. 12F683 vs 12F675.
    By sccoupe in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 11th July 2009, 05:58
  2. LANC code 12F675
    By MikeDD in forum General
    Replies: 4
    Last Post: - 9th May 2008, 06:44
  3. 12F675 cant serout to PC
    By ruijc in forum General
    Replies: 9
    Last Post: - 3rd December 2007, 01:11
  4. USART problems
    By egberttheone in forum mel PIC BASIC Pro
    Replies: 47
    Last Post: - 6th March 2005, 22:45
  5. Serial LCD on 12F675
    By anj in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 1st April 2004, 00:11

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

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