In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Matthias09 wrote: Hi Zoot, here is the classical program. It shows the same results like the new one, but without the jumps to smaller values. Best, Matthias [code] DEVICE SX28, OSCHS3, TURBO, STACKX, OPTIONX FREQ 50_000_000 LED1 PIN RC.2 OUTPUT LED2 PIN RC.3 OUTPUT LED3 PIN RC.4 OUTPUT LED4 PIN RC.5 OUTPUT IsOn CON 1 IsOff CON 0 Yes CON 1 No CON 0 US_Green PIN RC.7 'green labeled Ultrasonic sensor RawToMm CON 22572 ' 1mm / 2.9034us. see docu Green CON 1 'for green labeled Ultrasound sensor Black CON 0 'for black labeled Ultrasound sensor FirstRun VAR BIT whereisit var word '===========# STARTUP #====================================================================================================== PROGRAM Start GET_BALL_POSITION FUNC 2, 0 Start: DO whereisit = GET_BALL_POSITION watch whereisit, 16, sdec \ BREAK LOOP END '-------------# GET_BALL_POSITION #------------------------------------------------------------------------------------------ FUNC GET_BALL_POSITION US_Green = 0 PULSOUT US_Green, 5 PAUSEUS 10 PULSIN US_Green, 1, rawdata PAUSE 10 RETURN rawdata ENDFUNC [/code] ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=394074#m401269 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)