1. Infrared photoelectric transmitting and receiving tube
2. Voltage comparator
3. IO port of HCS12
4. ATD module of HCS12
5. ECT module of HCS12
Principle:
1. Infrared transmitting tube transmits infrared signal, and when it encounters an obstruction, it will be reflected back. If it is partially black, it will not be transmitted back (black can absorb light, and infrared rays are absorbed when they encounter black obstructions). When the receiving tube receives the reflected infrared rays, the resistance at both ends of it changes, so that different voltage values can be output, and finally the path is identified according to these voltage values.
2. The voltage comparator can convert continuous quantity into switch quantity. When it is greater than the set threshold, it outputs a high level, and when it is less than the set threshold, it outputs a low level.
3. ADC can convert analog quantity into digital quantity that can be recognized by the computer, but it can process these digital signals by itself and identify the path information.
Solution:
1. Discrete path recognition algorithm.
The voltage signal output by the infrared receiving tube is compared by the voltage comparator, and a switch quantity is output. The IO of HCS12 reads the switch quantity output by the voltage comparator. Install several photoelectric tubes in a row and read the information at the same time. When a 0 value is input to the IO port connected to the transmitting tube, it is judged that the black track is under the photoelectric receiving tube. The offset angle between the black track and the car can be calculated through a certain algorithm.
Advantages: simple and easy.
Disadvantages:
2. Continuous path recognition algorithm.
The voltage signal output by the infrared receiving tube is converted by AD to a digital voltage signal. By processing these digital lights, road information that is approximately continuous can be obtained.
Advantages: The path information is continuous and the path information is more accurate.
Disadvantages:
Solution selection: Because it is the first time to use the path recognition algorithm, in order to ensure the car can drive stably, a discrete path recognition algorithm that is easier to implement is selected.
Description:
1. There are 16 photoelectric receiving tubes, which are arranged in a row at a distance of Hmm from the front wheel to detect road information at the same time. The distance between each photoelectric tube is 15mm.
2. The 16 photoelectric tubes are connected to the PORTB port and PORTE port of HCS12 respectively.
3. The detection time interval is 10MS.
4. The variable iRoutPlace stores the path information.
5. The array iPLace stores the path position.
6. The array iplaceAngle stores the direction angle.
7. Position information data:
8. The relationship between position and offset angle
is calculated by C program. The program is as follows:
#include
#include
void main()
{
int i;
long double h,n;
n=0.0;
h=500.0;
for(i=0;i<16;i++)
{
}
}
Running results:
Position-radian angle-angle
0--0.000000--0.000000
1--0.029991--1.719230
2--0.059928--3.435372
3--0.089758--5.145373
4--0.119429--6.846244
5--0.148890--8.535093
6--0.178093--10.209149
7--0.206992--11.865795
8--0.235545--13.502579
9--0.2637 12--15.117239
10--0.291457--16.707714
11--0.318748--18.272153
12--0.345556--19.808919
13--0.371856--21.316590
14--0.397628--22.793961
15--0.422854--24.240034
The above table can be approximated that the angle increases by 1° for each offset.
9. Angle information:
iplaceAngle[]={-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,5,5,6,7,8,9,10,11,12,13}
CODE:
#include
#include
#pragma LINK_INFO DERIVATIVE "mc9s12xs128"
//============================================================//
//Phototube discrete path recognition algorithm
//PORTB and PORTE are connected to the output of the voltage comparator
//16-bit modulus down counter for counting
//author: Yangtze
//time:2009/4/19/15:15:45
//============================================================//
#define iSampling 10//Path sampling time setting
int iRoutPlace;
int Angle;
int iPLace[28]={0x7fff,0x3fff,0xbfff,0x9fff,0xdfff,0xcfff,0xefff,
int iplaceAngle[]={-13,-12,-11,-10,-9,-8,
void Init_MDC(void)
{
}
void pllclk(void) //16MHz
{
}
void IO_Init()
{
}
void main(void)
{
}
#pragma CODE_SEG __NEAR_SEG NON_BANKED
void interrupt 26 MDC_ISR(void)
{
}
Previous article:Freescale's PWM output controls the direction of the servo motor
Next article:Freescale's ECT method for detecting speed
Recommended ReadingLatest update time:2024-11-16 17:29
- Popular Resources
- Popular amplifiers
- Practical Development of Automotive FlexRay Bus System (Written by Wu Baoxin, Guo Yonghong, Cao Yi, Zhao Dongyang, etc.)
- Automotive Electronics KEA Series Microcontrollers——Based on ARM Cortex-M0+ Core
- Automotive integrated circuits and their applications
- Discrete Mathematics Foundations, Algorithms, and Programming
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [2022 Digi-Key Innovation Design Competition] 1. STM32F7508-DK Unboxing
- Some predictions about the national competition questions - about power supply questions
- RFID low frequency and high frequency antenna technology
- First look at Texas Instruments' C2000 series
- What is UWB and why is it in my phone? Ultra-wideband technology, explained
- Can the TF card that comes with SensorTile.box be used?
- EEWORLD University ---- 3D TOF Robot: Obstacle Detection, Collision Avoidance and Navigation
- 【Aigtek Instrument Peripherals】Do you know how to use a dotting machine?
- PADS----ECO problem, as shown in the picture, what is the cause? Please tell me if you know, thank you
- Microwave Solid-State Circuit Design (Second Edition)