divide


Closed Thread
Results 1 to 7 of 7

Thread: divide

Hybrid View

  1. #1
    Join Date
    Jun 2006
    Location
    Bangalore, India
    Posts
    136


    Did you find this post helpful? Yes | No

    Default Re: divide

    Maybe you can do something like this . . .
    First, find out when x increments by 1, what is increment in frequency (call this the step size)
    Second, find out what is the frequency when x = 1 (call this the minimum frequency).
    Then to find actual frequency from x you can do some math like below:
    actual frequency = minimum frequency + (x * step size)
    Now you can print the actual frequency on the lcd using LCDOUT (assuming you are using a HD44780 based LCD display).

  2. #2
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default Re: divide

    Assuming:
    1) You can use LONG variables
    2) You are looking for the time of each period
    Code:
    Freq VAR LONG  ' Length of time for each period
    
    SELECT CASE x
       CASE = 1
          LCDOUT "001.000 Sec"
       CASE <=1000
          Freq = 1000000/ x
          LCDOUT DEC3 Freq/1000,".",DEC3 Freq," mSec"  
       CASE ELSE
          Freq = 1000000000/ x
          LCDOUT DEC3 Freq/1000,".",DEC3 Freq," uSec" 
    END SELECT

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