Você está na página 1de 31

Ultrasonic principle

Ultrasonic sensors have set new standards in automation

Ultrasonic principle:
Ultrasonic sensors emit short, high-frequency sound pulses at regular intervals.
These propagate in the air at the velocity of sound. If they strike an object, then
they are reflected back as echo signals to the sensor, which itself computes the
distance to the target based on the time-span between emitting the signal and
receiving the echo.

Ultrasonic principle

As the distance to an object is determined by measuring the time of flight and

not by the intensity of the sound, ultrasonic sensors are excellent at suppressing

background interference.
Virtually all materials which reflect sound can be detected, regardless of their

colour. Even transparent materials or thin foils represent no problem for an

ultrasonic sensor.

microsonic ultrasonic sensors are suitable for target distances from 20 mm to 10


m and as they measure the time of flight they can ascertain a measurement with
pinpoint accuracy. Some of our sensors can even resolve the signal to an
accuracy of 0.025 mm.

Ultrasonic sensors can see through dust-laden air and ink mists. Even thin
deposits on the sensor membrane do not impair its function.

Sensors with a blind zone of only 20 mm and an extremely thin beam spread are
making entirely new applications possible today: Fill level measurement in wells
of microtiter plates and test tubes, as well as the detection of small bottles in
the packaging industry, can be implemented with ease. Even thin wires are
reliably detected.

Reflection- This actually any alteration in the orientation of a light ray as it


travels from one channel to the other

8051 Microcontroller Pin


Diagram and Its Working
Procedure
A microcontroller is a small computer on a single IC that integrates all the features that
are found in the microprocessor. In order to serve different applications, it has a high
concentration of on chip facilities such as RAM, ROM, I/O ports, timers, serial port,
clock circuit and interrupts. Microcontrollers are used in various automatically controlled
devices such as remote controls, automobile engine control systems, medical devices,
power tools, office machines, toys, and other embedded systems. Therefore, this
article gives an overview of the pin diagram of 8051 microcontroller with explanation
and also 8051 based project ideas.

8051 Microcontroller

In case of microprocessor, we have to interface additional circuitry externally, such as


RAM, ROM, I/O ports, timers, serial port, clock circuit, and other external peripherals,
whereas in the microcontroller, all these peripherals are in built. Let us look in brief
about the pin diagram of the 8051 microcontroller.

Microcontroller Pins Working


8051 microcontrollers have four I/O ports where in each port contains 8 pins that can be
configured as inputs or outputs. The Pin configuration whether it to be configured as
an I/P (1) or an O/P (0), depends on its logic state. In order to configure a
microcontroller pin as an output, it is necessary to apply a logic zero (0) to the suitable
I/O port bits. In this case, the voltage level at the appropriate pin will be 0.

Similarly, in order to configure a microcontroller pin as an input, it is necessary to apply


a logic one (1) to the suitable port. In this case, the voltage level on the appropriate pin
will be 5V. This may seem confusing, It all becomes clear after studying simple
electronic circuits connected to an I/O pin.
Input/Output (I/O) Pin

The below figure shows a simplified schematic of all circuits within the microcontroller,
which is connected to one of its pins. It states to all the pins except those of the P0 port
that do not have pull-up resistors built-in.

Input/Output (I/O) Pin

Output pin

A logic 0 is applied to a bit of the register P, then the output FE transistor is turned on,
therefore connects the appropriate pin to ground.

Output pin
Input pin

A logic 1 is applied to a bit of the P register. The output field effect transistor is turned
off, and the appropriate pin remains connected to the power supply voltage, over a pull-
up resistor of high resistance.

Input Pin

Pin Diagram of 8051 Microcontroller


8051 microcontroller families (89C51, 8751, DS89C4xO, 89C52) come in different
packages like quad-flat package, leadless chip carrier and dual-in-line package. These
all packages consist of 40 pins which are dedicated to several functions such as I/O,
address, RD, WR, data and interrupts. But, some companies offer a 20-pin version of
the microcontrollers for less demanding applications by reducing the number of I/O
ports. Nevertheless, a vast majority of developers use the 40-pin chip.
Pin Diagram of 8051
Microcontroller

The pin diagram of 8051 microcontroller consists of 40 pins as shown below. A total of
32 pins are set away into four Ports such as P0, P1, P2 and P3. Where, each port
contains 8 pins. Therefore, the microcontroller 8051s pin diagram and explanation is
given below.

