armondo522 Guest
|
Need help generating frequencies |
Posted: Wed Feb 04, 2009 6:08 pm |
|
|
HI,
I am using a 24HJ128GP306 PIC. I want to generate frequencies between 100 hz and 1.6khz. I am using the output compare function, but the only freq I get is either very low or 58 hz, regardless of what variables I change. Is there something I am missing ?
Here is the snippet of code I am using:
Code: |
setup_timer2( TMR_INTERNAL|tmr_div_by_8);
set_compare_time(1, 50000);
setup_compare(1, compare_toggel | COMPARE_TIMER2);
do
{
output_toggle(pin_b4);
delay_ms(250);
}while(1); |
The only thing that changes the frequency is the tmr div by.
Is there a problem with me or the 16/24 bit compiler ?
Thanks in advance |
|