process hung problem + self reset


Closed Thread
Results 1 to 27 of 27
  1. #1
    Join Date
    Aug 2008
    Posts
    20

    Default process hung problem + self reset

    hello am using pic16f819

    my problem is i use DTMFOUT function inside (for) loop this causes some times process hung after almost 9 or 10 min working time
    is there any why to make pic self reset if it hung



    regards

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


    Did you find this post helpful? Yes | No

    Default

    Can you post your code and schematic?

    About your other process... any of those use interrupts?
    Steve

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

  3. #3
    Join Date
    Aug 2008
    Posts
    20


    Did you find this post helpful? Yes | No

    Default

    hello no (interrupts)
    this is my code
    no schematic release yet still prototypal
    but u can figer it out from code

    pin b.0 is serail in
    pin a.3 is audio out

    Code:
     define osc 20
       Include "modedefs.bas"
     
     TRISA = %00000000
      gdata var byte[21]
    
      x var byte 
      ok var bit
     main:
     x = 0
     
        gps:
            if ok == 0 then 
      serin2 portb.0 , 188 ,[wait("GPS") , str gdata\20]
             toggle portb.1
         dtmfout porta.3 ,100 ,100,[ 10 , 0 , 10 ]
                 
                 
         for x = 0 to 20
                       pause 10
                     if  gdata[x] = "." then
                        gdata[x] = 12
                        endif
                          dtmfout porta.3 ,100,100,[ gdata[x]  ]  
                           
      next x  
        ok = 1
        endif
      
       serin2 portb.0 , 188 ,[wait("SD") , str gdata\4]
       ok = 0
            toggle portb.2
         dtmfout porta.3 ,100,100,[ 10 , 1 , 10 ]
                 pause 1
               
         for x = 0 to 4
                         pause 10
                     if  gdata[x] = "." then
                        gdata[x] = 12
                        endif
                        dtmfout porta.3 ,100,100,[ gdata[x]  ]  
                           
      next x      
      pause 50           
     goto main
    Last edited by eng.alamin; - 28th October 2008 at 22:45.

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Are you positive it is not hung waiting on a serial input?
    Dave
    Always wear safety glasses while programming.

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Code:
     define osc 20
    Don't know if it's a cut/paste problem or what...
    Read the manual and what it specifically says about DEFINE's... And ENDing a program (or STOPping it)

    As far as an 'automatic reset', look in the datasheet under WATCHDOG.

  6. #6
    Join Date
    Aug 2008
    Posts
    20


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    Are you positive it is not hung waiting on a serial input?
    i am positive
    hung appear on audio (tone become wierd) and leds stop toggling

  7. #7
    Join Date
    Aug 2008
    Posts
    20


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Code:
     define osc 20
    Don't know if it's a cut/paste problem or what...
    Read the manual and what it specifically says about DEFINE's... And ENDing a program (or STOPping it)



    As far as an 'automatic reset', look in the datasheet under WATCHDOG.

  8. #8
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by eng.alamin View Post
    Ok, but that so-called code you posted has 3 definitive problems in it.
    You get to figure them out now...Okzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

  9. #9
    Join Date
    Aug 2008
    Posts
    20


    Did you find this post helpful? Yes | No

    Default

    looool don't get my ( ) in wrong way bro
    what i ment was (your suggestion will be consider) nothing more
    i can't be rude to any one try to help me
    thank any way WDT work fine with me the problem is not in " defines "
    sorry for mistake

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by eng.alamin View Post
    looool don't get my ( ) in wrong way bro
    what i ment was (your suggestion will be consider) nothing more
    i can't be rude to any one try to help me
    thank any way WDT work fine with me the problem is not in " defines "
    sorry for mistake
    Then go back and look at post 5, Skimask is as subtle as a nuke, he is telling you a lot there.
    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.

  11. #11
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    Skimask is as subtle as a nuke
    Wait until you see me in my 'Officer Jim Dangle' costume this weekend...

  12. #12
    Join Date
    Aug 2008
    Posts
    20


    Did you find this post helpful? Yes | No

    Wink

    Quote Originally Posted by Joe S. View Post
    Then go back and look at post 5, Skimask is as subtle as a nuke, he is telling you a lot there.
    thank you joe for attention
    anyway just to make something clear

    normaly i use programmer software to set all (define) like HS , MCLR_OFF , LVP ...etc

    and other thing (define) erorr may not let pic work stable or work at all

    and my circuit hung after 10 min of good execution time (it looped fine for 10 min)

    when i used WDT it work fine .

    you know the problem of pic basic pro is most of functions work at background
    so you will be far from (hardware imagination execution) to track erorrs like this one

  13. #13
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Very likely the problem is the time taken to dtmfout between the two serin command. If the for/next loop takes just longer than allowed you miss tx bytes and your system is out of syncronism. (Remember you have a wait comand)

    Remove

    Code:
    dtmfout porta.3 ,100 ,100,[ 10 , 0 , 10 ]
                 
                 
         for x = 0 to 20
                       pause 10
                     if  gdata[x] = "." then
                        gdata[x] = 12
                        endif
                          dtmfout porta.3 ,100,100,[ gdata[x]  ]  
                           
      next x
    And dtmfout after the second serin command, to be sure to avoid loosing tx bytes

    Al.
    Last edited by aratti; - 29th October 2008 at 14:35.

  14. #14
    Join Date
    Aug 2008
    Posts
    20


    Did you find this post helpful? Yes | No

    Default

    my serial data source is repeat it self continuously
    when the first package arrive the the buffer will be load
    and then first (FOR) loop will execute meen while there is serail data looses

    after first (FOR LOOP)

    the second serial in command will wait for other Sync WORD "SD"
    because serial source repeat all data packages continuously (if because of loop
    i miss the first appearing of "SD" at the end i'll catch it no matter what )

    it works gooood

    all data transmit ok and tone appear OK for 9 to 10 min of operation and the two FOR LOOP update continuously

    --------------------------------------------------------
    the hung is apear on tone sound

    normaly DTMFOUT sounds apear like this

    [toot -- teet -- tut -- tat -- tet - toot --tiit - toot ----> for 10 minuets ]

    and then it become sounds like this after 10 min

    [teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeet] -------> till reset
    Last edited by eng.alamin; - 30th October 2008 at 11:00.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Code:
     define osc 20
    Don't know if it's a cut/paste problem or what...
    Read the manual and what it specifically says about DEFINE's... And ENDing a program (or STOPping it)

    As far as an 'automatic reset', look in the datasheet under WATCHDOG.
    I don't want t o be pushy, <b>but </b>did you fix these things? Which is to say, Did you put your DEFINES IN UPPERCASE? Did you put END at your programs END?
    Quote Originally Posted by skimask View Post
    Wait until you see me in my 'Officer Jim Dangle' costume this weekend...
    I think I would rather not WOO that would be Scary
    Last edited by Archangel; - 30th October 2008 at 17:50.
    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.

  16. #16
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I am wondering if it is not a power supply problem. After a few minutes the the PS starts to fail/drop voltage.

    Is the speaker direct connect to the PIC?
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    Step1.Fix the problems you know about first then hunt for more.
    <br>
    So how about disabling the analog stuff, ADCON, CCP . . . since you are using PortA.3
    Last edited by Archangel; - 31st October 2008 at 00:48.
    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.

  18. #18
    Join Date
    Aug 2008
    Posts
    20


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    I am wondering if it is not a power supply problem. After a few minutes the the PS starts to fail/drop voltage.

    Is the speaker direct connect to the PIC?
    no idon't think it's PS failing problem

    speaker connected though CAP

  19. #19
    Join Date
    Aug 2008
    Posts
    20


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    Fix the problems you know about first
    well idon't know what is ( definitive ) the problem he umbrella the all issue in weird way ( chick datasheet and chick manual and all this stuff )

    if you see any error need to fix . please give me some guidance with few code lines
    also show me haw END program as you mention

  20. #20
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    How about the PORTA.3 problem Joe mentioned?
    This will help
    http://www.picbasic.co.uk/forum/showthread.php?t=561
    Dave
    Always wear safety glasses while programming.

  21. #21
    Join Date
    Aug 2008
    Posts
    20


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    How about the PORTA.3 problem Joe mentioned?
    This will help
    http://www.picbasic.co.uk/forum/showthread.php?t=561
    thanks dave i'll work on that and tell you what is outcome

    regards

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by eng.alamin View Post
    well idon't know what is ( definitive ) the problem he umbrella the all issue in weird way ( chick datasheet and chick manual and all this stuff )

    if you see any error need to fix . please give me some guidance with few code lines
    also show me haw END program as you mention
    last word in your program on the last line should be . . .
    Code:
    <b><h2>END</h2></b>
    this I believe is a compiler directive, tells the compiler to end your code there. There is at least one exception to this rule, but not here and not now.
    Sorry about my English, I am American you know.
    Last edited by Archangel; - 31st October 2008 at 00:49.
    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.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    How about the PORTA.3 problem Joe mentioned?
    This will help
    http://www.picbasic.co.uk/forum/showthread.php?t=561
    Go into the data sheet, I know it's painful, but go in there anyway . . . Look to see what state port A initializes in when it is reset, you will probably discover it defaults to <b>Analog</b> operation, since you want Digital, <b> YOU </b> need to tell it<b><font color=red> how to be digital.</font color></b> Lots of registers to set, If you want simple then use old grandpaw chip like 16F84, or 16F628A, only CMCON to worry about. If you want lots of bells and whistles then you have to learn how to play them.
    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.

  24. #24
    Join Date
    Aug 2008
    Posts
    20


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    How about the PORTA.3 problem Joe mentioned?
    This will help
    http://www.picbasic.co.uk/forum/showthread.php?t=561
    dear dave my circuit works good and the problem was in bi-pass capacitors
    these are some pictures of working




    regards
    Attached Images Attached Images   
    Last edited by eng.alamin; - 31st October 2008 at 10:15.

  25. #25
    Join Date
    Aug 2008
    Posts
    20


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post

    ---------------------------------------------------
    Sorry about my English, I am American you know.
    i didn't said any thing about your English or about you generally
    but ...anyway that is advantage you must take it in good way to be usefull
    for ppl like me

    Quote Originally Posted by Joe S. View Post
    Code:
    <b><h2>END</h2></b>
    this I believe is a compiler directive, tells the compiler to end your code there. There is at least one exception to this rule, but not here and not now.
    well i may a dumb person but i wrote my code to be End less
    therefor my last line is
    Code:
    <b><h2>GOTO main</h2></b>
    did you notice that or.. or... you never saw the code in my first post

  26. #26
    Join Date
    Aug 2008
    Posts
    20


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    If you want simple then use old grandpaw chip like 16F84, or 16F628A, only CMCON to worry about. If you want lots of bells and whistles then you have to learn how to play them.
    well i have all those pic's you wrote
    but i don't want this circuit to work in my lab only
    it will work in rough and dirty environment so there is other things must be worried about so the design have more dimension than you imagine
    Quote Originally Posted by Joe S. View Post
    Location: La La Land, where errant code runs by
    although am not from there but i bet you i worte more code lines than you
    wither on asm , C18 , C32 , css , pic basic pro

    take this advice
    work more ....
    and stop been futile person
    Last edited by eng.alamin; - 31st October 2008 at 11:02.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by eng.alamin View Post
    well i have all those pic's you wrote
    but i don't want this circuit to work in my lab only
    it will work in rough and dirty environment so there is other things must be worried about so the design have more dimension than you imagine

    although am not from there but i bet you i worte more code lines than you
    wither on asm , C18 , C32 , css , pic basic pro

    take this advice
    work more ....
    and stop been futile person
    Yep, I will bet you have too, I didn't know this was a competition, I thought I was trying to help you. My apologies, it won't happen again.
    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.

Similar Threads

  1. Pic reset and following lock up problem
    By zerosvarka in forum General
    Replies: 19
    Last Post: - 17th June 2009, 20:03
  2. LCD Reset Problem
    By Bill Legge in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 24th February 2009, 08:55
  3. USART Problem , but don't know where, in pc? or in PIC?
    By precision in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th July 2007, 08:12
  4. Reset problem
    By leonel in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 2nd May 2006, 06:46
  5. PIC problem, ways to do reset
    By lab310 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th May 2005, 14:31

Members who have read this thread : 1

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