Sonic Depth Meter code & Math problems 12F683


Results 1 to 14 of 14

Threaded View

  1. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,140


    Did you find this post helpful? Yes | No

    Default Re: Sonic Depth Meter code & Math problems 12F683

    I 'd use what Henrik has posted and maybe with a smaller multiplier, say 3000. Keep your ten average pile. Then Henrik's lines will give you directly the result for your digital pot.

    Code:
    'Main Program  ****************************
    
    'get avg depth
        pause 1000
        for x = 1 to 10
            pulsin gpio.4,1,inputpulse
            dist= dist + inputpulse
            pause 100
        next x
        
        newtapsetting = (dist ** 3060) - 42       'try also a number smaller, 3000
        IF newtapsetting > 127 THEN newtapsetting = 127
    
    serout gpio.0,t9600,[12,"avg :", #avgdist,13]
    serout gpio.0,t9600,["tap :", #newtapsetting]
    
    pause 500
    
    end
    Ioannis
    Last edited by Ioannis; - 29th October 2013 at 18:04.

Similar Threads

  1. Replies: 0
    Last Post: - 27th March 2011, 20:10
  2. PIC 12f683 AD/PWM Problems:
    By surfer0815 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th December 2005, 16:48
  3. math problems (again)
    By lab310 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 28th November 2005, 22:43
  4. 12F683 Comparator Problems
    By morethanenuf in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 9th September 2005, 15:36
  5. math problems - large numbers
    By Tomasm in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 16th February 2004, 07:48

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