CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

problem with freq reading

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Stygian



Joined: 26 Apr 2011
Posts: 13

View user's profile Send private message

problem with freq reading
PostPosted: Thu Mar 29, 2012 4:52 am     Reply with quote

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

View user's profile Send private message

SOLVED
PostPosted: Thu Mar 29, 2012 6:01 am     Reply with quote

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: 9205
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Mar 29, 2012 7:02 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Mar 29, 2012 7:39 am     Reply with quote

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
Code:
#int_timer1
and
Code:
#int_ccp1
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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group