CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

16F648A UART problem
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
rodrigocirilo



Joined: 14 Sep 2016
Posts: 20

View user's profile Send private message

PostPosted: Tue May 26, 2020 12:23 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue May 26, 2020 12:42 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue May 26, 2020 3:47 pm     Reply with quote

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: 9134
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue May 26, 2020 5:03 pm     Reply with quote

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: 19260

View user's profile Send private message

PostPosted: Wed May 27, 2020 12:07 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed May 27, 2020 8:53 am     Reply with quote

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: 1903

View user's profile Send private message

PostPosted: Wed May 27, 2020 5:11 pm     Reply with quote

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.

Wink
Ttelmah



Joined: 11 Mar 2010
Posts: 19260

View user's profile Send private message

PostPosted: Sun May 31, 2020 2:46 am     Reply with quote

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. Sad
I call it "having a 'wall, head, impact technology testing', session"....
temtronic



Joined: 01 Jul 2010
Posts: 9134
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun May 31, 2020 5:25 am     Reply with quote

'just' 50 times ?? You got better eyes than me !! Laughing

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: 19260

View user's profile Send private message

PostPosted: Sun May 31, 2020 6:53 am     Reply with quote

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... Sad
rodrigocirilo



Joined: 14 Sep 2016
Posts: 20

View user's profile Send private message

PostPosted: Sun May 31, 2020 3:06 pm     Reply with quote

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... Sad


That's usually what happens, we look at the error, and we can't see it.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group