![]() |
![]() |
![]() |
|
|
|||||||
| 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. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
New Member
|
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; |
|
|
|
|
|
(permalink) |
|
Experienced Member
|
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 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
__________________
Spency. PIC Micro's - Your mind is the limit PIC's and interfacing with other devices - a PIC Basic Guide @ digital-diy.net |
|
|
|
|
|
(permalink) |
|
Experienced Member
|
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 |
|
|
|
|
|
(permalink) |
|
New Member
|
Thanks Very Much For Your Reply.
Best Regards. Edson |
|
|
|
|
|
(permalink) |
|
New Member
|
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 |
|
|
|
|
|
(permalink) | |
|
Experienced Member
|
Quote:
|
|
|
|
|
|
|
(permalink) | |
|
Experienced Member
|
Quote:
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 |
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| 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 |