SlideShare ist ein Scribd-Unternehmen logo
1 von 11
Program 1: Write program to on off LED with some delay. LED is connected to port Rb0
#define LED PORTB.F0
void main()
{
TRISB.F0=0;
LED=0;
while(1)
{
LED=1;
delay_ms(1000);
LED=0;
delay_ms(1000);
}
}
Design:
Program 2: Interface 7 Segment with MC. Display the number from 0-9 on 7 Segment
#define LED PORTC
int j=0,i=0;
void main()
{
unsigned char arr[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
TRISC=0;
LED=0;
while(1)
{
for(i=0;i<10;i++)
{
LED=arr[i];
delay_ms(100);
}
}
}
Design:
Program 3: Write a program to count numbers from 00 to FF on PORT B
#define LED PORTB
unsigned char i=0x00;
void main(void)
{
TRISB=0;
LED=OFF;
while(i<0xFF)
{
LED=1;
Delay_ms(100);
LED=0;
Delay_ms(100);
i++;
}
}
Design:
Program 4: Write Program to read data on PORT B and send it on PORT C
#define a PORTB
#define b PORTC
void main()
{
TRISC=0X00;
TRISB=0XFF;
while(1)
{
b=a;
}
}
Design:
Program 5: Write Program to read data on PORT B and send it on PORT C in inverted form
#define a PORTB
#define b PORTC
void main()
{
TRISC=0X00;
TRISB=0XFF;
while(1)
{
b=~a;
}
}
Design:
Program 6: Write a program to input byte of data in MC at Rb0 serially one bit at a time. LSB
should come first
#define pb0 portb.f0
void main()
{
unsigned char x;
unsigned char assign=0;
trisb.f0=1;
trisd=0;
for(x=0;x<8;x++)
{
assign=assign>>1;
assign=(pb0 & 0x01)<<7;
}
portd=assign;
}
Design:
Program 7: Write a program to input byte of data in MC at Rb0 serially one bit at a time. MSB
should come first
#define pb0 portb.f0
void main()
{
unsigned char x;
unsigned char assign=0;
trisb.f0=1;
trisd=0;
for(x=0;x<8;x++)
{
assign=assign<<1;
assign=pb0 & 0x01;
}
portd=assign;
}
Design:
Program 8: Write a program to output byte of data in MC at Rb0 serially one bit at a time. MSB
should go first
#define LED PORTB.F0
void main()
{
unsigned char a,x;
unsigned int i;
x=0X45;
TRISB.F0=0;
LED=0;
a=x;
while(1)
{
for(i=7;i>=0;i--)
{
a=x;
LED=a>>i;
delay_ms(100);
if(i==0)
{
i=7;
a=x;
break;
}
}
}
}
Design:
Program 9: Write a program to input byte of data in MC at Rb0 serially one bit at a time. LSB
should go first
#define LED PORTB.F0
int i=0;
void main()
{
unsigned char x,a;
x=0xAA;
a=x;
TRISB.F0=0;
while(1)
{
a=a>>1;
LED=a;
delay_ms(100);
i++;
if(i==7)
{
i=0;
a=x ;
}
}
}
Design:
Program 10: Write a program to on off AC Bulb 220v using relay n MC
# define r PORTB.F0
# define s PORTB.F1
void main()
{
TRISB.F0=0;
TRISB.F1=1;
relay=0;
while(1)
{
if(s==0)
{
r=1;
}
else
{
r=0;
}
}
}
Design:
Program 11: Write a program to on off DC motor using switch. If switch is on, Motor moves
clockwise and vise versa
# define S PORTB.F0
# define C PORTC.F0
# define A PORTC.F1
void main(void)
{
TRISB.F0=1;
TRISC.F0=0;
TRISC.F1=0;
C=0;
A=0;
S=0;
while(1)
{
if(S==1)
{
C=1;
A=0;
}
else
{
C=0;
A=1;
}
}
}
Design:
Program 12: Write a program to control direction of Stepper Motor
void step(unsigned char);
void main()
{
unsigned char i;
trisd=0;
for(i=1;i<=40;i++)
{
step(0x03);
delay_ms(1000);
step(0x06);
delay_ms(1000);
step(0x0c);
delay_ms(1000);
step(0x09);
delay_ms(1000);
}
}
void step(unsigned char st)
{
portd=st;
}
Design:
Program 13: Design pressure controller using switch. Specifications of pressure switch is
given, At 100 Bar switch is Break. At 5 Bar Switch is Make.. Interface Pressure switch with MC to
perform the following tasks.
1.If switch is make, Start the Motor
2.If switch is break, Off the Motor
#define M PORTD.F0
unsigned int r=0;
void interrupt(void)
{
M=1;
if(INTCON.INT0IF==1)
{
if(r==1)
{
INTCON2.INTEDG0=1;
r=0;
}
else
{
M=1;
INTCON2.INTEDG0=0;
r=1;
}
}
}
void main()
{
TRISB.F0=1;
TRISD.F0=0;
INTCON=0x90;
INTCON2.INTEDG0=1;
M=0;
while(1){ }
}
Design:
Program 14: Write a program to display number of persons entering in building on LCD
Program 15: Design Temperature control system for furnace, Two temperature switches are
installed in furnace to sense hotness and coldness. Specification for hot sensors is Temperature
greater than 100 degree, For Cold sensors is temperature less than 35 degree. If Furnace is Hot
Make flame off, If furnace is Cold make flame on
void main(void)
{
TRISC=0;
INTCON.GIE=1;
INTCON.INT0IF=0;
INTCON.INT0IE=1;
INTCON3.INT1IF=0;
INTCON3.INT1IE=1;
INTCON2.INTEDG0=1;
INTCON2.INTEDG1=1;
while(1)
{ }
}
void interrupt (void)
{
Lcd_Init(&PORTC); // Initialize LCD connected to PORTC
Lcd_Cmd(Lcd_CLEAR); // Clear display
Lcd_Cmd(Lcd_CURSOR_OFF); // Turn cursor off
if(INTCON.INT0IF)
{
Lcd_Out(1, 1, "FURNANCE OFF");
INTCON.INT0IF=0;
}
if(INTCON3.INT1IF)
{
Lcd_Out(1, 1, "FURNANCE ON");
INTCON3.INT1IF=0;
}
}
Design:
Program 16: Design the interface of keypad with MC & display pressed key on LCD
unsigned char kp = ' ';
unsigned int get_Kp();
char keypadPort at PORTB;
sbit LCD_RS at RD0_bit;
sbit LCD_EN at RD1_bit;
sbit LCD_D4 at RD4_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D6 at RD6_bit;
sbit LCD_D7 at RD7_bit;
sbit LCD_RS_Direction at TRISD0_bit;
sbit LCD_EN_Direction at TRISD1_bit;
sbit LCD_D4_Direction at TRISD4_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D6_Direction at TRISD6_bit;
sbit LCD_D7_Direction at TRISD7_bit;
void main()
{
unsigned int temp;
Keypad_Init();
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Out(1, 1, "LCD ON ");
Delay_ms(500);
do
{
temp = get_Kp();
Lcd_Cmd(_LCD_CLEAR); // Clear display
switch (temp) {
case 1: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "/"); break; // /
case 2: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "*"); break; // *
case 3: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "-"); break; // -
case 4: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "+"); break; // +
case 5: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "9"); break; // 9
case 6: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "6"); break; // 6
case 7: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "3"); break; // 3
case 8: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "="); break; // =
case 9: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "8"); break; // 8
case 10: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "5"); break; // 5
case 11: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "2"); break; // 2
case 12: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "0"); break; // 0
case 13: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "7"); break; // 7
case 14: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "4"); break; // 4
case 15: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "1"); break; // 1
case 16: Lcd_Cmd(_LCD_CLEAR); break; // clear
}
Lcd_Out(2, 1, kp);
} while (1);
}
unsigned int get_Kp()
{
unsigned int kp1 = 0;
do{
kp1 = Keypad_Key_Click();
}while (!kp1);
return kp1;
}
Program 17: Design the interface of stepper motor with MC, Degree of circular motion of
stepper motor is entered from keypad and display degree & Motion on LCD
unsigned char kp = ' ';
unsigned int get_Kp();
char keypadPort at PORTB;
sbit LCD_RS at RD0_bit;
sbit LCD_EN at RD1_bit;
sbit LCD_D4 at RD4_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D6 at RD6_bit;
sbit LCD_D7 at RD7_bit;
sbit LCD_RS_Direction at TRISD0_bit;
sbit LCD_EN_Direction at TRISD1_bit;
sbit LCD_D4_Direction at TRISD4_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D6_Direction at TRISD6_bit;
sbit LCD_D7_Direction at TRISD7_bit;
void step(unsigned char);
void step(unsigned char st)
{
portc=st;
}
void main(){
unsigned int temp;
unsigned int key;
unsigned char i,n;
TRISC=0;
Keypad_Init();
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Out(1, 1, "LCD ON ");
Delay_ms(500);
do {
temp = get_Kp();
Lcd_Cmd(_LCD_CLEAR);
switch (temp) {
case 5: Lcd_Cmd(_LCD_CLEAR); key=9; Lcd_Out(1, 1, "9"); break;
case 6: Lcd_Cmd(_LCD_CLEAR); key=6; Lcd_Out(1, 1, "6"); break;
case 7: Lcd_Cmd(_LCD_CLEAR); key=3; Lcd_Out(1, 1, "3"); break;
case 9: Lcd_Cmd(_LCD_CLEAR); key=8; Lcd_Out(1, 1, "8"); break;
case 10: Lcd_Cmd(_LCD_CLEAR); key=5; Lcd_Out(1, 1, "5"); break;
case 11: Lcd_Cmd(_LCD_CLEAR); key=2; Lcd_Out(1, 1, "2"); break;
case 12: Lcd_Cmd(_LCD_CLEAR); key=0; Lcd_Out(1, 1, "0"); break;
case 13: Lcd_Cmd(_LCD_CLEAR); key=7; Lcd_Out(1, 1, "7"); break;
case 14: Lcd_Cmd(_LCD_CLEAR); key=4; Lcd_Out(1, 1, "4"); break;
case 15: Lcd_Cmd(_LCD_CLEAR); key=1; Lcd_Out(1, 1, "1"); break;
case 16: Lcd_Cmd(_LCD_CLEAR); break;
}
trisd=0;
n=30/key;
for(i=1;i<=n;i++)
{
step(0x03);
delay_ms(300);
step(0x06);
delay_ms(300);
step(0x0c);
delay_ms(300);
step(0x09);
delay_ms(300);
}
} while (1);
}
unsigned int get_Kp(){
unsigned int kp1 = 0;
do{
kp1 = Keypad_Key_Click();
}while (!kp1);
return kp1;
}

