leandroguida
Joined: 09 Dec 2008 Posts: 4
|
Question about get_timer1() ... |
Posted: Mon Dec 15, 2008 8:55 am |
|
|
Hi there.
See the following codes:
Code 1:
Code: |
set_timer1(0);
output_high(PIN_A0);
while(get_timer1()<250){
//wait
}
output_low(PIN_A0);
while(get_timer()<5000){
//wait again
}
|
Code 2:
Code: |
set_timer1(0);
output_high(PIN_A0);
while(get_timer1()<250){
//wait
}
output_low(PIN_A0);
delay_us(5000);
}
|
Code 2 works well (I'm seeing the output in a oscilloscope). Code 1 don't work at all.
In the second code the while(get_timer1()<250) works. In Code 1, both of them don't work.
I'm using a PIC16F877A (Timer1 - 16 bits), My system clock is 1MHz (4Mhz crystal), and my compiler is: PCWHD 4.057 |
|