maria100
Joined: 01 Feb 2012 Posts: 63
|
Timer 0 problem, please advice [solved] |
Posted: Sat Apr 28, 2012 3:28 pm |
|
|
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.. |
|