Weitere ähnliche Inhalte

Was ist angesagt?

Traffic light control using atmega16 ppt
Traffic light control using atmega16 pptTraffic light control using atmega16 ppt
Traffic light control using atmega16 pptSHIVA KUMAR
 
interfacing of temperature sensor LM 35 with 8051.pdf
interfacing of temperature sensor LM 35 with 8051.pdfinterfacing of temperature sensor LM 35 with 8051.pdf
interfacing of temperature sensor LM 35 with 8051.pdfSrikrishna Thota
 
ppt on embedded system
ppt on embedded systemppt on embedded system
ppt on embedded systemmanish katara
 
Msp 430 architecture module 1
Msp 430 architecture module 1Msp 430 architecture module 1
Msp 430 architecture module 1SARALA T
 
8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil Kaware8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil KawareProf. Swapnil V. Kaware
 
Battery level Indicator Circuit
Battery level Indicator CircuitBattery level Indicator Circuit
Battery level Indicator CircuitUzair Ahmad
 
Embedded system (Chapter 2) part A
Embedded system (Chapter 2) part AEmbedded system (Chapter 2) part A
Embedded system (Chapter 2) part AIkhwan_Fakrudin
 
Control unit design
Control unit designControl unit design
Control unit designDhaval Bagal
 
