File - Param World!

Download Report

Transcript File - Param World!

SUMMER TRAINING JULY 2012

EMBEDDED SYSTEM (Microcontroller)

Submitted by: CHANDRAMOHAN SINGH AMARJEET KUMAR ABHISHEK KUMAR Btech-ECE(5 th sem)

CTIT

• The embedded system is a combination of computer hardware, software additional electrical & mechanical parts • A computer is used in such devices primarily as a means to simplify the system design and to provide flexibility. • Embedded systems employ the use of a RTOS (Real-Time Operating System).

Block Diagram of Embedded System

Microcontroller

• A smaller computer.

• On-chip RAM, ROM, I/O ports...

• Example:- Motorola’s 6811, Intel’s 8051 and PIC 16X CPU RAM ROM I/O Port Timer Serial COM Port Microcontroller A single chip

The 8051 Microcontroller

: • The 8051 is the first microcontroller of the MCS-51 family introduced by Intel Corporation at the end of the 1970’s.

• The 8051 family characteristics: ○ ○ ○ ○ ○ ○ ○ The 8051 family characteristics: 4K Bytes ROM 128 Bytes RAM two timer/counters (16 bit) A serial port 32 input/output port Interrupt controller

8051 Internal Architecture

IC 8051 Pin Description

Voltage Supply (+5V) Ground

IC 8051 Pin Description

Port 0 from Pin-39 to Pin-32 An 8-bit open drain bidirectional port.

DUAL FUNCTION

Used to access both data and address

IC 8051 Pin Description

Port 1 from Pin-1 to pin-8 8-bit bidirectional I/O port with internal pull-ups

IC 8051 Pin Description

Port 2 from Pin-21 to pin-28 Used to access address and I/O

IC 8051 Pin Description

P3.0 : RxD(serial input port) P3.1 :TxD (serial output port) P3.2 :INT0 (external interrupt 0) P3.3 :INT1 (external interrupt 1) P3.4 :T0 (timer 0 external input) P3.5 :T1 (timer 1 external input) P3.6 :WR (external data memory write strobe) P3.7 :RD (external data memory read strobe) Port 3 from Pin-10 to Pin-17

IC 8051 Pin Description

reset crystal External memory Add. Latch enable Program Store Enable

IC 8051 Daily Applications

Moving message display Digital clock 7 segment display Traffic Light

IC 8051 Addressing Modes

•Immediate addressing modes ADD A, #23h (Add immediate data to Acc) •Register addressing modes ADD A, R2 (Add register to Accumulator) •Direct addressing modes ADD A, 40h (Add data at location 40h to Accumulator) •Register Indirect addressing modes ADD A,@R2 (Add indirect RAM to Acc)

Interrupts in 8051

• • An interrupt is an external or internal event that interrupts the microcontroller to inform it that a device needs its service The advantage of interrupts is that the microcontroller can serve many devices (not all at the same time) Program Program

Interrupt service

time

Interrupts in 8051

EA ET2 ES ET1 EX1

Internal Interrupts EX0 ET0 EX1 ET1 ES ET2 - EA Enables or disables external interrupt Enables or disables timer 0 overflow interrupt Enables or disables external interrupt 1 Enables or disables timer 1 overflow interrupt Enables or disables the serial port interrupt Enables or disables timer 2 overflow or capture interrupt Not implemented, reserved for future use Disables all interrupts External Interrupts P3.2 :INT0 (external interrupt 0) P3.3 :INT1 (external interrupt 1)

ET0 EX0

Seven Segment Display

7 pins of the microcontroller are used to shape the character of your LED display Port Relations Microcontroller with pin 7 Segment

Seven Segment Display

Table 1. Configuring the Character 7 Segment Data

8051 Microcontroller Design Softwares

Software’s Used

Keil µVision Top View Simulator Express PCB

Keil µVision IDE

 The µVision IDE from Keil combines project management, make facilities, source code editing, program debugging, and complete simulation in one powerful environment. The µVision development platform is easy-to-use and helping you quickly create embedded programs that work. The µVision editor and debugger are integrated in a single application that provides a seamless embedded project development environment.

Top View Simulator

• Topview Simulator gives an excellent simulation environment for MCS 51 Microcontroller.

A beginner can learn about 8051 based embedded solutions without any hardware. An experienced designer, you may find most of the required facilities built in the simulator that enabling you to complete your next project without waiting for the target hardware.

