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
Printable View
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
Can you post your code and schematic?
About your other process... any of those use interrupts?
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
Are you positive it is not hung waiting on a serial input?
Don't know if it's a cut/paste problem or what...Code:define osc 20
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.
looool don't get my ( :rolleyes: ) 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
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
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
And dtmfout after the second serin command, to be sure to avoid loosing tx bytesCode: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
Al.
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 :)
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?
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
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 :cool:
also show me haw END program as you mention
How about the PORTA.3 problem Joe mentioned?
This will help
http://www.picbasic.co.uk/forum/showthread.php?t=561
last word in your program on the last line should be . . .
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.Code:<b><h2>END</h2></b>
Sorry about my English, I am American you know.:D
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.
dear dave :) my circuit works good and the problem was in bi-pass capacitors
these are some pictures of working
http://www.arb-up.com/files/arb-up-2008-6/JEj47195.jpg
regards
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 :o
well i may a dumb person but i wrote my code to be End less
therefor my last line is
did you notice that or.. or... you never saw the code in my first postCode:<b><h2>GOTO main</h2></b>
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