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

Can someone help with Fan Tacho... based on a 12f675

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








Can someone help with Fan Tacho... based on a 12f675
PostPosted: Thu Jun 07, 2007 2:53 pm     Reply with quote

Hello,

I have used a picaxe before to count the RPM of a fan if it goes below a certain rpm than to do something...

The way the program worked was to...


+ Count the input pulses from the tacho supplied by a PAPST FAN

+ Times this value by 60 (To get RPM) in a Word

+ If statement to say if above or below rpm threshold then do this

+ Above rpm threshold so do nothing, go back and check

+ Below rpm theshold so make an output HIGH go back and check

How do i write this in C? im sorry i am absolutely useless at C although i do know Basic if its a simple conversion... I do want to learn C as i know this is by far preferred and hopefully then ASM...

The 8 pin Pic the picaxe processor is based on is a 12f673 i believe.

I would like to base this version on the Pic12F675 due to excess stock of the pic 12f675, I also hope to use the existing pcb used for the picaxe version as i believe the power is the same and the outputs are the same is this correct?

Is this possible?

Kind Regards
Ttelmah
Guest







PostPosted: Thu Jun 07, 2007 3:14 pm     Reply with quote

The basic principle is possible, _but_ the resolution will be awful. The problem is that assuming the tacho output does give one pulse/rev (check this, many do give more), then if you time over an interval like one second, a fan at 1200RPM, will give just 20 pulses. It'll take a change of 60RPM, to give a change of just one pulse.
The normal solution to this is instead to 'work backwards'. If you count the pulses of the master clock/4 (using the timer1 module), and clear this on the first edge from the tacho, and then read the value on the next, at 1200RPM, with the internal oscillator at 4MHz, you get a count of 833. This changes to 834 with a speed change of just one RPM, and even better, the reading can be made in just 1/20th second at this rotational rate. The RPM is just 1000000/reading, but for a speed regulation application, you can just store, and look for a required 'count', rather than working with 'RPM'.

Best Wishes
Guest








Can someone help with Fan Tacho... based on a 12f675
PostPosted: Thu Jun 07, 2007 3:30 pm     Reply with quote

Hello,

That idea sounds absolutely wonderful, but how do i do that,

in basic i know id just count the input into a variable and go from there?

how do you do that in C, i have no problem with the circuit as its all been made etc... and i understand it fully and works with the picaxe basic program,

i just want to go over to CCS complier which is more like an interuperator rather than a token system, besides the bootloader on the picaxe chips is expensive. when your looking at buying several hundred also the interupt system is so much faster at processing stuff and allows me to do other things...

Is it possible to perhaps provide some ani-tated code please... or tell me what sort of layout i'd need. for example an infinite loop,

I am not here to steal code i want to learn how its written so i can write my own and know its mine.

I understand in writting a C program you should...
Include the pic header file
include the standard i/o header file
set the osc speed or tell it its an external one
declare your fuses

define the pins on the processor for ease of use

have a void main()
and end your program with the correct } etc..

I know how set an output high & low, Output_high (GP1), Output_low (GP1), delay_ms(1000) etc...

Its just the internals im struggling to pick up at the moment.

Thanks for your help and comments...

Kind Regards...
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 07, 2007 4:18 pm     Reply with quote

If you change the PIC to a 12F683, then you get a CCP module and
can easily do a Tachometer. There's code posted in the forum archives
for it.
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