Industrial training report of vlsi,vhdl and pcb designing
Industrial training report of vlsi,vhdl and pcb designingIndustrial training report of vlsi,vhdl and pcb designing
Industrial training report of vlsi,vhdl and pcb designingPallavi Bharti
 
Sensor Based Blind Stick
Sensor Based Blind StickSensor Based Blind Stick
Sensor Based Blind StickGagandeep Singh
 
VLSI
VLSI VLSI
VLSI So Ma
 
8085-microprocessor
8085-microprocessor8085-microprocessor
8085-microprocessorjhcid
 
Properties of fourier transform
Properties of fourier transformProperties of fourier transform
Properties of fourier transformNisarg Amin
 
Four way traffic light conrol using Verilog
Four way traffic light conrol using VerilogFour way traffic light conrol using Verilog
Four way traffic light conrol using VerilogUtkarsh De
 

Was ist angesagt? (20)

Traffic light control using atmega16 ppt
Traffic light control using atmega16 pptTraffic light control using atmega16 ppt
Traffic light control using atmega16 ppt
 
interfacing of temperature sensor LM 35 with 8051.pdf
interfacing of temperature sensor LM 35 with 8051.pdfinterfacing of temperature sensor LM 35 with 8051.pdf
interfacing of temperature sensor LM 35 with 8051.pdf
 
Microcontroller 8096
Microcontroller 8096Microcontroller 8096
Microcontroller 8096
 
ppt on embedded system
ppt on embedded systemppt on embedded system
ppt on embedded system
 
Msp 430 architecture module 1
Msp 430 architecture module 1Msp 430 architecture module 1
Msp 430 architecture module 1
 
8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil Kaware8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil Kaware
 
Battery level Indicator Circuit
Battery level Indicator CircuitBattery level Indicator Circuit
Battery level Indicator Circuit
 
Embedded system (Chapter 2) part A
Embedded system (Chapter 2) part AEmbedded system (Chapter 2) part A
Embedded system (Chapter 2) part A
 
Xilinx 4000 series
Xilinx 4000 seriesXilinx 4000 series
Xilinx 4000 series
 
