View previous topic :: View next topic |
Author |
Message |
rodrigocirilo
Joined: 14 Sep 2016 Posts: 20
|
|
Posted: Tue May 26, 2020 12:23 pm |
|
|
Look, I didn't quite understand the fact that changing the position of the variable declaration will affect something. I'll try.
In relation to being creative, I can use what little I know, I can save to eeprom, and start recovering the correct value when the software randomly changes its value. I go to eeprom and look for the correct value.
I just wanted to know if this could be a compiler problem that I am not able to solve. If so, I will try to be creative to solve the variable issue by changing its value without any explanation. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue May 26, 2020 12:42 pm |
|
|
You have vs. 5.015. That is an early version. My additional advice is to
debug it with Pickit3. Setup a Watch window for flag_emergencia and step
through your code. Or set breakpoints at the start of important sections
and look at the Watch Window to see if flag_emergencia changed.
Try to find the section of code that is causing the problem. |
|
|
rodrigocirilo
Joined: 14 Sep 2016 Posts: 20
|
|
Posted: Tue May 26, 2020 3:47 pm |
|
|
I noticed that the flag_emergencia variable changes from 0 to 1 the moment I press the second digit of the password.
Let's say I'm going to enter password 1234, so when I press 1 it stays normal, when I press 2 it already gets the value 1.
I can't understand where this is coming from, because that's not where I change it, it's somewhere else. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9341 Location: Greensville,Ontario
|
|
Posted: Tue May 26, 2020 5:03 pm |
|
|
You should post your current program. with all the changes you've made, perhaps we can see what's wrong.
Jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19634
|
|
Posted: Wed May 27, 2020 12:07 am |
|
|
It's going to be set to 1, every about 2.5 seconds by the timer. How
much time is passing?.
Your timer will interrupt every (4000000)/(65536*4*8) = 1.9*/second.
You have a count counting to 5, then the flag gets set. The count is
incremented before the test, so 2.63 seconds after the start, the flag is set.
Then every 2.63 seconds after this.
The only pattern that resets the counter is the OKK one. For everything
else it keeps running.
You have a remark '40' against the timer trigger. 40 what?. If it is meant to
be 'seconds', then you need to recalculate. If it needs to be 40 seconds
the count would need to go to 76.... |
|
|
rodrigocirilo
Joined: 14 Sep 2016 Posts: 20
|
|
Posted: Wed May 27, 2020 8:53 am |
|
|
I must apologize to everyone for my lack of attention.
Yesterday I had found the Timer problem counting approximately 2.5 seconds, to set the variable with problem to 1. My problem was there, I set the counter to 5 to test and after the test it should have returned to the value of 40 .
Noble colleague Ttelmah was also able to see this.
I apologize again to the noble gentlemen who here have taken their valuable time to help me, since the problem was created by myself, in a grotesque lack of attention. |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1912
|
|
Posted: Wed May 27, 2020 5:11 pm |
|
|
rodrigocirilo wrote: | ...the problem was created by myself, in a grotesque lack of attention. |
That's how most of my problems arise. Love the way you phrased it though.
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19634
|
|
Posted: Sun May 31, 2020 2:46 am |
|
|
Don't get me wrong, but _everybody_ here will have suffered
from major problems that are 100% 'their own fault'. Anyone who
claims otherwise is lying!...
99% of coding problems are something you have typed wrong, or
done wrong. I spent ages the other day tracking down a problem,
which turned out to be a one character typing fault, which I must have
looked at fifty times, and still did not spot.
I call it "having a 'wall, head, impact technology testing', session".... |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9341 Location: Greensville,Ontario
|
|
Posted: Sun May 31, 2020 5:25 am |
|
|
'just' 50 times ?? You got better eyes than me !!
Try being old(er) [67], need to WEAR trifocals typing, getting dyslesic and missing feeling in ring finger..... I spend 80+% of my coding time retyping....
It gets more 'fun' the older you get.....
Jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19634
|
|
Posted: Sun May 31, 2020 6:53 am |
|
|
Thing was I was looking at all the rest of the code nearby as well.
Total several hours. It was the exact 'wrong' character that I looked
at and kept accepting... |
|
|
rodrigocirilo
Joined: 14 Sep 2016 Posts: 20
|
|
Posted: Sun May 31, 2020 3:06 pm |
|
|
Ttelmah wrote: | Thing was I was looking at all the rest of the code nearby as well.
Total several hours. It was the exact 'wrong' character that I looked
at and kept accepting... |
That's usually what happens, we look at the error, and we can't see it. |
|
|
|