How do I convert an internal variable into frequency


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,627


    Did you find this post helpful? Yes | No

    Default

    Ioannis,
    Really, I think we are basicly saying the same thing here, however.... You wrote:
    Well the derivative is a number (no units associated with).
    I think this is where you are wrong. The derivative is the rate of change. But you cant just say that the rate of change is 7. You have to say 7 this per that otherwise it doensn't make sense IMO. For example 1.5V per second or 25degrees per hour or 15m/s per second etc.

    I found this on Wikipedia:
    In mathematics, a derivative is the rate of change of a quantity. A derivative is an instantaneous rate of change: it is calculated at a specific instant rather than as an average over time. The process of finding a derivative is called differentiation. The reverse process is integration. The two processes are the central concepts of calculus and the relationship between them is the fundamental theorem of calculus.
    Again, I believe we're meaning the same thing but without assigning units to the numbers they just doesn't make sense.

    /Henrik Olsson.

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,183


    Did you find this post helpful? Yes | No

    Default

    From what I remember the derivative is the tangent of the curve described by the function and shows the gradient of the tangent line. So a tangent cannot have units.

    This is how far I can go...!

    I understand what you are trying to say as a rate of change (like the slew rate of an op-amp). But on functions, a derivative I am sure is just a number, showing the direction of the curve at that point.

    Maybe a math guru is listening here to give a hand?

    Ioannis

    P.S. Since all the maths I learned was in greek language, maybe the terms I am using are not the proper ones, so.... I am sorry for that!

  3. #3
    Join Date
    Nov 2006
    Location
    Brooklyn,NY
    Posts
    32


    Did you find this post helpful? Yes | No

    Default How do I convert an internal variable into frequency

    The sensor connected to the A/D normally produces a constant , fixed output. The A/D output is therefore also fixed at this point in time. When a flow is present, the sensor produces a sin wave output whose frequency is dependant on the flow rate. The A/D output produces a series of varying numerical values if plotted against time would look like a sin wave. I have a program that will detect the numerical peak of each sin wave and I can count these peaks. Right now, I am using a timer (TMR0) with interrupts to generate the time base. This timer is activated when flow starts. The count /time will give me the frequency. The program will have a variable trip value i.e. when f >= trip then alarm. My program is almost operational with a few bugs remaining to be worked out.

    I have built this circuit using Op Amps etc., and now I would like to keep up with the times and reduce the number of components using a PIC.

    I wish to thank all those who have contributed and still might contribute to this thread.
    R.W.S.

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,183


    Did you find this post helpful? Yes | No

    Default

    Since your sensor produces a sine wave as a signal I would propose for the conversion part, to do the following:

    Drive a cheap 4046 PLL with the sensor signal. From the VCO control voltage drive a buffer op-amp (optional but suggested) and then the A/D of your PIC. Now you have a clean analog voltage that follows your flow converted to a digital.

    If you want to do the opposite, drive a voltage to the VCO of the 4046 and now you have a voltage to frequency converter (very linear I might say).

    Ioannis

  5. #5
    Join Date
    Nov 2006
    Location
    Brooklyn,NY
    Posts
    32


    Did you find this post helpful? Yes | No

    Default How do I convert an internal variable into frequency

    It was my error to mention dv/dt. Although I would like to measure this also, the frequency is what I am looking for.
    Thank you IOANNIS for your suggestions but my thrust right now is to try and do it all with the 16F877A.

    The program I have right now runs just fine when it is compiled and programmed under ICD. Using the real time compiler and programmer it doesn't work?????

    Any suggestions?

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,183


    Did you find this post helpful? Yes | No

    Default

    Hm, that's another story. What compiler, what code, what programmer, what...

    Please post everything you have to look at.

    Ioannis

  7. #7
    Join Date
    Nov 2006
    Location
    Brooklyn,NY
    Posts
    32


    Did you find this post helpful? Yes | No

    Default How do I convert an internal variable into frequency

    After playing with the program over the weekend I discovered two registers (intcon and option_reg) were incorrectly configured. The "Clock" generating ticks was not turning off . Steping through the program with the registers displayed the MCSP revealed the defect. Thank you IOANNIS for you offer to provide further assistance. I think I have a good start now with other obsticles yet to overcome.

Similar Threads

  1. EEPROM Variables (EE_Vars.pbp)
    By Darrel Taylor in forum Code Examples
    Replies: 79
    Last Post: - 26th October 2012, 00:06
  2. internal TMR for frequency output
    By Samoele in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th January 2009, 09:38
  3. Read/write variable into PIC internal eeprom
    By Pic2008 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 13th August 2008, 07:06
  4. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  5. Convert a word variable to decimal
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 4th December 2004, 20:02

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts