Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Forums > Electronic Projects Design/Ideas/Reviews


Electronic Projects Design/Ideas/Reviews Are you building an electronic project or want to? Maybe you need some assistance? Come and submit your electronic questions here and let our experienced members find a solution.

Reply
 
Thread Tools Display Modes
Old 8th May 2008, 06:38 PM   (permalink)
New Member
EDSON is on a distinguished road
Question Pulse Counter

I need to build a pulse counter with a PIC,employing TIMER0, with the following characteristics :

1) a square wave (0V - 4.7V) amplitude is applied to a unique pin of the PIC (say A4);

2) its frequency varies between 100Hz and 1kHz, (100,200,300,400,...900,1000);

3) the output is given in binary with leds (8 bits) and remains in the configuration during the application of the signal;

4) when the signal is switched off, the leds of the configuration become off;
EDSON is offline   Reply With Quote
Old 9th May 2008, 11:00 AM   (permalink)
Experienced Member
 
Blog Entries: 2
gramo is just really nicegramo is just really nicegramo is just really nicegramo is just really nice
Default

Do you need to employ TMR0? This can be easily done by incrementing registers


eg,
Code:
Repeat
Until PORT.Pin = 0

Repeat
Until PORT.Pin = 1

Repeat
   Inc(Result)
Until PORT.Pin = 0
and of course from there you can add a timeout with something like

Code:
Result = 0
Repeat
   Inc(Result)
Until PORT.Pin = 0 or Result = 0

Result = 0

Repeat
   Inc(Result)
Until PORT.Pin = 0 or Result = 1

Result = 0

Repeat
   Inc(Result)
Until PORT.Pin = 0 or Result = 0
From there you can figure out what the modifier required would be from the code overhead by simulating and scale the Result up to uS or mS as required to find the frequency of the signal
__________________
Spency.

PIC Micro's - Your mind is the limit

PIC's and interfacing with other devices - a PIC Basic Guide @ digital-diy.net
gramo is offline   Reply With Quote
Old 9th May 2008, 11:14 AM   (permalink)
Experienced Member
 
Blog Entries: 1
Gayan Soyza is a glorious beacon of lightGayan Soyza is a glorious beacon of lightGayan Soyza is a glorious beacon of lightGayan Soyza is a glorious beacon of lightGayan Soyza is a glorious beacon of light
Default

Ya 100 to 250 of course ok & when the pulse increase you need to do some multiplication routine (8bit mul) will be fine.Aaaah you are displaying it on 8 LEDs.

I use TMR0 as counter & feeding pulse to RA4 something like that & reads the TMR0 value on certain period of time & do all other calculations.

But for example if the frequency is 300Hz how do you show them from 8 LED's?
__________________
Gayan
Forum Supporter
Gayan Soyza is offline   Reply With Quote
Old 10th May 2008, 12:39 PM   (permalink)
New Member
EDSON is on a distinguished road
Default

Thanks Very Much For Your Reply.

Best Regards.

Edson
EDSON is offline   Reply With Quote
Old 11th May 2008, 02:02 PM   (permalink)
New Member
EDSON is on a distinguished road
Default

Thanks for your reply. I would appreciate if you could give-me the source code (in MikroC or CCS C) for a pulse counter with the TIMER0, counting frequencies from, say, 10Hz up to 200Hz, with ranges of 10Hz (10,20,30,.....200) with bynary outputs in 8 leds.
Best regards and thanks for cortesy.
EDSON
EDSON is offline   Reply With Quote
Old 11th May 2008, 03:18 PM   (permalink)
Experienced Member
 
Blog Entries: 4
blueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to behold
Send a message via Skype™ to blueroomelectronics
Default

Quote:
Originally Posted by EDSON
Thanks for your reply. I would appreciate if you could give-me the source code (in MikroC or CCS C) for a pulse counter with the TIMER0, counting frequencies from, say, 10Hz up to 200Hz, with ranges of 10Hz (10,20,30,.....200) with bynary outputs in 8 leds.
Best regards and thanks for cortesy.
EDSON
How much code have you written?
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is offline   Reply With Quote
Old 12th May 2008, 06:20 AM   (permalink)
Experienced Member
 
Blog Entries: 2
gramo is just really nicegramo is just really nicegramo is just really nicegramo is just really nice
Default

Quote:
Originally Posted by EDSON
Thanks for your reply. I would appreciate if you could give-me the source code (in MikroC or CCS C) for a pulse counter with the TIMER0, counting frequencies from, say, 10Hz up to 200Hz, with ranges of 10Hz (10,20,30,.....200) with bynary outputs in 8 leds.
Best regards and thanks for cortesy.
EDSON

I don't do C
__________________
Spency.

PIC Micro's - Your mind is the limit

PIC's and interfacing with other devices - a PIC Basic Guide @ digital-diy.net
gramo is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
Problem measuring pulse width - 12F683 TMR1, 8MHz jess Micro Controllers 18 5th February 2007 10:00 AM
How we can do it in Assembly..Help Needed Ayne Micro Controllers 37 29th December 2006 05:49 PM
measure pulse width with a counter...other ways?? xmat Electronic Projects Design/Ideas/Reviews 7 6th April 2005 08:05 AM
Pulse Width Calculation waqar Micro Controllers 1 25th June 2003 11:53 AM
using 8051 as pulse counter waqar Electronic Projects Design/Ideas/Reviews 0 13th March 2003 04:06 PM



All times are GMT. The time now is 05:57 PM.


Electronic Circuits  |  Radio Controlled
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.