Frequency meter with ECCP

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
User avatar
cubitus54
Flowcode v5 User
Posts: 110
Joined: Wed Jun 19, 2013 7:18 am
Has thanked: 7 times
Been thanked: 32 times

Frequency meter with ECCP

Post by cubitus54 »

Hello,

Does someone would have an example of frequency meter using ECCP.
I want to measure the frequency of a light sensor TSL235 (1KHz - 1MHz)

thank you
Flowcode V6.1.2.0(11 05 2015)

User avatar
cubitus54
Flowcode v5 User
Posts: 110
Joined: Wed Jun 19, 2013 7:18 am
Has thanked: 7 times
Been thanked: 32 times

Re: Frequency meter with ECCP

Post by cubitus54 »

Hello,

To test, I used a PIC 18F26K20
The frequency is given by a function generator.
To view the results, I send the program two words in SPI I view the oscilloscope.

My current problem is that the low word is good, for against the high word appears either 0 or 255

On the pictures you see, the frequency 56K (D2)
high value 0
low value 1E
Normally I should have 11E is 286 * 0.0625μs 17.8μs = 55.9 kHz

Why I can not get the high value?

thank you
Capteur lumiere.fcf
(13.21 KiB) Downloaded 363 times
MSO4014_20140429-174900.png
(21.04 KiB) Downloaded 2155 times
Flowcode V6.1.2.0(11 05 2015)

User avatar
cubitus54
Flowcode v5 User
Posts: 110
Joined: Wed Jun 19, 2013 7:18 am
Has thanked: 7 times
Been thanked: 32 times

Re: Frequency meter with ECCP

Post by cubitus54 »

I found

Code: Select all

FCV_PERIODEL=ccpr1l;
FCV_PERIODEH=ccpr1h;
FCV_ANCIENL=FCV_PERIODEL;
FCV_ANCIENH=FCV_PERIODEH;
FCV_PERIODE=((FCV_PERIODEH<<8)|FCV_PERIODEL)-FCV_ANCIEN;
FCV_ANCIEN=(FCV_ANCIENH<<8)|FCV_ANCIENL;
FCV_MAJ=1;
Flowcode V6.1.2.0(11 05 2015)

Post Reply