Port1 (Pin1 to Pin8): Port1 includes pin1.0 to pin1.7 and these pins can be
configured as input or output pins.
Pin 9 (RST): Reset pin is used to Reset 8051 Microcontroller by giving a
positive pulse to this Pin.
Port3 (Pin 10 to 17): The Port3 Pins are similar to port1 pins and can be
used as universal Input or output pins. These pins dual-function Pins and the
function of each Pin is given as:
Pin 10 (RXD): RXD pin is a Serial Asynchronous Communication Input
or Serial synchronous Communication Output.
Pin 11 (TXD): Serial Asynchronous Communication Output or Serial
Synchronous Communication clock Output.
Pin 12 (INT0): Input of Interrupt 0
Pin 13 (INT1): Input of Interrupt 1
Pin 14 (T0): Input of Counter 0 clock
Pin 15 (T1): Input of Counter 1 clock
Pin 16 (WR): Writing Signal to write content on external RAM.
Pin 17 (RD): Reading Signal to read contents of external RAM.
Pin 18 and 19 (XTAL2, XTAL1): X2 and X1 pins are input output pins for
the oscillator. These pins are used to connect an internal oscillator to the
microcontroller.
Pin 20 (GND): Pin 20 is a ground pin.
Port2 (Pin 21 to Pin28): Port2 includes pin21 to pin28 which can be
configured as Input Output Pins. But, this is only possible when we dont use any
external memory. If we use external memory, then these pins will work as high
order address bus (A8 to A15).
Pin 29 (PSEN): This pin is used to enable external program memory. If we
use an external ROM for storing the program, then logic 0 appears on it, which
indicates Micro controller to read data from the memory.
Pin 30 (ALE): Address Latch Enable pin is an active high-output signal. If we
use multiple memory chips, then this pin is used to distinguish between them.
This Pin also gives program pulse input during programming of EPROM.
Pin 31 (EA): If we have to use multiple memories then the application of
logic 1 to this pin instructs the Microcontroller to read data from both memories:
first internal and then external.
Port 0 (Pin 32 to 39): Similar to the port 2 and 3 pins, these pins can be
used as input output pins when we dont use any external memory. When ALE or
Pin 30 is at 1, then this port is used as data bus: when the ALE pin is at 0, then
this port is used as a lower order address bus (A0 to A7)
Pin40 (VCC): This VCC pin is used for power supply.

Ports in 8051 microcontroller


Ports in 8051 microcontroller
ports in 8051 microcontroller we should know it has four ports. Those are port0, port1,
port2 and por3.
Port 0
Port-0 can be used as a normal bidirectional I/O port or it can be used for address/data
interfacing for accessing external memory. When control is 1, the port is used for
address/data interfacing. When the control is 0, the port can be used as a bidirectional
I/O port.
PORT 0 as an Input Port
Let us assume that control is 0. When the port is used as an input port, 1 is written to
the latch. In this situation both the output MOSFETs are off. Hence the output pin have
floats hence whatever data written on pin is directly read by read pin.
PORT 0 as an Output Port
Suppose we want to write 1 on pin of Port 0, a 1 written to the latch which turns off the
lower FET while due to 0 control signal upper FET also turns off as shown in fig. above.
Here we wants logic 1 on pin but we getting floating value so to convert that floating
value into logic 1 we need to connect the pull up resistor parallel to upper FET . This is
the reason why we needed to connect pull up resistor to port 0 when
we want to initialize port 0 as an output port .
If we want to write 0 on pin of port 0 , when 0 is written to the latch, the pin is pulled
down by the lower FET. Hence the output becomes zero.
When the control is 1, address/data bus controls the output driver FETs. If the
address/data bus (internal) is 0, the upper FET is off and the lower FET is on. The
output becomes 0. If the address/data bus is 1, the upper FET is on and the lower
FET is off. Hence the output is 1. Hence for normal address/data interfacing (for
external memory access) no pull-up resistors are required.Port-0 latch is written to with
1s when used for external memory access.
PORT 1
Port-1 dedicated only for I/O interfacing. When used as output port, not needed to
connect additional pull-up resistor like port 0. It have provided internally pull-up resistor
as shown in fig. below. The pin is pulled up or down through internal pull-up when we
want to initialize as an output port. To use port-1 as input port, 1 has to be written to the
latch. In this input mode when 1 is written to the pin by the external device then it read
fine. But when 0 is written to the pin by the external device then the external source
must sink current due to internal pull-up. If the external device is not able to sink the
current the pin voltage may rise, leading to a possible wrong reading.