Control unit design
Control unit designControl unit design
Control unit design
 
Industrial training report of vlsi,vhdl and pcb designing
Industrial training report of vlsi,vhdl and pcb designingIndustrial training report of vlsi,vhdl and pcb designing
Industrial training report of vlsi,vhdl and pcb designing
 
ATmega 16
ATmega 16ATmega 16
ATmega 16
 
TMS320C5x
TMS320C5xTMS320C5x
TMS320C5x
 
Sensor Based Blind Stick
Sensor Based Blind StickSensor Based Blind Stick
Sensor Based Blind Stick
 
Risc & cisk
Risc & ciskRisc & cisk
Risc & cisk
 
Microcontroller
MicrocontrollerMicrocontroller
Microcontroller
 
VLSI
VLSI VLSI
VLSI
 
8085-microprocessor
8085-microprocessor8085-microprocessor
8085-microprocessor
 
Properties of fourier transform
Properties of fourier transformProperties of fourier transform
Properties of fourier transform
 
Four way traffic light conrol using Verilog
Four way traffic light conrol using VerilogFour way traffic light conrol using Verilog
Four way traffic light conrol using Verilog
 

Ähnlich wie Microcontroller Programming Assignment

22 Microcontroller Programs
22 Microcontroller Programs22 Microcontroller Programs
22 Microcontroller Programsbabak danyal
 
22 microcontroller programs
22 microcontroller programs22 microcontroller programs
22 microcontroller programsbabak danyal
 
2022-BEKM 3453 - LCD and keypad.pdf
2022-BEKM 3453 - LCD and keypad.pdf2022-BEKM 3453 - LCD and keypad.pdf
2022-BEKM 3453 - LCD and keypad.pdfVNEX
 
Dam gate open close lpc prog
Dam gate open close lpc progDam gate open close lpc prog
Dam gate open close lpc prognikhil dixit
 
Lcd interface with atmega32 avr best.ppt
Lcd interface with atmega32 avr best.pptLcd interface with atmega32 avr best.ppt
Lcd interface with atmega32 avr best.pptSoumyaGupta836456
 
m.tech esd lab manual for record
m.tech esd lab manual for recordm.tech esd lab manual for record
m.tech esd lab manual for recordG Lemuel George
 
Moving message display
Moving message displayMoving message display
Moving message displayviraj1989
 
Untitled 1
Untitled 1Untitled 1
Untitled 1lakachew
 
Functions for Nano 5 Card
Functions for Nano 5 CardFunctions for Nano 5 Card
Functions for Nano 5 CardOmar Sanchez
 
Vlsi es-lab-manual
Vlsi es-lab-manualVlsi es-lab-manual
Vlsi es-lab-manualtwinkleratna
 

Ähnlich wie Microcontroller Programming Assignment (20)

22 Microcontroller Programs
22 Microcontroller Programs22 Microcontroller Programs
22 Microcontroller Programs
 
22 microcontroller programs
22 microcontroller programs22 microcontroller programs
22 microcontroller programs
 
131080111003 mci
131080111003 mci131080111003 mci
131080111003 mci
 
LCD_Example.pptx
LCD_Example.pptxLCD_Example.pptx
LCD_Example.pptx
 
Program LCD ARM
Program LCD ARMProgram LCD ARM
Program LCD ARM
 
2022-BEKM 3453 - LCD and keypad.pdf
2022-BEKM 3453 - LCD and keypad.pdf2022-BEKM 3453 - LCD and keypad.pdf
2022-BEKM 3453 - LCD and keypad.pdf
 
Dam gate open close lpc prog
Dam gate open close lpc progDam gate open close lpc prog
Dam gate open close lpc prog
 
08_lcd.pdf
08_lcd.pdf08_lcd.pdf
08_lcd.pdf
 
Lcd interface with atmega32 avr best.ppt
Lcd interface with atmega32 avr best.pptLcd interface with atmega32 avr best.ppt
Lcd interface with atmega32 avr best.ppt
 
m.tech esd lab manual for record
m.tech esd lab manual for recordm.tech esd lab manual for record
m.tech esd lab manual for record
 
PIC and LCD
PIC and LCDPIC and LCD
PIC and LCD
 
pandu-vivek (1)
pandu-vivek (1)pandu-vivek (1)
pandu-vivek (1)
 
Lcd & keypad
Lcd & keypadLcd & keypad
Lcd & keypad
 
Moving message display
Moving message displayMoving message display
Moving message display
 
_LCD display-mbed.pdf
_LCD display-mbed.pdf_LCD display-mbed.pdf
_LCD display-mbed.pdf
 
Untitled 1
Untitled 1Untitled 1
Untitled 1
 
