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 CCS Technical Support

Timer 0 problem, please advice [solved]

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
maria100



Joined: 01 Feb 2012
Posts: 63

View user's profile Send private message

Timer 0 problem, please advice [solved]
PostPosted: Sat Apr 28, 2012 3:28 pm     Reply with quote

Hello, I'm running on a 18f14k50 a test program that gets the value from Timer0 and if the value is larger or equal to 1, print a test message via UART.
Code:

main()
{
setup_timer_0(RTCC_EXT_L_TO_H|RTCC_DIV_1);
set_timer0(0);
while(1)
{
if(get_timer0()>=1)
{
printf("PROBLEMS");
}
}
}

The problem is that I receive the "PROBLEMS" MSG even if nothing is tied to timer0 PIN that is set in external mode. I tried pullup with 10k and pulldown but no success. Please advise.
EDIT : I replaced the printf("problems"); with printing the value inside timer0 and indeed there are random values in it..how can i make him stop reading fake rising edges?
NOTE: if i touch the GND , pgd ,pgc , rx ,tx with my hand the bad pulses stops ! ideas?
PROBLEM SOLVED! A pulldown did the trick...i dont know what that did not work earlier..
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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