Ultrasonic sensor, serial communication.


Closed Thread
Results 1 to 3 of 3

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: Ultrasonic sensor, serial communication.

    Try something like:
    Code:
    Distance VAR WORD
    Sum VAR BYTE
    
    Start:
      HSERIN 1000, NoData, [wait ($FF), Distance.BYTE1, Distance.BYTE0, SUM]
      ' Here you could evalute SUM to verify packet is correct but lets not do that now.  
       HSEROUT["Distance: ", DEC Distance, "mm", 13]
    Goto Start
    
    
    NoData:
      HSEROUT["No data from sensor", 13]
      Goto Start
    /Henrik.

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: Ultrasonic sensor, serial communication.

    Thanks Henrik,

    It works.

    How simple and elegant solution.

Similar Threads

  1. Need help setting up my ultrasonic distance sensor
    By Megahertz in forum mel PIC BASIC Pro
    Replies: 18
    Last Post: - 26th June 2010, 15:06
  2. Ultrasonic distance sensor with PIC16F84A
    By MrRoboto in forum mel PIC BASIC
    Replies: 3
    Last Post: - 29th June 2009, 10:01
  3. Water Level Detection using Ultrasonic Sensor
    By Balachandar in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th November 2007, 05:59
  4. sensor ultrasonic 8051&PIC
    By hd_uni_pro in forum Schematics
    Replies: 1
    Last Post: - 13th September 2006, 13:58
  5. ultrasonic sensor
    By PoTeToJB in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 9th May 2006, 21:26

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