consultantuf.blogg.se

Lpc2148 library for proteus 8
Lpc2148 library for proteus 8












lpc2148 library for proteus 8 lpc2148 library for proteus 8

While(!(IO0PIN & ECHO)) //Wait for a HIGH on ECHO pin Printf(" LPC214x HC-SR04 Sensor Interfacing Tutorial\n") IO0DIR &= ~(ECHO) //Set P0.3(ECHO) as input (explicitly) IO0DIR |= TRIG //Set P0.2(TRIG) as output InitTimer0() //Init Timer for delay functions InitUART0() //Initialize UART0 for retargeted printf() InitClocks() //Set PCLK = CCLK = 60Mhz - used by: UART, Timer and ADC #include "lib_funcs.h" //OCFreaks LPC214x Tutorials Library Header *(C) Umang Gajera- Interfacing HC-SR04 Ultrasonic Distance/Ranging sensor with LPC2148 - Example Source Code for KEIL ARM. Note that we don’t need to translate 3.3V to 5V for TRIG pin since 3.3V is already a HIGH for TTL compatible input pins. But its better to use a voltage divider (using 2KΩ and 1KΩ resistors) to get input from ECHO pin for additional safety. We can directly interface this on any of the GPIO pin which has a 5V tolerant pad. The HC-SR04 Ultrasonic module operates on 5Volts and hence the output HIGH on ECHO pin is also 5V.

  • The pulse HIGH time is measured and then used to calculate the distance.
  • lpc2148 library for proteus 8

    It will then output a HIGH for the amount to time taken for the sound waves to reach back.After this the HC-SR04 Module will send a burst of 8 ultrasonic pulses at 40Khz.To start distance measurement a short pulse of 10us is applied to Trigger pin.Based on the time it takes for echo to arrive we can compute the distance, since we already know the speed of sound in air which is around 343 m/s or 1235 km/h (at 20☌).

    lpc2148 library for proteus 8

    It has got two transducers, one for transmitting ultrasound and second one for receiving the echo. Ultrasonic Distance/Ranging Sensors are based on similar working principle to what is used in SONAR. HCSR-04 uses 40Khz ultrasound to measure distance between itself and any object ahead of it with a sensing range of 2 centimeters to 4 meters. Ultrasound is a sound wave with frequency greater than the audible limit i.e. As the name suggests, the HC-SR04 Ultrasonic Distance/Ranging Sensor uses ultrasound to measure distance from a object ahead of the sensor. In this tutorial we will see how to interface an Ultrasonic distance sensor (HC-SR04) with ARM7 LPC2148 microcontroller.














    Lpc2148 library for proteus 8