Functions for Nano 5 Card
Functions for Nano 5 CardFunctions for Nano 5 Card
Functions for Nano 5 Card
 
Direct analog
Direct analogDirect analog
Direct analog
 
ESD -DAY 24.pptx
ESD -DAY 24.pptxESD -DAY 24.pptx
ESD -DAY 24.pptx
 
Vlsi es-lab-manual
Vlsi es-lab-manualVlsi es-lab-manual
Vlsi es-lab-manual
 

Mehr von babak danyal

Easy Steps to implement UDP Server and Client Sockets
Easy Steps to implement UDP Server and Client SocketsEasy Steps to implement UDP Server and Client Sockets
Easy Steps to implement UDP Server and Client Socketsbabak danyal
 
Java IO Package and Streams
Java IO Package and StreamsJava IO Package and Streams
Java IO Package and Streamsbabak danyal
 
Swing and Graphical User Interface in Java
Swing and Graphical User Interface in JavaSwing and Graphical User Interface in Java
Swing and Graphical User Interface in Javababak danyal
 
block ciphers and the des
block ciphers and the desblock ciphers and the des
block ciphers and the desbabak danyal
 
key distribution in network security
key distribution in network securitykey distribution in network security
key distribution in network securitybabak danyal
 
Lecture10 Signal and Systems
Lecture10 Signal and SystemsLecture10 Signal and Systems
Lecture10 Signal and Systemsbabak danyal
 
Lecture8 Signal and Systems
Lecture8 Signal and SystemsLecture8 Signal and Systems
Lecture8 Signal and Systemsbabak danyal
 
Lecture7 Signal and Systems
Lecture7 Signal and SystemsLecture7 Signal and Systems
Lecture7 Signal and Systemsbabak danyal
 
Lecture6 Signal and Systems
Lecture6 Signal and SystemsLecture6 Signal and Systems
Lecture6 Signal and Systemsbabak danyal
 
Lecture5 Signal and Systems
Lecture5 Signal and SystemsLecture5 Signal and Systems
Lecture5 Signal and Systemsbabak danyal
 
Lecture4 Signal and Systems
Lecture4  Signal and SystemsLecture4  Signal and Systems
Lecture4 Signal and Systemsbabak danyal
 
Lecture3 Signal and Systems
Lecture3 Signal and SystemsLecture3 Signal and Systems
Lecture3 Signal and Systemsbabak danyal
 
Lecture2 Signal and Systems
Lecture2 Signal and SystemsLecture2 Signal and Systems
Lecture2 Signal and Systemsbabak danyal
 
Lecture1 Intro To Signa
Lecture1 Intro To SignaLecture1 Intro To Signa
Lecture1 Intro To Signababak danyal
 
Lecture9 Signal and Systems
Lecture9 Signal and SystemsLecture9 Signal and Systems
Lecture9 Signal and Systemsbabak danyal
 
Cns 13f-lec03- Classical Encryption Techniques
Cns 13f-lec03- Classical Encryption TechniquesCns 13f-lec03- Classical Encryption Techniques
Cns 13f-lec03- Classical Encryption Techniquesbabak danyal
 
Classical Encryption Techniques in Network Security
Classical Encryption Techniques in Network SecurityClassical Encryption Techniques in Network Security
Classical Encryption Techniques in Network Securitybabak danyal
 

Mehr von babak danyal (20)

applist
applistapplist
applist
 
Easy Steps to implement UDP Server and Client Sockets
Easy Steps to implement UDP Server and Client SocketsEasy Steps to implement UDP Server and Client Sockets
Easy Steps to implement UDP Server and Client Sockets
 
Java IO Package and Streams
Java IO Package and StreamsJava IO Package and Streams
Java IO Package and Streams
 
Swing and Graphical User Interface in Java
Swing and Graphical User Interface in JavaSwing and Graphical User Interface in Java
Swing and Graphical User Interface in Java
 
Tcp sockets
Tcp socketsTcp sockets
Tcp sockets
 
block ciphers and the des
block ciphers and the desblock ciphers and the des
block ciphers and the des
 
key distribution in network security
key distribution in network securitykey distribution in network security
key distribution in network security
 
Lecture10 Signal and Systems
Lecture10 Signal and SystemsLecture10 Signal and Systems
Lecture10 Signal and Systems
 
Lecture8 Signal and Systems
Lecture8 Signal and SystemsLecture8 Signal and Systems
Lecture8 Signal and Systems
 
Lecture7 Signal and Systems
Lecture7 Signal and SystemsLecture7 Signal and Systems
Lecture7 Signal and Systems
 
Lecture6 Signal and Systems
Lecture6 Signal and SystemsLecture6 Signal and Systems
Lecture6 Signal and Systems
 
Lecture5 Signal and Systems
Lecture5 Signal and SystemsLecture5 Signal and Systems
Lecture5 Signal and Systems
 
