Component: Ultrasonic (Sensors: EBM Modules)

From Flowcode Help
Jump to navigationJump to search


Author Matrix TSL
Version 1.0 (Release)
Category Sensors: EBM Modules


Image Ultrasonic component

This board has both an ultrasonic transmitter and receiver. The transmitter is driven by an on-board 40KHz oscillator which is enabled by the host microprocessor. The receiving sensor signal is amplified and provided as an analogue signal to be processed by a single channel ADC of the microprocessor. By measuring the time delay between enabling a transmit pulse and receiving an echo the distance of objects in a range of around 3cm to 3m can be determined.

Examples

Sample program using the EBM019 - Ultrasonic sensor.

Sends out a pulse and determines distance from time taken to receive reflection. FC6 Icon.png EBM019 Example

Downloadable macro reference

GetDistance

Sends a pulse and processes the echo.

Returns a object distance in cm

Parameters

This macro has no parameters


Return value

UINT


SetDelayTime

Set the delay time before sampling for the echo, in microseconds

Parameters

UINT delay
delay time in microseconds


Return value

This call does not return a value


SetDetectionValue

Set the delta value for echo detection

Parameters

BYTE value
trigger point for echo detection


Return value

This call does not return a value


SetPulseWidth

Set the output pulse width, in microsecond (0-255uS)

Parameters

BYTE pulse
width of pulse in microseconds


Return value

This call does not return a value


Initialise

Setup the device.

This sets the control output to logic 0

Parameters

This macro has no parameters


Return value

This call does not return a value


Simulation macro reference

This component does not contain any simulation macros


Property reference

Output Pulse Pin

This property is of type Single digital pin and can be referenced with the variable name OPP.

Pin used for controlling the output pulse

Echo ADC channel

This property is of type Single analog pin and can be referenced with the variable name ECHO.

ADC channel used to monitor the echo

Pulse Width (uS)

This property is of type Unsigned integer and can be referenced with the variable name PULSE.

Output ultrasonic pulse width in microseconds

Read Delay (uS)

This property is of type Unsigned integer and can be referenced with the variable name DELAY.

Time delay in microseconds before sampling for echo

Pulse Detection Value

This property is of type Unsigned integer and can be referenced with the variable name THRESHOLD.

Detection ADC delta trigger value

A lower value is more sensitive