Top View Simulator

A Top View Simulator Program

Express PCB

Express PCB allows you to design schematics and PCB's. It is ideal for those that are looking to design anywhere from a two to four layer circuit board. A drop and drag design allows users to pick the components of the circuit board and drop it onto the circuit board in the software program. The designer can then place various pins in the circuit board to show where things need to be connected. It also has the ability of the program to show the designer where there are flaws in their design.

Express PCB

This way we can include resistors This way we can include different kind of IC’s

DC Motor interfacing with Microcontrollers

DC motors are always preffered over stepper motors. There are many things which we can do with our DC motor when interfaced with microcontroller. For example: we can control the speed of motor, we can control the direction of rotation, we can also do encoding of the rotation made by DC motor i.e. keeping track of how many turns are made by our motors etc.

Usually H-bridge is preffered way of interfacing a DC motor.

L293D is most used H-Bridge driver IC.

LCD INTERFACE

Stepper Motor

Of all motors, step motor is the easiest to control. It's handling simplicity is really hard to deny - all there is to do is to bring the sequence of rectangle impulses to one input of step controller and direction information to another input. Direction information is very simple and comes down to "left" for logical one on that pin and "right" for logical zero. Motor control is also very simple - every impulse makes the motor operating for one step and if there is no impulse the motor won't start. Pause between impulses can be shorter or longer and it defines revolution rate. This rate cannot be infinite because the motor won't be able to "catch up" with all the impulses (documentation on specific motor should contain such information)..

Interfacing of Stepper motor with 8051

MOTOR INTERFACING

Diagram of never falling robot

EDGE FOLLOWER ROBOTICS CKT

9 13 12 U1 RESET XTAL1 XTAL2 1 2 3 4 5 6 7 8 40 39 38 37 36 35 34 33 PA0/ADC0 PA1/ADC1 PA2/ADC2 PA3/ADC3 PA4/ADC4 PA5/ADC5 PA6/ADC6 PA7/ADC7 PB0/T0/XCK PB1/T1 PB2/AIN0/INT2 PB3/AIN1/OC0 PB4/SS PB5/MOSI PB6/MISO PB7/SCK ATMEGA16 PC0/SCL PC1/SDA PC2/TCK PC3/TMS PC4/TDO PC5/TDI PC6/TOSC1 PC7/TOSC2 PD0/RXD PD1/TXD PD2/INT0 PD3/INT1 PD4/OC1B PD5/OC1A PD6/ICP1 PD7/OC2 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 AREF AVCC 32 30 +12v 2 7 1 16 IN1 IN2 EN1 VSS 8 VS OUT1 OUT2 U2 3 6 9 10 15 EN2 IN3 IN4 GND GND OUT3 OUT4 11 14 L293D

PROGRAM OF NEVER FALLING ROBOTICS

DDRA.0=1; DDRA.1=1; DDRA.2=1; DDRA.3=1; while (1) { PORTA.0=1; PORTA.1=0; OCR0=200; PORTA.2=1; PORTA.3=0; OCR1A=200; delay_ms(100); PORTA.0=0; PORTA.1=1; OCR0=200; PORTA.2=0; PORTA.3=1; OCR1A=200; } delay_ms(100); PORTA.0=1; PORTA.1=0; OCR0=200; PORTA.2=0; PORTA.3=0; OCR1A=200; delay_ms(100); PORTA.0=0; PORTA.1=0; OCR0=200; PORTA.2=1; PORTA.3=0; OCR1A=200; delay_ms(100); } }

APPLICATION OF 8051 MICROCONTROLLER

The 8051 has been in use in a wide number of devices, mainly because it is easy to

integrate into a project or build a device around. The following are the main areas of focus: i. Energy Management:Efficient metering systems help in controlling energy usage in homes and industrial applications. These metering systems are made capable by incorporating microcontrollers.

ii. Touch screens:A high number of microcontroller providers incorporate touch sensing capabilities in their designs. Portable electronics such as cell phones, media players and gaming devices are examples of microcontroller-based touch screens.

iii. Automobiles: The 8051 finds wide acceptance in providing automobile solutions. They are widely used in hybrid vehicles to manage engine variants. Additionally, functions such as cruise control and anti-brake system have been made more efficient with the use of microcontrollers.

iv. Medical Devices:Portable medical devices such as blood pressure and glucose monitors use microcontrollers will to display data, thus providing higher reliability in providing medical results.