Lecture4 Signal and Systems
Lecture4  Signal and SystemsLecture4  Signal and Systems
Lecture4 Signal and Systems
 
Lecture3 Signal and Systems
Lecture3 Signal and SystemsLecture3 Signal and Systems
Lecture3 Signal and Systems
 
Lecture2 Signal and Systems
Lecture2 Signal and SystemsLecture2 Signal and Systems
Lecture2 Signal and Systems
 
Lecture1 Intro To Signa
Lecture1 Intro To SignaLecture1 Intro To Signa
Lecture1 Intro To Signa
 
Lecture9 Signal and Systems
Lecture9 Signal and SystemsLecture9 Signal and Systems
Lecture9 Signal and Systems
 
Lecture9
Lecture9Lecture9
Lecture9
 
Cns 13f-lec03- Classical Encryption Techniques
Cns 13f-lec03- Classical Encryption TechniquesCns 13f-lec03- Classical Encryption Techniques
Cns 13f-lec03- Classical Encryption Techniques
 
Classical Encryption Techniques in Network Security
Classical Encryption Techniques in Network SecurityClassical Encryption Techniques in Network Security
Classical Encryption Techniques in Network Security
 

Kürzlich hochgeladen

Poster_density_driven_with_fracture_MLMC.pdf
Poster_density_driven_with_fracture_MLMC.pdfPoster_density_driven_with_fracture_MLMC.pdf
Poster_density_driven_with_fracture_MLMC.pdfAlexander Litvinenko
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjMohammed Sikander
 
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatmentsaipooja36
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxneillewis46
 
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...Sumit Tiwari
 
Implanted Devices - VP Shunts: EMGuidewire's Radiology Reading Room
Implanted Devices - VP Shunts: EMGuidewire's Radiology Reading RoomImplanted Devices - VP Shunts: EMGuidewire's Radiology Reading Room
Implanted Devices - VP Shunts: EMGuidewire's Radiology Reading RoomSean M. Fox
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...EduSkills OECD
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...Nguyen Thanh Tu Collection
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptxPoojaSen20
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptxPoojaSen20
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...Nguyen Thanh Tu Collection
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppCeline George
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...Gary Wood
 
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45MysoreMuleSoftMeetup
 
Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).Mohamed Rizk Khodair
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文中 央社
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSean M. Fox
 
Championnat de France de Tennis de table/
Championnat de France de Tennis de table/Championnat de France de Tennis de table/
Championnat de France de Tennis de table/siemaillard
 

Kürzlich hochgeladen (20)

Poster_density_driven_with_fracture_MLMC.pdf
Poster_density_driven_with_fracture_MLMC.pdfPoster_density_driven_with_fracture_MLMC.pdf
Poster_density_driven_with_fracture_MLMC.pdf
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...
 
Implanted Devices - VP Shunts: EMGuidewire's Radiology Reading Room
Implanted Devices - VP Shunts: EMGuidewire's Radiology Reading RoomImplanted Devices - VP Shunts: EMGuidewire's Radiology Reading Room
Implanted Devices - VP Shunts: EMGuidewire's Radiology Reading Room
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptx
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
 
Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).
 
IPL Online Quiz by Pragya; Question Set.
IPL Online Quiz by Pragya; Question Set.IPL Online Quiz by Pragya; Question Set.
IPL Online Quiz by Pragya; Question Set.
 
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
Championnat de France de Tennis de table/
Championnat de France de Tennis de table/Championnat de France de Tennis de table/
Championnat de France de Tennis de table/
 