PORT 2:
Port-2 we use for higher external address byte or a normal input/output port. The I/O
operation is similar to Port-1. Port-2 latch remains stable when Port-2 pin are used for
external memory access.
Here again due to internal pull-up there is limited current driving capability.
PORT 3:
Following are the alternate functions of port 3:
P3.0RXD
P3.1 TXD
P3.2 INT0 BAR
P3.3 INT1 BAR
P3.4 T0
P3.5 T1
P3.6 WR BAR
P3.7 RD BAR
It works as an IO port same like Port 2 as well as it can do lots
of alternate work which are discuss above. Only alternate function of port 3
makes its architecture different than other ports.
BLOCK FUNCTIONS
LCD:A liquid-crystal display (LCD) is a flat-panel display or other electronically modulated
optical device that uses the light-modulating properties of liquid crystals. Liquid crystals do
not emit light directly, instead using a backlight or reflector to produce images in color
or monochrome.[1] LCDs are available to display arbitrary images (as in a general-purpose
computer display) or fixed images with low information content, which can be displayed or
hidden, such as preset words, digits, and 7-segment displays, as in a digital clock. They use
the same basic technology, except that arbitrary images are made up of a large number of
small pixels, while other displays have larger elements.

MICROCONTROLLER:
A highly integrated single chip computer or a cpu with all the peripherals like RAM, ROM, I/O ports,
timers, ADCs etc on the same chip. For ex: Motorolas 6811, intels 8051, zilogs z8 and pic 16X etc

FUNCTION GENERATOR:
A function generator produces different waveforms of adjustable
frequency. The common outputwaveforms are the sine, square,
triangular and saw tooth waves. The frequency may be adjusted,
from a fraction of a Hertz to several hundred kHz lie various
outputs of the generator can bemade available at the same time.
For example, the generator can provide a square wave to testthe
linearity of a rectifier and simultaneously provide a saw tooth to
drive the horizontal
deflection amplifier of the CRO to provide a visual display.

Capability of Phase Lock the function generator can be phase


locked to an external source. One function generator can be
used to lock a second function generator, and the two output
signals can be displaced in phase by adjustable amount. In
addition, the fundamental frequency of one generator can be
phase locked to a harmonic of another generator, by adjusting the
amplitude and phase of the harmonic; almost any waveform can
be generated by addition.
The function generator can also be phase locked to a frequency
standard and its output waveforms will then have the same
accuracy and stability as the standard source.
The block diagram of a function generator:
The block diagram of a function generator is illustrated in fig.
Usually the frequency is controlled by
varying the capacitor in the LC or RC circuit. In the instrument the
frequency is controlled by
varying the magnitude of current which drives the integrator. The
instrument produces sine,
triangular and square waves with a frequency range of 0.01 Hz to
100 kHz.
The frequency controlled voltage regulates two current sources.
The upper current source
supplies constant current to the integrator whose output voltage
increases linearly with time,
according to the equation of the output signal voltage. An increase
or decrease in the current
increases or decreases the slope of the output voltage and hence
controls the frequency. The

voltage comparator multi-vibrator changes states at a pre-


determined maximum level of the integrator output voltage. This
change cuts off the upper current supply and switches on
the lower current supply. The lower current source supplies a
reverse current to the integrator, so
that its output decreases linearly with time. When the output
reaches a pre-determined minimum level, the voltage comparator
again changes state and switches on the Lower current source.
The
output of the integrator is a triangular waveform whose frequency
is determined by the magnitude of the current supplied by the
constant current sources. The comparator output delivers a
square wave voltage of the same frequency.
e = - 1/C idt
e=-

The resistance diode network alters the slope of the triangular


wave as its amplitude changes and
produces a sine wave with less than 1% distortion.

Amplifier Gain
The introduction to the amplifier gain can be said to be the relationship that exists between the
signal measured at the output with the signal measured at the input. There are three different
kinds of amplifier gain which can be measured and these are: Voltage Gain ( Av ), Current
Gain ( Ai ) and Power Gain ( Ap ) depending upon the quantity being measured with examples
of these different types of gains are given below.
Amplifier Gain of the Input Signal

Voltage Amplifier Gain

Current Amplifier Gain

Power Amplifier Gain

