下载
![](https://oss-datasheet.aipcba.com/html/409D859A5DA76C59060C428540653621/bg1.png)
Freescale Semiconductor
Application Note
Document Number: AN4841
Rev. 1.0, 3/2014
Contents
© Freescale Semiconductor, Inc., 2014. All rights reserved.
1 Introduction
This application note introduces the MC9S12ZVL32
device in ultrasonic sonar application, capable of
detecting an object as well as measuring the object
distance.
The MC9S12ZVL32 integrates a 16-bit microcontroller
built on proven S12 technology, an automotive voltage
regulator, a LIN interface, a VSUP module to sense
automotive battery voltage and an HVI pin.
The measured object distance is displayed in the
FreeMASTER tool. The on-board RGB LED color is
smoothly changed based on the actual object distance.
The application includes the RGB LED diagnostics as
well.
The AMMCLIB [6] functions are used for mathematical
operations.
Parts of this document is the AN4841SW.zip file
containing X-S12ZVL32-USLED hardware and
software files.
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 Ultrasonic based measurement overview . . . . . . . . . . . . 2
2.1 Ultrasonic sensing principle. . . . . . . . . . . . . . . . . . . 2
2.2 Required compensation. . . . . . . . . . . . . . . . . . . . . . 3
2.3 Transducer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3 Ultrasonic sensing application . . . . . . . . . . . . . . . . . . . . . 6
3.1 Scheduling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2 Burst generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.3 Echo receiver. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.4 Echo signal sampling and processing . . . . . . . . . . 11
3.5 Object distance calculation . . . . . . . . . . . . . . . . . . 11
3.6 RGB LED control and diagnostics. . . . . . . . . . . . . 12
3.7 LIN Slave node position detection . . . . . . . . . . . . . 13
4 MC9S12ZVL32 modules configuration . . . . . . . . . . . . . 14
4.1 Clock, Reset and Power Management Unit. . . . . . 14
4.2 Timer Module. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.3 Pulse Width Modulator . . . . . . . . . . . . . . . . . . . . . 15
4.4 Analog-to-Digital Converter . . . . . . . . . . . . . . . . . . 15
4.5 Port Integration Module . . . . . . . . . . . . . . . . . . . . . 16
4.6 Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5 Ultrasonic sensing application demo . . . . . . . . . . . . . . . 17
5.1 Hardware. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.2 Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
5.3 Demo set-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
7 Acronyms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Appendix AX-S12ZVL32-USLED board schematic . . . . . . . . 25
S12ZVL LIN Enabled Ultrasonic
Distance Measurement
Based on the MC9S12ZVL32 MagniV Device
by: Petr Cholasta