Microcontroller Programming Assignment

  • 1. Program 1: Write program to on off LED with some delay. LED is connected to port Rb0 #define LED PORTB.F0 void main() { TRISB.F0=0; LED=0; while(1) { LED=1; delay_ms(1000); LED=0; delay_ms(1000); } } Design: Program 2: Interface 7 Segment with MC. Display the number from 0-9 on 7 Segment #define LED PORTC int j=0,i=0; void main() { unsigned char arr[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; TRISC=0; LED=0; while(1) { for(i=0;i<10;i++) { LED=arr[i]; delay_ms(100); } } } Design: Program 3: Write a program to count numbers from 00 to FF on PORT B #define LED PORTB unsigned char i=0x00; void main(void) { TRISB=0; LED=OFF; while(i<0xFF) { LED=1; Delay_ms(100); LED=0;
  • 2. Delay_ms(100); i++; } } Design: Program 4: Write Program to read data on PORT B and send it on PORT C #define a PORTB #define b PORTC void main() { TRISC=0X00; TRISB=0XFF; while(1) { b=a; } } Design: Program 5: Write Program to read data on PORT B and send it on PORT C in inverted form #define a PORTB #define b PORTC void main() { TRISC=0X00; TRISB=0XFF; while(1) { b=~a; } } Design: Program 6: Write a program to input byte of data in MC at Rb0 serially one bit at a time. LSB should come first #define pb0 portb.f0 void main() { unsigned char x; unsigned char assign=0; trisb.f0=1; trisd=0;
  • 3. for(x=0;x<8;x++) { assign=assign>>1; assign=(pb0 & 0x01)<<7; } portd=assign; } Design: Program 7: Write a program to input byte of data in MC at Rb0 serially one bit at a time. MSB should come first #define pb0 portb.f0 void main() { unsigned char x; unsigned char assign=0; trisb.f0=1; trisd=0; for(x=0;x<8;x++) { assign=assign<<1; assign=pb0 & 0x01; } portd=assign; } Design: Program 8: Write a program to output byte of data in MC at Rb0 serially one bit at a time. MSB should go first #define LED PORTB.F0 void main() { unsigned char a,x; unsigned int i; x=0X45; TRISB.F0=0; LED=0; a=x; while(1) { for(i=7;i>=0;i--) { a=x; LED=a>>i; delay_ms(100); if(i==0) { i=7; a=x;
  • 4. break; } } } } Design: Program 9: Write a program to input byte of data in MC at Rb0 serially one bit at a time. LSB should go first #define LED PORTB.F0 int i=0; void main() { unsigned char x,a; x=0xAA; a=x; TRISB.F0=0; while(1) { a=a>>1; LED=a; delay_ms(100); i++; if(i==7) { i=0; a=x ; } } } Design: Program 10: Write a program to on off AC Bulb 220v using relay n MC # define r PORTB.F0 # define s PORTB.F1 void main() { TRISB.F0=0; TRISB.F1=1; relay=0; while(1) { if(s==0) { r=1; } else {
  • 5. r=0; } } } Design: Program 11: Write a program to on off DC motor using switch. If switch is on, Motor moves clockwise and vise versa # define S PORTB.F0 # define C PORTC.F0 # define A PORTC.F1 void main(void) { TRISB.F0=1; TRISC.F0=0; TRISC.F1=0; C=0; A=0; S=0; while(1) { if(S==1) { C=1; A=0; } else { C=0; A=1; } } } Design: Program 12: Write a program to control direction of Stepper Motor void step(unsigned char); void main() { unsigned char i; trisd=0; for(i=1;i<=40;i++) { step(0x03); delay_ms(1000); step(0x06); delay_ms(1000); step(0x0c); delay_ms(1000);
  • 6. step(0x09); delay_ms(1000); } } void step(unsigned char st) { portd=st; } Design: Program 13: Design pressure controller using switch. Specifications of pressure switch is given, At 100 Bar switch is Break. At 5 Bar Switch is Make.. Interface Pressure switch with MC to perform the following tasks. 1.If switch is make, Start the Motor 2.If switch is break, Off the Motor #define M PORTD.F0 unsigned int r=0; void interrupt(void) { M=1; if(INTCON.INT0IF==1) { if(r==1) { INTCON2.INTEDG0=1; r=0; } else { M=1; INTCON2.INTEDG0=0; r=1; } } } void main() { TRISB.F0=1; TRISD.F0=0;
  • 7. INTCON=0x90; INTCON2.INTEDG0=1; M=0; while(1){ } } Design: Program 14: Write a program to display number of persons entering in building on LCD Program 15: Design Temperature control system for furnace, Two temperature switches are installed in furnace to sense hotness and coldness. Specification for hot sensors is Temperature greater than 100 degree, For Cold sensors is temperature less than 35 degree. If Furnace is Hot Make flame off, If furnace is Cold make flame on void main(void) { TRISC=0; INTCON.GIE=1; INTCON.INT0IF=0; INTCON.INT0IE=1; INTCON3.INT1IF=0; INTCON3.INT1IE=1; INTCON2.INTEDG0=1; INTCON2.INTEDG1=1; while(1) { } } void interrupt (void) { Lcd_Init(&PORTC); // Initialize LCD connected to PORTC Lcd_Cmd(Lcd_CLEAR); // Clear display Lcd_Cmd(Lcd_CURSOR_OFF); // Turn cursor off if(INTCON.INT0IF) { Lcd_Out(1, 1, "FURNANCE OFF");
  • 8. INTCON.INT0IF=0; } if(INTCON3.INT1IF) { Lcd_Out(1, 1, "FURNANCE ON"); INTCON3.INT1IF=0; } } Design: Program 16: Design the interface of keypad with MC & display pressed key on LCD unsigned char kp = ' '; unsigned int get_Kp(); char keypadPort at PORTB; sbit LCD_RS at RD0_bit; sbit LCD_EN at RD1_bit; sbit LCD_D4 at RD4_bit; sbit LCD_D5 at RD5_bit; sbit LCD_D6 at RD6_bit; sbit LCD_D7 at RD7_bit; sbit LCD_RS_Direction at TRISD0_bit; sbit LCD_EN_Direction at TRISD1_bit; sbit LCD_D4_Direction at TRISD4_bit; sbit LCD_D5_Direction at TRISD5_bit; sbit LCD_D6_Direction at TRISD6_bit; sbit LCD_D7_Direction at TRISD7_bit; void main() { unsigned int temp; Keypad_Init(); Lcd_Init(); Lcd_Cmd(_LCD_CLEAR); Lcd_Cmd(_LCD_CURSOR_OFF); Lcd_Out(1, 1, "LCD ON "); Delay_ms(500);
  • 9. do { temp = get_Kp(); Lcd_Cmd(_LCD_CLEAR); // Clear display switch (temp) { case 1: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "/"); break; // / case 2: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "*"); break; // * case 3: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "-"); break; // - case 4: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "+"); break; // + case 5: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "9"); break; // 9 case 6: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "6"); break; // 6 case 7: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "3"); break; // 3 case 8: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "="); break; // = case 9: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "8"); break; // 8 case 10: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "5"); break; // 5 case 11: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "2"); break; // 2 case 12: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "0"); break; // 0 case 13: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "7"); break; // 7 case 14: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "4"); break; // 4 case 15: Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "1"); break; // 1 case 16: Lcd_Cmd(_LCD_CLEAR); break; // clear } Lcd_Out(2, 1, kp); } while (1); } unsigned int get_Kp() { unsigned int kp1 = 0; do{ kp1 = Keypad_Key_Click(); }while (!kp1); return kp1; } Program 17: Design the interface of stepper motor with MC, Degree of circular motion of stepper motor is entered from keypad and display degree & Motion on LCD
  • 10. unsigned char kp = ' '; unsigned int get_Kp(); char keypadPort at PORTB; sbit LCD_RS at RD0_bit; sbit LCD_EN at RD1_bit; sbit LCD_D4 at RD4_bit; sbit LCD_D5 at RD5_bit; sbit LCD_D6 at RD6_bit; sbit LCD_D7 at RD7_bit; sbit LCD_RS_Direction at TRISD0_bit; sbit LCD_EN_Direction at TRISD1_bit; sbit LCD_D4_Direction at TRISD4_bit; sbit LCD_D5_Direction at TRISD5_bit; sbit LCD_D6_Direction at TRISD6_bit; sbit LCD_D7_Direction at TRISD7_bit; void step(unsigned char); void step(unsigned char st) { portc=st; } void main(){ unsigned int temp; unsigned int key; unsigned char i,n; TRISC=0; Keypad_Init(); Lcd_Init(); Lcd_Cmd(_LCD_CLEAR); Lcd_Cmd(_LCD_CURSOR_OFF); Lcd_Out(1, 1, "LCD ON "); Delay_ms(500); do { temp = get_Kp(); Lcd_Cmd(_LCD_CLEAR); switch (temp) {
  • 11. case 5: Lcd_Cmd(_LCD_CLEAR); key=9; Lcd_Out(1, 1, "9"); break; case 6: Lcd_Cmd(_LCD_CLEAR); key=6; Lcd_Out(1, 1, "6"); break; case 7: Lcd_Cmd(_LCD_CLEAR); key=3; Lcd_Out(1, 1, "3"); break; case 9: Lcd_Cmd(_LCD_CLEAR); key=8; Lcd_Out(1, 1, "8"); break; case 10: Lcd_Cmd(_LCD_CLEAR); key=5; Lcd_Out(1, 1, "5"); break; case 11: Lcd_Cmd(_LCD_CLEAR); key=2; Lcd_Out(1, 1, "2"); break; case 12: Lcd_Cmd(_LCD_CLEAR); key=0; Lcd_Out(1, 1, "0"); break; case 13: Lcd_Cmd(_LCD_CLEAR); key=7; Lcd_Out(1, 1, "7"); break; case 14: Lcd_Cmd(_LCD_CLEAR); key=4; Lcd_Out(1, 1, "4"); break; case 15: Lcd_Cmd(_LCD_CLEAR); key=1; Lcd_Out(1, 1, "1"); break; case 16: Lcd_Cmd(_LCD_CLEAR); break; } trisd=0; n=30/key; for(i=1;i<=n;i++) { step(0x03); delay_ms(300); step(0x06); delay_ms(300); step(0x0c); delay_ms(300); step(0x09); delay_ms(300); } } while (1); } unsigned int get_Kp(){ unsigned int kp1 = 0; do{ kp1 = Keypad_Key_Click(); }while (!kp1); return kp1; }