Note that for the Power Gain you can also divide the power obtained at the output with the power
obtained at the input. Also when calculating the gain of an amplifier, the subscripts v, i and p are
used to denote the type of signal gain being used.
The power Gain or power level of the amplifier can also be expressed in Decibels, (dB). The Bel
(B) is a logarithmic unit (base 10) of measurement that has no units. Since the Bel is too large a
unit of measure, it is prefixed with deci making it Decibels instead with one decibel being one
tenth (1/10th) of a Bel. To calculate the gain of the amplifier in Decibels or dB, we can use the
following expressions.
Voltage Gain in dB: av = 20 log Av
Current Gain in dB: ai = 20 log Ai
Power Gain in dB: ap = 10 log Ap
Note that the DC power gain of an amplifier is equal to ten times the common log of the output
to input ratio, where as voltage and current gains are 20 times the common log of the ratio. Note
however, that 20dB is not twice as much power as 10dB because of the log scale.
Also, a positive value of dB represents a Gain and a negative value of dB represents
a Loss within the amplifier. For example, an amplifier gain of +3dB indicates that the amplifiers
output signal has doubled, (x2) while an amplifier gain of -3dB indicates that the signal has
halved, (x0.5) or in other words a loss.
The -3dB point of an amplifier is called the half-power point which is -3dB down from
maximum, taking 0dB as the maximum output value.

Comparator
In electronics, a comparator is a device that compares two voltages or currents and outputs a digital
signal indicating which is larger. It has two analog input terminals v+ and v- and one binary digital
output Vo. The output is ideally
A comparator consists of a specialized high-gain differential amplifier. They are commonly used
in devices that measure and digitize analog signals, such as analog-to-digital converters(ADCs),
as well as relaxation oscillators.
Target:-The object whose distance is to be measured in the atmosphere is termed as target. In addition,
objects that absorb sound or have a soft or irregular surface, such as a stuffed animal, may not reflect
enough sound to be detected accurately. The sensor will detect the surface of water, however it is not
rated for outdoor use or continual use in a wet environment. Condensation on its transducers may affect
performance and lifespan of the device.

Basic Keil Tutorial


1. Open Keil from the Start menu
2. The Figure below shows the basic names of the windows referred in this document

3. Select New Vision Project from the Project Menu.


4. Name the project Toggle
5. Click on the Save Button.

6. The device window will be displayed.


7. Select the part you will be using to test with. For now we will use the Dallas Semiconductor part
DS89C450.
8. Double Click on the Dallas Semiconductor.

9.Scroll down and select the DS89C450 Part


10.Click OK
11.Choose No.

Creating Source File


1. Click File Menu and select New.
2. A new window will open up in the Keil IDE.

3. Copy the example to the Right into the new window. This file will
toggle Ports 1 and 2 with a delay.
ORG 0H
MOV A, #55H
AGAIN:
MOV P1, A
MOV P2, A
ACALL DELAY
CPL A
SJMP AGAIN
DELAY:
MOV R3, #200
OUTER: MOV R2, #0255
INNER: DJNZ R2, INNER
DJNZ R3, OUTER
RET
END

4. Click on File menu and select Save


As

5. Name the file Toggle.a51


6. Click the Save Button
4. Change file type to Asm Source File (*.a; *.src).
5. Select toggle.a51
6. Click Add button
7. Click Close button.
8. Expand the Source Group 1 in the
Tree menu to ensure that the file
was added to the project
Creating HEX for the Part
1. Click on Target 1 in Tree menu
2. Click on Project Menu and select
Options for Target 1
3. Select Target Tab
4. Change Xtal (Mhz) from 33.0 to
11.0592
5. Select Output Tab
6. Click on Create Hex File check box
7. Click OK Button
8. Click on Project Menu and select
Rebuild all Target Files
9. In the Build Window it should report
0 Errors (s), 0 Warnings
10. You are now ready to Program your
Part
Testing Program in Debugger
1. Comment out line ACALL DELAY by placing a Semicolon at the beginning. This will
allow you to see the port change immediately.
2. Click on the File Menu and select Save

3. Click on Project Menu and select Rebuild all Target Files


4. In the Build Window it should report 0 Errors (s), 0 Warnings
5. Click on Debug Menu and Select Start/Stop Debug Session.
6. If you use a free version of Keil the dialog appears. Click OK.

Running the Keil Debugger


1. The Keil Debugger should be now Running.
2. Click on Peripherals. Select I/O Ports, Select Port 1.
2. A new window should port will pop up. This represent the Port and Pins

4. Step through the code by pressing F11 on the Keyboard. The Parallel Port 1 Box should change as
you completely step through the code.

5. To exit out, Click on Debug Menu and Select Start/Stop Debug Session

Você também pode gostar