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 CCS Technical Support

PIC12F675 timer

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



Joined: 05 Dec 2018
Posts: 11

View user's profile Send private message

PIC12F675 timer
PostPosted: Mon Jan 14, 2019 6:49 am     Reply with quote

I'm a newbie with PIC. I need to simulate simple speedometer using PIC12F675. I have frequency generator, I know that I should use timer and interrupts, but can't understand how to make it work. (I use the standard 6000 impulses/km ). Can someone help me with code?
temtronic



Joined: 01 Jul 2010
Posts: 9232
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Jan 14, 2019 7:18 am     Reply with quote

You can use the 'search' button, light blue above ... and use 'speedometer' and you'll get several 'hits'.
You can also use Google to search for 'speedomter' or 'tachometer' code for CCS C PIC.
You'll probably have to 'do the math' to get the maximum count (highest speed) for the PIC's clock and timer. At 6,000 /km a 16bit timer could only count 6 km.

Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19529

View user's profile Send private message

PostPosted: Mon Jan 14, 2019 7:27 am     Reply with quote

Seriously I also have to ask what you actually want to 'do' with the value
obtained. The 675, is only an 8pin chip. With the supply pins, and a pulse
input to detect speed, you don't have many pins left to output a result....
bal_square



Joined: 05 Dec 2018
Posts: 11

View user's profile Send private message

PostPosted: Mon Jan 14, 2019 7:30 am     Reply with quote

Ttelmah wrote:
Seriously I also have to ask what you actually want to 'do' with the value
obtained. The 675, is only an 8pin chip. With the supply pins, and a pulse
input to detect speed, you don't have many pins left to output a result....

I can use serial register for outputing result.
Ttelmah



Joined: 11 Mar 2010
Posts: 19529

View user's profile Send private message

PostPosted: Mon Jan 14, 2019 8:51 am     Reply with quote

No.

The 675, does not have a UART. So only software serial. Doing this while
trying at the same time to do 'timing' based code, will be very hard.
If you want to do this get a PIC with a UART like the 12F1822 or 1840.
You are making things hard for yourself, trying to do this in a 12F675....

If you look at most of the speed examples, they will use the CCP to make the
measurement much easier. Again the 675 does not have a CCP.

The simplest way of generating speed with the least latency, is to measure
the time between two edges on the incoming signal. Speed is the
reciprocal of time, so can be updated with every incoming edge.
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