Frequency detection

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
ib.bp
Posts: 5
Joined: Mon Jan 31, 2011 10:06 am
Has thanked: 1 time
Contact:

Frequency detection

Post by ib.bp »

Hi,
short time since I use Flowcode 4 PIC. My experience with Flowcode are still modest.
Now I have the following problem. It must be identified two frequencies 100Hz and 120Hz. Can anyone give tips how to make it the best?
Maybe someone has a suitable flow diagram or know where one can find an example on the web.
Thanks
Peter

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Frequency detection

Post by Benj »

Hello Peter,

In the Flowcode v4 examples download there is a frequency counter program that will display the frequency of a square wave onto a LCD. You may be able to use this as a starting point for your program.

Examples can be downloaded from here.
http://www.matrixmultimedia.com/Downloa ... .php?id=63

The file is in "Examples/Interrupts/5. Digital frequency counter.fcf"

Hope this helps.

ib.bp
Posts: 5
Joined: Mon Jan 31, 2011 10:06 am
Has thanked: 1 time
Contact:

Re: Frequency detection

Post by ib.bp »

Hello Benj,
thanks for the tip. There is still a small problem.

We also have E-blocks and the software works well but the simulation under Flowcode is not running. The display shows nothing at all. Pushing the virtual key has no effect. A screenshot is shown below. What we do not right?

Could you recommend a book or other sources for absolute beginners? The book "Microcontroller Systems Engineering" by Bert van Dam, we have already, but the examples are not explained well. Perhaps you know materials in German.
Thanks
Peter
Attachments
Digital frequency counter.JPG
(228.79 KiB) Downloaded 1164 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Frequency detection

Post by Benj »

Hello Peter,

Glad the program is working well for you on the E-blocks. Unfortunatley the Flowcode simulation is not great at doing things like interrupts and this could be the reason the LCD is not displaying any data when you simulate.

As for books and learning material we have a getting started course available from here.
http://www.matrixmultimedia.com/lc_microcontroller.php

I was going to write a comprehensive book but Elektor turned down my offer and suggested I wrote something more along the lines of Berts book which I was not really interested in doing. Maybe I will have another go at this later on in the year.

ib.bp
Posts: 5
Joined: Mon Jan 31, 2011 10:06 am
Has thanked: 1 time
Contact:

Re: Frequency detection

Post by ib.bp »

Hello Ben,
thank you for all the info. It is commendable that you will write a comprehensive book. Would it be possible to send you a "standard" e-mail ? My email address is p-p-p@gmx.net.
We want to build a circuit that can detect the frequencies below 105Hz and above 115 Hz. There are 2 LEDs as LED1 and LED2. While F<105Hz LED1 lights, at F>115 Hz LED2 lights. Could you make a flow chart for us? Alone we can not do it.
Regards
Peter

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Frequency detection

Post by Benj »

Hello Peter,

Here is a program that should do what you require. The outputs will only change state every second at the moment. If you need to change this so that the LEDs update quicker then every second then let me know how frequent you need them to change. Also if im going to do this then if you could let me know what crystal frequency you are using and which chip.

At the moment the frequency input is on pin A0 and the LED outputs are on B0 and B1 of a 16F88 running on a 19.6608MHz crystal.

I try to make all support via the forums but if there is something of a sensitive nature then you can always use the forum to PM me.
Attachments
freqmeasure.fcf
(8.5 KiB) Downloaded 353 times

ib.bp
Posts: 5
Joined: Mon Jan 31, 2011 10:06 am
Has thanked: 1 time
Contact:

Re: Frequency detection

Post by ib.bp »

Hello Ben,
thanks for the info. Could you explain the flow chart? Please describe the procedure that is shown by the flow chart. In particular, how interrupt function and timer function is used for the frequency counting.
As a beginner, I have problems when there is no detailed description. Good books are not available. In German there are no books at all. Courses are very rare and in cities far away from me. On 4 February you mentioned you intend to write a comprehensive book. Even if your book is not finished yet and only one part of it exists, then I have a question. Could you then sell the document (*. doc, *. pdf) me?
Regards
Peter

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Frequency detection

Post by Benj »

Hello Peter,

As far as the book went I got as far as the contents to submit for review. I still plan to write the contents of the book over the next year or so but I made the mistake of buying a house that was essentially a shell and now that is stealing a lot of my spare time.

Regarding the program there counter in the main called freq that is incremented everytime the input voltage goes from low to high. In the background there is a timer interrupt which is counting the number of times the interrupt has happened. After 75 interrupts exactly 1 second ha spassed so we collect the pulse count variable and store into the display_freq variable before displaying the frequency on the LEDs and resetting the count variable.

Post Reply