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

How can I use the CCS to see the speed of a wheel

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



Joined: 31 Dec 2019
Posts: 1

View user's profile Send private message AIM Address

How can I use the CCS to see the speed of a wheel
PostPosted: Sun Feb 16, 2020 9:06 am     Reply with quote

Hi guys, I'm working on a project, and I'm currently having some doubts.

I wanted a quick code of how can I use my hall effect speed sensor to show the RPM on my interface that I'm working on (It will send by rs232).

But I can't find any program that uses a hall effect speed sensor with a PIC, using the CCS.

I'm using a pic18f46k80 with a 64MHz internal crystal.
Ttelmah



Joined: 11 Mar 2010
Posts: 19492

View user's profile Send private message

PostPosted: Sun Feb 16, 2020 9:40 am     Reply with quote

You are being too specific in your search. Look at ex_capture.c
This shows how to capture the period of a signal using the CCP.

Now 'think about it'. Period = 1/frequency.
Speed is frequency*wheel circumference.

So measure the period between pulses, and after just one rotation of the
wheel, you can calculate 'speed'.
temtronic



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

View user's profile Send private message

PostPosted: Sun Feb 16, 2020 2:24 pm     Reply with quote

Search keyword could be 'tachometer'. The actual 'speed sensor' can be ANY device that produces zero to 5 volt transitions for 'there, not there'. Hall effect implies a rotating magnet but code for a reed switch would work. Even the PIC code, tweaked', for the original PC mouse might work.
You'll have to 'tweak' any program though, based upon what you expect the RPM to be and desired resolution. 10.0025 RPM and 134,000.1 RPM are obviously quite different but both are valid speeds.

There are 98 matches to 'tachometer' in the search of this forum....
Ttelmah



Joined: 11 Mar 2010
Posts: 19492

View user's profile Send private message

PostPosted: Mon Feb 17, 2020 12:27 am     Reply with quote

The only issue is that a wheel gives a very low frequency, so he
needs to work by using 'period', rather than just counting pulses.
If counting pulses the resolution will be awful, and response very
slow. A lot of the tacho examples use pulses rather than period,
since they are using much faster signals.
gjs_rsdi



Joined: 06 Feb 2006
Posts: 468
Location: Bali

View user's profile Send private message Send e-mail

PostPosted: Wed Feb 19, 2020 11:34 pm     Reply with quote

Hi Ttelmah

I didn't find the ex_capture.c in PICC Examples.
How I can get it?

Best wishes
Joe
Ttelmah



Joined: 11 Mar 2010
Posts: 19492

View user's profile Send private message

PostPosted: Thu Feb 20, 2020 12:19 am     Reply with quote

Apologies. I think ex_capture is only for the DsPIC's.
Look at this thread:

<http://www.ccsinfo.com/forum/viewtopic.php?p=78590>

PCM_programmer posts an example measuring period, and then
displaying this as frequency. Then simply multiply this by wheel
circumference to get speed.
You'll have to adjust the factor used in the frequency calculation
for your clock rate.
gjs_rsdi



Joined: 06 Feb 2006
Posts: 468
Location: Bali

View user's profile Send private message Send e-mail

PostPosted: Thu Feb 20, 2020 4:22 pm     Reply with quote

Thank you for the link Ttelmah.

Best wishes
Joe
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