View previous topic :: View next topic |
Author |
Message |
Stygian
Joined: 26 Apr 2011 Posts: 13
|
problem with freq reading |
Posted: Thu Mar 29, 2012 4:52 am |
|
|
Hello All!
I made a tachometer and it works fine, but i want to use TIMER3 or 5 as a counter not the TIMER1, beacause TIMER1 already in use. The CCP setup function said "...In capture mode it will copy the timer 1 count value to CCP_x when the input pin event occurs..."
So I can only use the TIMER1 for capture??? Or is it possible with TIMER3?
In simulation both count, so i don't understand.
PIC: PIC18F48K22
My comp. ver.: 4.128
Thanks,
Stygian |
|
|
Stygian
Joined: 26 Apr 2011 Posts: 13
|
SOLVED |
Posted: Thu Mar 29, 2012 6:01 am |
|
|
I solved it. It was a simulation bug.
But is someone in the future want the same I write it down here.
For a pic18F46k22 the code is the following:
Code: |
#byte CCPTMRS0 = 0xF49
void main()
{
//User Code until CCPTMRSx
CCPTMRS0 = 0b00000001;
set_timer3(0);
setup_timer_3(T3_INTERNAL | T3_DIV_BY_1);
//User code from here...
}
|
Stygian _________________ Don't worry dear I can fix it. I'm totally sure the phase is the blue one. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Thu Mar 29, 2012 7:02 am |
|
|
ALWAYS tell us if this is REAL code in a REAL PIC or a stupid simulation !!!
Most of us do not want to waste our time trying to debug code that's 'running' on any simulator( none actually work correctly). |
|
|
Stygian
Joined: 26 Apr 2011 Posts: 13
|
|
Posted: Thu Mar 29, 2012 7:39 am |
|
|
Quote: | In simulation both count, so i don't understand. |
I tell it in the beginning, but sorry if it was mis-understandable.
Btw. Simulators are crap. For e.g. Now it can't handle two isr.
If I and my 128x64 pixel glcd CS2 won't init... _________________ Don't worry dear I can fix it. I'm totally sure the phase is the blue one. |
|
|
|