View previous topic :: View next topic |
Author |
Message |
Guest
|
Help With Ex_freqc |
Posted: Mon Oct 02, 2006 8:53 am |
|
|
Hi guys
i used ex_freqc code on my pic as is portC.0 the input so the pin is damaged
so i modified the code to
Code: | #bit t1_overflow = 0x0C.2 |
but that dosen't work for all port from 0x0C.2 - 0x0C.7
i use 16f876A what is the solution !!!
Thanks , |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Oct 02, 2006 12:38 pm |
|
|
Code: | #bit t1_overflow=0x0C.0 |
That statement doesn't refer to a bit on Port C. It refers to the
interrupt flag for Timer1, in the PIR1 register. Don't change it.
Normally that statement would have been written like this:
Code: |
#byte PIR1 = 0x0C
#bit TMR1IF = PIR1.0
|
Then it's clear that it's a register bit in PIR1, and not just some variable.
CCS doesn't always do their examples in the clearest way for newbies.
The EX_FREQC.C program uses Timer1 in External Clock mode.
It's setup with this statement:
Code: | setup_timer_1(T1_EXTERNAL | T1_DIV_BY_1); |
Look in the 16F876A data sheet, at the pin diagram. Notice the label
on pin 11:
That pin is the clock input for Timer1 when it's used in External Clock
mode.
So if you blew out that pin, then you have to get a new PIC.
But, looking at the Timer1 block diagram in the data sheet, it shows
an alternate path, through pin C1 and then through an inverter.
(This is for the Timer1 oscillator). This path is enabled if you set
the T1OSCEN bit = 1. I don't know if this would work, but it might.
The signal would be inverted, so the Timer would clock on the opposite
edge, compared to using Pin C0.
My recommendation is just to get another PIC. |
|
|
Guest
|
|
Posted: Wed Oct 04, 2006 9:58 am |
|
|
thanks i replaced the pic the portc.0 and c.1 was damaged but i still had a problem i used LCD for the example and i put LCD routines but the LCD still blinking i used a simple delay after the printf statement as follow
Code: | printf(lcd_putc,"\f %LU",freq); //and print frequency
delay_ms(500); |
and the LCD still blinking i want it stable
what is the solution
Thanks |
|
|
Guest
|
|
Posted: Wed Oct 04, 2006 12:56 pm |
|
|
solved !
it was the lcd_init();
it was inside the loop by wrong
Greetings |
|
|
|