couldnt find the bug , interessant
davran
Posts: 12
i wanted to make a simple frequency generator. but at the first draft my software failed..
the code below fails between the lines 30-34. the loop causes the screen lost and pin0 gives a variable frequency.
does the code have any error or am i doing sth wrong?
thanks for the answers.
here is the full source :
Post Edited (davran elektronik) : 4/16/2008 8:23:07 PM GMT
the code below fails between the lines 30-34. the loop causes the screen lost and pin0 gives a variable frequency.
does the code have any error or am i doing sth wrong?
thanks for the answers.
here is the full source :
Post Edited (davran elektronik) : 4/16/2008 8:23:07 PM GMT
Comments
but what is wrong with "d"
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Give a lie twenty-four hours start, and it will take a hundred years to overtake it.
" (C.F. Dixon-Johnson, British author of the 1916 book, "The Armenians," appalled over the deceitful practices of his book's subject.)
www.tallarmeniantale.com/
Post Edited (davran) : 4/16/2008 8:59:01 PM GMT
Your loop assumes that the subscripts run from 1 to n, so the byte after p gets altered when you reference p[noparse][[/noparse] 10 ].
in your first version the loop starts with repeat (d-1) with d= 1 it means repeat 0
and this might be endlessly doing p[noparse][[/noparse]c] *= 10
what the hell should the second version do with repeat (d-1-d+2) ?????
third version starts with repeat 1
best regards
Stefan
in C,
int a[noparse][[/noparse]10]
declares space for *10* elements, indexed 0..9.
I couldn't let the "11 elements" comment confuse anyone and lead to more buffer overruns or whatnot.