aamiralikhoja
Member level 5
to Pic masters
hello
I have strange problem regarding pic16f877A .I want To use Pic timer1 as
event Counter .Clock Is attached to T1CLK .and I want to count 8 clocks
and then toggle port B bit .Programm is well running in proteus .But at treal
hardware programm is not running . I am using css c compiler .
source code is as follow:
#int_TIMER1
TIMER1_isr() {
set_timer1(0xfff9);
output_bit(PIN_B0,1);
}
void main() {
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_CLOCK_DIV_2);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_counters(RTCC_INTERNAL,WDT_18MS);
setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1);
setup_timer_2(T2_DISABLED,0,1);
/************* PORT INIT *************/
Set_Tris_B(0x00);
Set_Tris_D(0xff);
enable_interrupts(INT_TIMER1);
enable_interrupts(global);
set_timer1(0xfff9);
do
{
output_bit(PIN_B0,0);
}while(1);
}
Please note that I have tested some simple programms except timer1 on same
hardware they are running quite well but timer1 is not running .Schematic of
hardware is attached.
hello
I have strange problem regarding pic16f877A .I want To use Pic timer1 as
event Counter .Clock Is attached to T1CLK .and I want to count 8 clocks
and then toggle port B bit .Programm is well running in proteus .But at treal
hardware programm is not running . I am using css c compiler .
source code is as follow:
#int_TIMER1
TIMER1_isr() {
set_timer1(0xfff9);
output_bit(PIN_B0,1);
}
void main() {
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_CLOCK_DIV_2);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_counters(RTCC_INTERNAL,WDT_18MS);
setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1);
setup_timer_2(T2_DISABLED,0,1);
/************* PORT INIT *************/
Set_Tris_B(0x00);
Set_Tris_D(0xff);
enable_interrupts(INT_TIMER1);
enable_interrupts(global);
set_timer1(0xfff9);
do
{
output_bit(PIN_B0,0);
}while(1);
}
Please note that I have tested some simple programms except timer1 on same
hardware they are running quite well but timer1 is not running .Schematic of
hardware is attached.