Eslab 01
Eslab 01
OF ELECTRONICS ENGINEERING
GOVERNMENT
POLYTECHNIC COLLEGE
MATTANUR-670702
LABORATORY RECORD
NAME ATHUL PP
REG. No 2201041483
YEAR 2024-25
GPC MATTANNUR
2 DEPT. OF ELECTRONICS ENGINEERING
GPC MATTANNUR
3 DEPT. OF ELECTRONICS ENGINEERING
INDEX
3 15 19/06/24
READ A SWITCH AND DISPLAY STATUS ON LED
4 INTERFACING RELAY 17 21/06/24
GPC MATTANNUR
4 DEPT. OF ELECTRONICS ENGINEERING
Theory: AVR Studio is an integrated development environment (IDE) for developing and
debugging AVR microcontroller applications. AVR Studio provides a complete set of features
including project file management, a C/C++ editor, navigation and code completion; a debugger
supporting run control including source and instruction-level stepping; registers, memory and I/O
views; and target configuration and management. AVR Studio supports all 8 and 32-bit AVR
microcontrollers, and connects seamlessly to debuggers and development kits.
Procedure:
● After installation, open AVR Studio 5 from Start → All Programs → Atmel AVR Tools → AVR Studio
5.0
● After opening, you will see a Start Page like this. Click on “New Project…“.
1. In new projects page ensure that C/C++ is selected in Installed Templates and
AVRGCC C Executable Project is selected. Give a suitable project name (here name
given as Exp0). Click OK.
GPC MATTANNUR
5 DEPT. OF ELECTRONICS ENGINEERING
● Now, you will see the Device Selection dialog box. As you can see, AVR Studio supports all the
AVR MCUs. We choose ATmega32. Click OK.
Now select Build->Build Exp0 to build the project and generate Hex File. If build is successful without
any error, we get a Build successful message in Output window.
● Hex file with same name as project will be generated inside Debug folder in the location where
we saved the project during Step 2. This Hex file will be used for Proteus simulation.
GPC MATTANNUR
7 DEPT. OF ELECTRONICS ENGINEERING
Sample code
We will write the code for blinking an LED connected in pin c.0 with a delay in between.
int main(void)
{
DDRA = 0x01; // initialize port A.0 as o/p while(1)
{ // LED
on
PORTA = 0b00000001; // PA0 = High = Vcc _delay_ms(500);
// wait 500 milliseconds
//LED off
PORTC = 0b00000000; // PA0 = Low = 0v _delay_ms(500);
// wait 500 milliseconds
}
}
Result:
GPC MATTANNUR
8 DEPT. OF ELECTRONICS ENGINEERING
GPC MATTANNUR
10 DEPT. OF ELECTRONICS ENGINEERING
PROCEDURE:
1) The basic hardware connection for AVR has been assembled (Vcc, Ground, Reset, External crystal
for Clock). This setup on a single PCB with port terminals is called target board or development
board.
2) The driver software for USB programmer is installed .
(3) The software for HEX file loader [Here khazama], has been installed. [Prog. ISP, PonyProg,
Extreme burner, AVR dude, are some of the other popular GUI for hex file loading for different
programmers].
(4) The application program is compiled using AVR studio, while compiling, hex file is created in
the Project folder
5) The hardware connections are made and all the hardware arrangements are done for programming.
6) Khazama is opened and hex file of the program is loaded from the project folder [Browsing].
(7) Then Hex file is written into the AVR flash.
(8) The programmer is removed and the output is observed.
HARDWARE NEEDED
1. Computer system with windows OS.
2. Target board with interfacing circuit.
3. USB ASP programmer.
4. USB type B cable, FRC cable.
SOFTWARE NEEDED
1. AVR Studio (To edit, assemble and debug the program).
2. Khazama, to load hex file and to burn.
3. Driver Software for USB ASP programmer.
int main(void)
{
DDRA = 0xFF; /* Make all pins of PORTA as output pins */
while (1) /* Blink PORTA infinitely
*/
{
PORTA = 0x00;
GPC MATTANNUR
11 DEPT. OF ELECTRONICS ENGINEERING
DESIGN
R=V/I
In the LED circuit, total voltage V=5V.
Assume that voltage drop across LED=2.5V, and LED current = 10mA.
So voltage drop across resistor = 5V-2.5V= 2.5V.
There for R=2.5V/10mA = 250Ω.
Select nearest higher standard value; R = 330Ω .
GPC MATTANNUR
12 DEPT. OF ELECTRONICS ENGINEERING
PORTA = 0xFF;
_delay_ms(500);
} }
● #include <avr/io.h> is a header files which provides various i/o operations like DDRx, PINx,
PORTx, etc.
● #include <util/delay.h> is a header file which provides inbuilt delay functions like _delay_loop_1(),
_delay_loop_2(), _delay_ms(), _delay_us(), etc.
● _delay_ms(xxx) provides a delay xxx milliseconds whereas _delay_us(xxx) provides a delay of xxx
microseconds.
After typing the program in AVR studio, and saving it, build and generate hex file.
After setting up the AtMega 32 development BOARD and USB ISP programmer as shown in figure,
download the hex file to microcontroller using Khazama program.
Open Khazama, select chip, select the hex file to be copied to microcontroller, and select auto program
to write the chip.
After writing the chip, make connections to LED as per circuit and verify the program.
Result:
Written embedded c program to toggle LEDs connected to PORTA, generated he x file, downloaded to
microcontroller, and verified using target board.
GPC MATTANNUR
13 DEPT. OF ELECTRONICS ENGINEERING
GPC MATTANNUR
14 DEPT. OF ELECTRONICS ENGINEERING
SOFTWARE NEEDED:
1. AVR Studio (To edit, assemble and debug the program).
2. Khazama, to load hex file and to burn.
3. Driver Software for USB ASP programmer. ALGORITHM:
1.Set PORTC.0 as output by initializing DDRC.0 register with 0x01
2.Set PORTD as input by initializing DDRD register with 0x00
3.Read status of switch by reading value of PORTD Pin0. If it is high (Switch is closed), Turn ON
LED by outputting 0x01 on PORTC. If it is low(Switch is OFF), Turn OFF LED by outputting 0x00 on
PORTC. CODE:
#include <avr/io.h>
#include <util/delay.h> int
main(void)
{
DDRC = 0x01;//Makes first pin of PORTC as Output
DDRD = 0x00;// //Makes all pins of PORTD input
while(1) //infinite loop
{
if(PIND==0x01)//checking the status of PIN, if it is '1', turns on the LED
{
PORTC = 0x01;//Turns ON LED
}
else if(PIND==0x00)// checking the status of PIN, if it is '0', turns off
the LED
{
PORTC=0x00;// Turning off the LED
}
}
LED.
GPC MATTANNUR
15 DEPT. OF ELECTRONICS ENGINEERING
Hardware arrangement
GPC MATTANNUR
16 DEPT. OF ELECTRONICS ENGINEERING
INTERFACING RELAY
AIM:
Set up Atmega 32 based system to control a 230V/AC bulb using a switch connected to PD 7 pin.
THEORY:
A microcontroller can’t operate a 230 V device directly. Generally a relay is used to control such devices.
A relay is an electromagnetic switch used to control High Voltage or Current using low power circuits.
Electromagnetic relays uses an electromagnet to operate a switching mechanism. It also provides
isolation between low power circuit and high power circuits.
Normally a SPDT relay has 5 terminals. Two of them are used to energies the electromagnet and other
three are COM, NO, NC. COM stands for Common, NO stands for Normally Open and NC stands for
Normally Closed. When the electromagnet is not energized, the armature will be connected to NC
contact. Thus COM and NC will be connected. When the electromagnet is energized, the electromagnet
attracts the iron armature and it will be connected to NO contact. Thus COM and NO will be connected.
A relay should not be connected directly to a microcontroller as microcontroller is not able to supply
current required for the working of a relay, and back emf produced by relay coil may damage
microcontroller. A driver using transistor or ICs used to control relays.
Embedded C program
#include <avr/io.h>
#include <util/delay.h> int
main(void)
{
DDRA= 0x80; // PA.7 as out put.
DDRD= 0x00; // PD.7 as input.
PORTD=0X00; // PORT D.7 internal pull up turned on.
while(1)
{
int a= PIND; // Monitor pin D.7 for low.
if(a == 0 )
{
PORTA=0x80; // If switch pressed turn on light (PA.7).
GPC MATTANNUR
17 DEPT. OF ELECTRONICS ENGINEERING
Hardware arrangement
GPC MATTANNUR
18 DEPT. OF ELECTRONICS ENGINEERING
else
{
PORTA=0x00; // else turn off the light.
}
}
}
RESULT
Program written in embedded C, compiled, downloaded to target board, and implemented with
electromagnetic relay and 230V bulb.
GPC MATTANNUR
19 DEPT. OF ELECTRONICS ENGINEERING
CIRCUIT DIAGRAM
3&8 -ve
H G F E D C B A Data Digits
0 0 1 1 1 1 1 1 0x3F 0
0 0 0 0 0 `1 1 0 0x06 1
0 1 0 1 1 0 0 1 0x5B 2
0 1 0 0 1 1 1 1 0x4F 3
0 1 1 0 0 1 1 0 0X66 4
0 1 1 0 1 1 0 1 0x6D 5
0 1 1 1 1 1 0 1 0x7D 6
0 0 0 0 0 1 1 1 0X07 7
GPC MATTANNUR
20 DEPT. OF ELECTRONICS ENGINEERING
0 1 1 1 1 1 1 1 0x7F 8
0 1 1 0 1 1 1 1 0x6F 9
C Program
int main(void)
_delay_ms(1000); //delay
_delay_ms(1000); //delay
_delay_ms(1000); //delay
_delay_ms(1000); //delay
_delay_ms(1000); //delay
_delay_ms(1000); //delay
GPC MATTANNUR
21 DEPT. OF ELECTRONICS ENGINEERING
_delay_ms(1000); //delay
_delay_ms(1000); //delay
_delay_ms(1000); //delay
_delay_ms(1000); //delay
RESULT
Embedded C program for 7 segment display is written with delay routine, compiled the program,
downloaded in target board, and implemented.
GPC MATTANNUR
22 DEPT. OF ELECTRONICS ENGINEERING
L293D
INTERFACING DC MOTOR
AIM
Write embedded c program to control direction of rotation of DC motor and implement in
hardware.
Write embedded c program to control direction of rotation of DC motor using switch, and
implement in hardware.
THEORY
Generally DC motors are connected with transistorized H Bridge drivers. ICs such as L293D or L293 are
popular H Bridges. L293D is a Quadruple Half H-Bridge driver commonly used for motor driving. All the
four outputs of this IC are TTL compatible and output clamp diodes are provided to drive inductive loads.
L293D can provide up to 600mA current, in the voltage raging from 4.5 to 36v. L293 is a similar IC which
can provide up to 1A in the same voltage range.L293 or L293D contains four Half H Bridge drivers and are
enabled in pairs. We can drive two DC Motors with one L293Ds.
GPC MATTANNUR
23 DEPT. OF ELECTRONICS ENGINEERING
Program 1
GPC MATTANNUR
24 DEPT. OF ELECTRONICS ENGINEERING
Program 2
RESULT
Embedded C program for controlling direction of rotation of DC motor is written, compiled the program,
downloaded in target board, and implemented.
GPC MATTANNUR
25 DEPT. OF ELECTRONICS ENGINEERING
Step A B Step A B C D
1 1 0 1 1 0 0 1
2 1 1 2 1 0 0 0
3 1 1 0 0
3 0 1
4 0 1 0 0
4 0 0
5 0 1 1 0
6 0 0 1 0
7 0 0 1 1
GPC MATTANNUR
26 DEPT. OF ELECTRONICS ENGINEERING
8 0 0 0 1
THEORY
Stepper motor is a brushless DC motor that divides the full rotation angle of 360° into a number of equal
steps. The motor is rotated by applying a certain sequence of control signals. The speed of rotation can
be changed by changing the rate at which the control signals are applied.
Stepper motors are classified in to Unipolar, and bipolar depending upon winding arrangement.
Unipolar Stepper Motor has centre tapped winding with 5 (If both centers are connected internally) or 6
wires as shown in figure. Generally, these centre tapped connections are connected to the power supply.
By providing ground path to the winding leads we can allow the flow of current through each half of coil
which create magnetic poles. By altering poles sequentially, we can rotate rotor accordingly. A
microcontroller can be used to apply different control signals to the motor to make it rotate according to
the need of the application.
ULN2003 driver is used to the driving stepper motor. The ULN2003A is an array of seven NPN Darlington
transistors capable of 500mA, 50 V output. It features common-cathode flyback diodes for switching
inductive loads.
GPC MATTANNUR
27 DEPT. OF ELECTRONICS ENGINEERING
{ PORTD = 0x09;
GPC MATTANNUR
28 DEPT. OF ELECTRONICS ENGINEERING
_delay_ms(100);
PORTD = 0x03;
_delay_ms(100);
PORTD = 0x06;
_delay_ms(100);
PORTD = 0x0C;
_delay_ms(100);
}
}
Stepper motor direction control using switch connected to pin A-7
#define F_CPU 8000000UL /* Define CPU Frequency 8MHz */
#include<avr/io.h> /* Include AVR std. library file */
#include<util/delay.h> /* Include delay header file */
voidmain(void)
{
DDRA=0X00; /* Make PORTA pins as input */
PORTA=0XFF; /* Make PORTA internal pull up */ DDRD =
0xFF; /* Make PORTD pins as output */
while (1)
{ if((PINA&0x80)==0)
{
PORTD = 0x09;
_delay_ms(100);
PORTD = 0x03;
_delay_ms(100);
PORTD = 0x06;
_delay_ms(100);
PORTD = 0x0C;
delay_ms(100);
}
else
{
PORTD = 0x06;
_delay_ms(100);
PORTD = 0x03;
_delay_ms(100);
PORTD = 0x09;
_delay_ms(100);
PORTD = 0x0C;
delay_ms(100);
}
}
}
GPC MATTANNUR
29 DEPT. OF ELECTRONICS ENGINEERING
RESULT
GPC MATTANNUR
30 DEPT. OF ELECTRONICS ENGINEERING
THEORY
Liquid Crystal Display (LCD) is widely used in various electronics’ applications to show different status and
parameters. LCD16x2 has 2 lines with 16 characters in each line. Each character is made up of 5x8
(column x row) pixel matrix. LCD 16x2 is a 16 pin device which has 8 data pins (D0-D7) and 3 control pins
(RS, RW, EN). The remaining 5 pins are for supply and backlight for the LCD. The control pins help us
configure the LCD in command mode or data mode.
C Program
// Code for LCD Interfacing with ATmega32 AVR microcontroller
#define F_CPU 16000000UL /* Define CPU Frequency e.g. here
16MHz */
#include <avr/io.h> /* Include AVR std. library file
*/
GPC MATTANNUR
31 DEPT. OF ELECTRONICS ENGINEERING
GPC MATTANNUR
32 DEPT. OF ELECTRONICS ENGINEERING
//------function declaration---------
void lcd_command(char c); void
lcd_data(char d); void lcd_puts(const
char *s);
GPC MATTANNUR
33 DEPT. OF ELECTRONICS ENGINEERING
_delay_us(5);
PORTC&=~(1<<LCD_EN);
_delay_ms(1);
}
GPC MATTANNUR
34 DEPT. OF ELECTRONICS ENGINEERING
RESULT
Interfacing program for 16x2 LCD is written in embedded C, compiled, downloaded to target board, and
implemented LCD interfacing.
GPC MATTANNUR
35 DEPT. OF ELECTRONICS ENGINEERING
CIRCUIT DIAGRAM
INTERFACING ADC
AIM
To familiarize ADC interfacing in ATmega 32.
THEORY
AtMega 32 has an inbuilt 8 channel ADC with 10 bit resolution. It has features like selectable
reference voltage, single ended or differential channel, gain controller, sampling prescalar, etc.
these can be selected using ADCMU and ADCSRA registers.
A potentiometer connected to PORTA.0 to develop a variable voltage. LEDs connected to PORTB
and PORTD to indicate the binary equivalent. Change the potentiometer position and observe
the change in binary pattern.
C Program
#include <avr/io.h>
int main(void)
{
DDRD = 0xFF; //port D output
GPC MATTANNUR
36 DEPT. OF ELECTRONICS ENGINEERING
RESULT
CIRCUIT DIAGRAM
GPC MATTANNUR
37 DEPT. OF ELECTRONICS ENGINEERING
To interface Temperature sensor with AVR microcontroller using ATmega32 ADC and display on
LCD
THEORY
To use ATmega32 ADC, the analog input need to be connected to PORTA pins which are
multiplexed as ADC input pins (labeled as ADC0 to ADC7). LM35 Temperature sensor (Pin 2)
is connected to PORTA Pin 0(ADC0 pin) of ATmega32. PORTA is configured as an input port
and PORTD and C as out put ports.is configured as an output port. Data lines of LCD are
connected to PORTD, and PORTC.6 and 7 are used as RS and E. RW is connected to ground.
LM35 series are precision integrated-circuit temperature sensors whose output voltage is
linearly proportional to the temperature. It outputs 10 mV for each degree of temperature.
The ADC has 10-bit resolution. So number of steps will be 1024. We use the internal 2.56 V
reference voltage as Vref, so the step size would be 2.56 V/1024 = 2.5 mV. LM35 sensor
produces 10 mV for each degree of temperature change and the ADC step size is 2.5 mV. So
each degree of temperature change corresponds to 4 ADC steps(10 mV/2.5 mV = 4).This
makes the binary output number for the ADC four times the real temperature. So the 10-bit
output of the ADC is divided by 4 to get the real temperature. To divide the 10-bit output of
the ADC by 4 we choose the left-justified option and only read the ADCH register. It is same
as shifting the result 2 bits right (division by 4 in binary).
C Program
//------function declaration---------
void lcd_command(char c); void
lcd_data(char d); void lcd_puts(const
char *s);
GPC MATTANNUR
38 DEPT. OF ELECTRONICS ENGINEERING
GPC MATTANNUR
39 DEPT. OF ELECTRONICS ENGINEERING
_delay_us(5);
}
}
GPC MATTANNUR
40 DEPT. OF ELECTRONICS ENGINEERING
void lcd_data(char d)
{
LCD_DATA=d;
PORTC|=(1<<LCD_RS);
PORTC|=(1<<LCD_EN);
_delay_us(5);
PORTC&=~(1<<LCD_EN);
_delay_ms(1);
}
RESULT
Interfacing program for LM 35 with 16x2 LCD is written in embedded C, compiled, downloaded to target
board, and implemented.
GPC MATTANNUR
41 DEPT. OF ELECTRONICS ENGINEERING
GPC MATTANNUR
42 DEPT. OF ELECTRONICS ENGINEERING
THEORY
Matrix keypad offers more inputs with the lesser I/O pins. A matrix keypad consists of a set of push-
button or switches which are arranged in a matrix format of rows and columns.
The CPU accesses both rows and columns through ports. When a key is pressed, a row and a column
make a contact. otherwise, there is no connection between rows and columns.
All the column pins (Col1 – Col4) are connected to the inputs pins and all the row (Ro1 –Ro4), pins are
connected to the output pins of the microcontroller. In the normal case, all the column pins are pulled up
(HIGH state) by internal or external pull-up resistors. Now we can read the status of each switch through
scanning.
1. A logic LOW is given to Row1 and others (Row2 – Row-4) HIGH
2. Now each Column is scanned. If any switch belongs to the 1 st row is pressed the corresponding
column will pull down (logic LOW) and we can detect the pressed key.
3. This process is repeated for all rows.
From the row column pattern it is possible to identify the pressed key with the help of a look up table.
Debouncing can be done either with software or hardware.
PROCEDURE
Row and column lines of keypad are connected to PORTA. LCD is used to display the pressed key. PORTD is
used as data lines, and PORTC 6 and 7 lines are used as RS and EN lines of LCD. C Program
char i,chr;
GPC MATTANNUR
43 DEPT. OF ELECTRONICS ENGINEERING
GPC MATTANNUR
44 DEPT. OF ELECTRONICS ENGINEERING
//-------reading columns-------------
switch(i)
{
case 0x0E:
chr='0';
lcd_data(chr);
break;
case 0x0D:
chr='4';
lcd_data(chr);
break;
case 0x0B:
chr='8';
lcd_data(chr);
break;
case 0x07:
chr='C';
lcd_data(chr);
break;
}
PORTA=0XBF; //row2=0
i=PINA & 0X0F;
switch(i)
{
case 0x0E:
chr='1';
lcd_data(chr);
break;
case 0x0D:
chr='5';
GPC MATTANNUR
45 DEPT. OF ELECTRONICS ENGINEERING
lcd_data(chr);
break;
case 0x0B:
chr='9';
lcd_data(chr);
break;
GPC MATTANNUR
46 DEPT. OF ELECTRONICS ENGINEERING
case 0x07:
chr='D';
lcd_data(chr);
break;
}
PORTA=0XDF; //row3=0
i=PINA& 0X0F;
switch(i)
{
case 0x0E:
chr='2';
lcd_data(chr);
break;
case 0x0D:
chr='6';
lcd_data(chr);
break;
case 0x0B:
chr='A';
lcd_data(chr);
break;
case 0x07:
chr='E';
lcd_data(chr);
break;
}
PORTA=0XEF; //row4=0
i=PINA& 0X0F;
switch(i)
{
case 0x0E:
chr='3';
lcd_data(chr);
break;
case 0x0D:
chr='7';
lcd_data(chr);
break;
case 0x0B:
chr='B';
lcd_data(chr);
break;
case 0x07:
chr='F';
GPC MATTANNUR
47 DEPT. OF ELECTRONICS ENGINEERING
lcd_data(chr);
break;
}
}
return(0);
}
GPC MATTANNUR
48 DEPT. OF ELECTRONICS ENGINEERING
RESULT
Interfaced Matrix Keypad with ATMEGA32 and observed the key pressed on 16x2 LCD.
CIRCUIT DIAGRAM
GPC MATTANNUR
49 DEPT. OF ELECTRONICS ENGINEERING
AIM:
To interface 3 seven segment displays in multiplexed fashion with AVR microcontroller and display
continuous count from 000 to 999.
THEORY
With minimum number of o/p pins, multiple & segment displays can be connected, either
using a display driver or with Multiplexing. This technique is based on the principle of
Persistence of Vision of eyes. If the frames change at a rate of 25 ( or more) frames per second,
human eye can’t detect that visual change. Each display appears turned on continuously.
PORTA is configured as output port. 3 common cathode 7 segment displays are connected to
PORTA in a multiplexed fashion. PORTA Pins 0 to 7 are connected to D1to D8 segment pins of 7
segment display which correspond to segments a to g and dot in 7 segment display. PORTD is
also configured as output port .Pin 2 of Port D is connected to common cathode point of 1 st 7
segment display, Pin 1 to 2nd and Pin 0 to 3rd respectively through switching transistors. This is
done to control the displays individually. The 7 segment displays are switched on and off
sequentially with a delay of 1 ms and due to human persistence of vision they appear as stable.
ALGORITHM
GPC MATTANNUR
51 DEPT. OF ELECTRONICS ENGINEERING
CODE
char seg_7[10] =
{0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
unsigned char hun,ten,one,dig; int main(void)
{
DDRA = 0xFF; // setting PORTA as output
DDRD= 0xFF; // setting PORTD as output
PORTD = 0x00; // initially disable all 3 seven segment displays
PORTA = 0x00;
while (1) // indefinite loop
{
for(hun = 0; hun<10; hun++) //for loop for 100's place
{
for(ten = 0;ten<10;ten++) //for loop for 10's place
{
for(one=0; one<10; one++) //for loop for 1's place
{
for (dig =0; dig<10;dig++)
{
PORTD = 0x04; // enable 1st 7 segment display
PORTA = seg_7[hun]; // output hex code for 100's place value
_delay_ms(10); // 10 msec delay
RESULT:
GPC MATTANNUR
52 DEPT. OF ELECTRONICS ENGINEERING
3 seven segment displays in multiplexed fashion have been interfaced with AVR microcontroller and
displayed continuous count from 000 to 999.
CIRCUIT DIAGRAM
GPC MATTANNUR
53 DEPT. OF ELECTRONICS ENGINEERING
OPEN PROJECT
AIM:
To interface light dependent resistor (LDR) with AVR microcontroller and control the led light intensity
THEORY:
A light dependent resistor is a resistor whose resistance changes with the intensity of incident light. The
working principle of light dependent resistor is photoelectric effect. A light dependent resistor is made of
a high resistance semiconductor. If the energy of the incident light is greater than the band gap of the
semiconductor, electron-hole pairs are generated .The photo generated electron-hole pair transits the
device giving rise to photo conductivity. Here PORTB is configured as output.
CODE
}
_delay_ms(100) // 10 msec delay
}
return 0;
}
GPC MATTANNUR
55 DEPT. OF ELECTRONICS ENGINEERING
Explanation:
- Initialize LDR as analog input (PC0) and LED as digital output (PB0).
- Read LDR value using ADC.
- Compare LDR value to threshold.
- Turn on/off LED based on threshold comparison.
Pin Functions:
GPC MATTANNUR
56 DEPT. OF ELECTRONICS ENGINEERING
RESULT:
Interfaced the LDR with AVR microcontroller and controlled the LED using light intensity
GPC MATTANNUR
57 DEPT. OF ELECTRONICS ENGINEERING
GPC MATTANNUR
58 DEPT. OF ELECTRONICS ENGINEERING
GPC MATTANNUR
59 DEPT. OF ELECTRONICS ENGINEERING
GPC MATTANNUR
60 DEPT. OF ELECTRONICS ENGINEERING
GPC MATTANNUR
61 DEPT. OF ELECTRONICS ENGINEERING
GPC MATTANNUR
62 DEPT. OF ELECTRONICS ENGINEERING
GPC MATTANNUR
63 DEPT. OF ELECTRONICS ENGINEERING
GPC MATTANNUR
64 DEPT. OF ELECTRONICS ENGINEERING
GPC MATTANNUR