|
|
View previous topic :: View next topic |
Author |
Message |
shahzadali
Joined: 06 Feb 2011 Posts: 1
|
50MHz Frequency Counter using PIC16F877A |
Posted: Sun Feb 06, 2011 6:03 am |
|
|
Hi Guys!
I want to make a frequency counter which would be able to read the frequency of input digital wave up to 50MHz using PIC 16F877A. But I have faced the problem of programming language; i did all the coding in mikroC v8.2.0.0 and then simulate the circuit in Proteus - ISIS 7 Professional. The results were encouraging so I went to lab for the practical implementation. Unfortunately, the same code and hardware configuration did not work. There was no output on the LCD instead of the glowing dot matrices whereas the microcontroller was alive as indicated by the status LED.
Some of my colleagues are saying that it is due to the code which is written in microC and they are also suggesting me to rewrite the code in CCS PCWH from which I am unfamiliar (here, can you help?). You can get my complete project from the link given below (it includes mikroC code, hex, circuit schema):
http://www.ziddu.com/download/13697032/50MHz_frq_count.zip.html
Waiting for your kind response… |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Sun Feb 06, 2011 6:33 am |
|
|
I suggest you start small and convert 'sections' of code.
Program the PIC to blink an LED, then send data to the LCD.Keep backups of all your programs !
Look at the examples that CCS provides and study them, compare similar functions with microC, they are not that different
Get familiar with the CCS C, the mor eyou code the better and faster your progress will be.
Since you already are familiar with one verison of C it shouldn't be that difficult to 'port' or 'convert' to CCS C.
It's probably not with the time and effort for you to create a translation program unless you have several microC programs to convert.
As for the LCD not working, be sure to have the contrast set asbout .5 volts.Proteus is NOT the real world and doesn't care about correct wiring !! |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Sun Feb 06, 2011 9:34 am |
|
|
Also, keep in mind the CCP units of the PIC's have an upper count limit based on freq... but you can always prescale.
I advised a couple students building a freq meter that worked with 10GHz. (big time prescaler)
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19510
|
|
Posted: Sun Feb 06, 2011 3:33 pm |
|
|
The obvious reason for getting nothing on the display, is that there is no crystal shown, so the CPU is not going to run. The 16F87x family chips don't offer an internal clock, so nothing is going to happen....
As a comment, bkamen, is right, this is not going to give 50MHz operation. With some of the faster PIC18 chips, 'possibly', but on the 16F877, the _minimum_ pulse timing for the CCP inputs, is 3Tcy+40 nSec. At the maximum clock rate (20Mhz), this gives operation to 5.263Mhz, _not_ 50MHz...
In the CCS examples, ex_FREQC.c, generates a frequency counter, outputting to the serial. Simply add the FLEX_LCD driver, and send the output to this instead of the serial, and 'code complete'. I'd rate it as doable in a (short) tea break....
Best Wishes |
|
|
miro
Joined: 15 Jan 2011 Posts: 62
|
|
Posted: Sun Feb 06, 2011 4:34 pm |
|
|
Hi, the 50MHz (and maybe more) frequency meter is easy to build with any 16F part by using internal prescaler. There is an old trick how to read the prescaler - you are "clocking" in the internal prescaler via toggling its input from other pin, and do count until e.g. T0 increments by 1. Just google it. Miro. |
|
|
|
|
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
|