0% found this document useful (0 votes)
23 views54 pages

Unit5 Ece MC4TH Sem

Module 5 of the Microcontrollers course covers I/O port interfacing and programming with a focus on the 8051 microcontroller. Key topics include interfacing with LCDs, DACs, ADCs, stepper motors, DC motors, and implementing Pulse Width Modulation (PWM) using C. The module emphasizes practical applications and programming techniques for controlling various hardware components.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views54 pages

Unit5 Ece MC4TH Sem

Module 5 of the Microcontrollers course covers I/O port interfacing and programming with a focus on the 8051 microcontroller. Key topics include interfacing with LCDs, DACs, ADCs, stepper motors, DC motors, and implementing Pulse Width Modulation (PWM) using C. The module emphasizes practical applications and programming techniques for controlling various hardware components.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 54

MICROCONTROLLERS

[BEC405A]

MODULE 5
I/O Port Interfacing &
Programming:

Jayaprasad K M
Assistant Professor,
ECE Department, Coorg Institute of Technology
What do you learn in MODULE 5?
 I/O Programming in 8051 C,

 LCD interfacing,

 DAC 0808 Interfacing,

 ADC 0804 interfacing,

 Stepper motor interfacing,

 DC motor control

 Pulse Width Modulation (PWM) using C only.

(Text book 1- 7.2, 12.1, 13.1, 13.2, 17.2, 17.3)


2
8051 Block Diagram

3
8051 Programming Model

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Stepper motor interfacing
 The most common stepper motors
have four stator windings that are
paired with a centre tapped common.

 This type of stepper motor is referred


to as four-phase or unipolar
stepper motor

23
Stepper motor interfacing

24
Stepper motor interfacing

25
Stepper motor interfacing

26
Stepper motor interfacing

27
Stepper motor interfacing

28
Stepper motor interfacing

29
Stepper motor interfacing
#include <reg51.h> for(i=0; i<50;i++)
void MSDelay (unsigned int); {
P0 =0x33; //AntiClockwise Rotation
void main( ) MSDelay (100);
{ P0 =0x99;
for(i=0; i<50;i++) MSDelay (100);
{ P0 =0xCC;
P0 =0x66; //Clockwise Rotation MSDelay (100);
MSDelay (100); P0 =0x66;
P0 =0xCC; MSDelay (100);
MSDelay (100); }
P0 =0x99;
MSDelay (100); }
P0 =0x33; void MSDelay (unsigned int value)
MSDelay (100); {
} unsigned int x, y;
for (x=0;x<600;x++)
for (y=0;y< value; y++);
Return(0); 30
}
31
DC MOTOR INTERFACING AND PWM
Unidirection Control

32
DC MOTOR INTERFACING AND PWM
Unidirection Control

33
DC MOTOR INTERFACING AND PWM
Unidirection Control

34
DC MOTOR INTERFACING AND PWM
Unidirectional Control

35
DC MOTOR INTERFACING AND PWM
Bidirectional Control

36
DC MOTOR INTERFACING AND PWM
PWM
The speed of the motor depends on three factors:
(a) load, voltage, and (c) current.

For a given fixed load we can maintain a steady speed by using method called pulse
width modulation (PWM). By changing (modulating)
 By changing (modulating) the width of the pulse applied to the DC motor we
can increase or decrease the amount of power provided to the motor, thereby
increasing or decreasing the motor speed.

 Notice that, although the voltage has a fixed amplitude, it has a variable duty
cycle. That means the wider the pulse, the higher the speed.

37
DC MOTOR INTERFACING AND PWM
PWM

38
DC MOTOR INTERFACING AND PWM
DC motor control and PWM using C

39
DC MOTOR INTERFACING AND PWM
DC motor control and PWM using C

40
DC MOTOR INTERFACING AND PWM
DC motor control and PWM using C

41
42
DIGITAL TO ANALOG [DAC]
 This section will show how to interface a DAC to the 8051.
 Then we demonstrate how to generate a sine wave on the scope using the DAC.

 The vast majority of integrated circuit DACs, including the MCI408 (DAC0808) used in
this section, use the R/2R method since it can achieve a much higher degree of precision.

 The first criterion for judging a DAC is its resolution, which is a function of the number of
binary inputs.

 The common ones are 8, 10, and 12 bits. The number of data bit inputs decides the
resolution of the DAC since the number of analog output levels is equal to 2^n, where n
is the number of data bit inputs.

 Therefore, an 8-input DAC such as the DAC0808 provides 256 discrete voltage (or
current) levels of output. 43

 Similarly, the 12-bit DAC provides 4096 discrete voltage levels.


DIGITAL TO ANALOG [DAC]

44
DIGITAL TO ANALOG [DAC]

45
DIGITAL TO ANALOG [DAC]

46
DIGITAL TO ANALOG [DAC]

47
DIGITAL TO ANALOG [DAC]

48
DIGITAL TO ANALOG [DAC]

49
DIGITAL TO ANALOG [DAC]

50
DIGITAL TO ANALOG [DAC]

51
DIGITAL TO ANALOG [DAC]

52
DIGITAL TO ANALOG [DAC]

53

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy