SlideShare a Scribd company logo
1 of 9
Download to read offline
Buzzer:
#include <lpc214x.h>
#define BUZZER_ON() IO1CLR=(1<<25)
#define BUZZER_OFF() IO1SET=(1<<25)
#define Count 100
void Buzzer_Delay(unsigned char j);
void Buzzer_Delay(unsigned char j)
{
unsigned int i;
for(;j>0;j--)
{
for(i=0; i<60000; i++);
}
}
int main(void)
{
PINSEL0 = 0x0000000;
PINSEL1 = 0x00000000;
PINSEL2 = 0x00000000;
IO1DIR = (1<<25) ;
while(1)
{
BUZZER_ON();
Buzzer_Delay(Count);
BUZZER_OFF();
}
}
LCD:
#include "lcd.h"
unsigned char Name[]="MyName";
unsigned char Surname[] = "Surname";
int main (void)
{
init_lcd();
lcd_putstring(0,Name);
lcd_putstring(1,Surname);
while (1) ;
}
-------------------------------not required to write if not asked for it-------------------------------------------
#ifndef _LCD_H
#define _LCD_H
#define MAX_CHAR_IN_ONE_LINE 16
enum ROW_NUMBERS
{
LINE1,
LINE2
};
void init_lcd(void);
void lcd_putstring(unsigned char line, char *string);
void lcd_clear(void);
void lcd_backlight_on(void);
int lcd_gotoxy(unsigned int x, unsigned int y);
void lcd_putchar(int c);
#endif
Down counter:
#include<p24fj128ga010.h>
_CONFIG1( JTAGEN_OFF & GCP_OFF & GWRP_OFF & COE_OFF & FWDTEN_OFF & ICS_PGx2)
_CONFIG2( FCKSM_CSDCMD & OSCIOFNC_OFF & POSCMOD_XT & FNOSC_PRI)
void delay();
int main(void)
{
unsigned int b=255;
TRISA = 0x0000;
while(1)
{
PORTA=b;
delay();
delay();
b--;
if (!b)
{
delay();
delay();
delay();
delay();
b = 255;
}
}
}
void delay()
{
long int x;
for(x=0;x<90000;x++);
}
UP counter:
#include<p24fj128ga010.h>
_CONFIG1( JTAGEN_OFF & GCP_OFF & GWRP_OFF & COE_OFF & FWDTEN_OFF & ICS_PGx2)
_CONFIG2( FCKSM_CSDCMD & OSCIOFNC_OFF & POSCMOD_XT & FNOSC_PRI)
void delay();
int main(void)
{
unsigned int b=1;
TRISA = 0x0000;
while(1)
{
PORTA=b;
delay();
delay();
b++;
if (!b)
{
delay();
delay();
delay();
delay();
b = 0x0000;
}
}
}
void delay()
{
long int x;
for(x=0;x<90000;x++);
}
Left shift:
#include<p24fj128ga010.h>
_CONFIG1( JTAGEN_OFF & GCP_OFF & GWRP_OFF & COE_OFF & FWDTEN_OFF & ICS_PGx2)
_CONFIG2( FCKSM_CSDCMD & OSCIOFNC_OFF & POSCMOD_XT & FNOSC_PRI)
#define init_count 1
void delay();
unsigned int counter;
int main(void)
{
int i;
TRISA = 0x0000;
counter = init_count;
while(1)
{
for(i=0;i<8;i++)
{
PORTA=counter;
delay();
counter = counter << 1;
}
counter = 1;
}
}
void delay()
{
long int x;
for(x=0;x<90000;x++);
}
Right shift:
#include<p24fj128ga010.h>
_CONFIG1( JTAGEN_OFF & GCP_OFF & GWRP_OFF & COE_OFF & FWDTEN_OFF & ICS_PGx2)
_CONFIG2( FCKSM_CSDCMD & OSCIOFNC_OFF & POSCMOD_XT & FNOSC_PRI)
#define init_count 128
void delay();
unsigned int counter;
int main(void)
{
int i;
TRISA = 0x0000;
counter = init_count;
while(1)
{
for(i=0;i<8;i++)
{
PORTA=counter;
delay();
counter = counter >> 1;
}
counter = 128;
}
}
void delay()
{
long int x;
for(x=0;x<60000;x++);
}
Voltage converter/ADC:
#include<p24fj128ga010.h>
_CONFIG1( JTAGEN_OFF & GCP_OFF & GWRP_OFF & COE_OFF & FWDTEN_OFF & ICS_PGx2)
_CONFIG2( FCKSM_CSDCMD & OSCIOFNC_OFF & POSCMOD_XT & FNOSC_PRI)
#define init_count 128
int main(void)
{
unsigned int ADC_Result;
TRISA = 0x0000;
AD1CON1 = 0x80E4;
AD1CON2 = 0;
AD1CON3 = 0x1F05;
AD1CHS = 5;
TRISBbits.TRISB2 = 1;
TRISBbits.TRISB3 = 1;
AD1PCFGbits.PCFG5 = 0;
AD1CSSL = 0;
AD1CON1bits.ADON = 1;
while (1)
{
while(!AD1CON1bits.DONE);
ADC_Result = (long) ADC1BUF0;
ADC_Result >>= 7;
PORTA = (0x80 >> ADC_Result);
}
}
Note:
Device specific keywords in the program for ex: PORTA or TRISA etc are case sensitive.
Take care to ensure the cases in the program while executing.

More Related Content

What's hot

Digital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECEDigital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECERamesh Naik Bhukya
 
22 microcontroller programs
22 microcontroller programs22 microcontroller programs
22 microcontroller programsbabak danyal
 
Embedded system design psoc lab report
Embedded system design psoc lab reportEmbedded system design psoc lab report
Embedded system design psoc lab reportRamesh Naik Bhukya
 
Reporte de electrónica digital con VHDL: practica 7 memorias
Reporte de electrónica digital con VHDL: practica 7 memorias Reporte de electrónica digital con VHDL: practica 7 memorias
Reporte de electrónica digital con VHDL: practica 7 memorias SANTIAGO PABLO ALBERTO
 
To designing counters using verilog code
To designing counters using verilog codeTo designing counters using verilog code
To designing counters using verilog codeBharti Airtel Ltd.
 
Non overlapped melay 1010 sequence detector implemented on xilinx spartan 3e kit
Non overlapped melay 1010 sequence detector implemented on xilinx spartan 3e kitNon overlapped melay 1010 sequence detector implemented on xilinx spartan 3e kit
Non overlapped melay 1010 sequence detector implemented on xilinx spartan 3e kitJatin Koshiya
 
26. composite l2qtouchpad
26. composite l2qtouchpad26. composite l2qtouchpad
26. composite l2qtouchpadMedia4math
 
Introduction to mazey
Introduction to mazeyIntroduction to mazey
Introduction to mazeytruncalen3
 
CODING IN ARDUINO
CODING IN ARDUINOCODING IN ARDUINO
CODING IN ARDUINOS Ayub
 

What's hot (20)

Metal detecting robot sketch
Metal detecting robot sketchMetal detecting robot sketch
Metal detecting robot sketch
 
Alu description[1]
Alu description[1]Alu description[1]
Alu description[1]
 
Digital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECEDigital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECE
 
Assignment#2
Assignment#2Assignment#2
Assignment#2
 
C test
C testC test
C test
 
Assignment#4a
Assignment#4aAssignment#4a
Assignment#4a
 
22 microcontroller programs
22 microcontroller programs22 microcontroller programs
22 microcontroller programs
 
Flex sensor
Flex sensorFlex sensor
Flex sensor
 
Embedded system design psoc lab report
Embedded system design psoc lab reportEmbedded system design psoc lab report
Embedded system design psoc lab report
 
C++20 features
C++20 features C++20 features
C++20 features
 
Reporte de electrónica digital con VHDL: practica 7 memorias
Reporte de electrónica digital con VHDL: practica 7 memorias Reporte de electrónica digital con VHDL: practica 7 memorias
Reporte de electrónica digital con VHDL: practica 7 memorias
 
Assignment#7b
Assignment#7bAssignment#7b
Assignment#7b
 
Assignment#7a
Assignment#7aAssignment#7a
Assignment#7a
 
To designing counters using verilog code
To designing counters using verilog codeTo designing counters using verilog code
To designing counters using verilog code
 
Non overlapped melay 1010 sequence detector implemented on xilinx spartan 3e kit
Non overlapped melay 1010 sequence detector implemented on xilinx spartan 3e kitNon overlapped melay 1010 sequence detector implemented on xilinx spartan 3e kit
Non overlapped melay 1010 sequence detector implemented on xilinx spartan 3e kit
 
26. composite l2qtouchpad
26. composite l2qtouchpad26. composite l2qtouchpad
26. composite l2qtouchpad
 
Logic gates verification using universal gates
Logic gates verification using universal gatesLogic gates verification using universal gates
Logic gates verification using universal gates
 
Direct analog
Direct analogDirect analog
Direct analog
 
Introduction to mazey
Introduction to mazeyIntroduction to mazey
Introduction to mazey
 
CODING IN ARDUINO
CODING IN ARDUINOCODING IN ARDUINO
CODING IN ARDUINO
 

Similar to Lab programs FOR 8TH SEM EC SUBJECT BY LOHITH KUMAR |11GUEE6018

codings related to avr micro controller
codings related to avr micro controllercodings related to avr micro controller
codings related to avr micro controllerSyed Ghufran Hassan
 
Microcontroladores: programas de CCS Compiler.docx
Microcontroladores: programas de CCS Compiler.docxMicrocontroladores: programas de CCS Compiler.docx
Microcontroladores: programas de CCS Compiler.docxSANTIAGO PABLO ALBERTO
 
Two digit-countdown-timer
Two digit-countdown-timerTwo digit-countdown-timer
Two digit-countdown-timerHEATLBJ
 
ARM 7 LPC 2148 lecture
ARM 7 LPC 2148 lectureARM 7 LPC 2148 lecture
ARM 7 LPC 2148 lectureanishgoel
 
COA_remaining_lab_works_077BCT033.pdf
COA_remaining_lab_works_077BCT033.pdfCOA_remaining_lab_works_077BCT033.pdf
COA_remaining_lab_works_077BCT033.pdfJavedAnsari236392
 
Microsoft Word Hw#1
Microsoft Word   Hw#1Microsoft Word   Hw#1
Microsoft Word Hw#1kkkseld
 
Samrt attendance system using fingerprint
Samrt attendance system using fingerprintSamrt attendance system using fingerprint
Samrt attendance system using fingerprintpraful borad
 
Tai lieu ky thuat lap trinh
Tai lieu ky thuat lap trinhTai lieu ky thuat lap trinh
Tai lieu ky thuat lap trinhHồ Trường
 
C Programming :- An Example
C Programming :- An Example C Programming :- An Example
C Programming :- An Example Atit Gaonkar
 
include.docx
include.docxinclude.docx
include.docxNhiPtaa
 
Home automation system
Home automation system Home automation system
Home automation system Hira Shaukat
 
Senior design project code for PPG
Senior design project code for PPGSenior design project code for PPG
Senior design project code for PPGFrankDin1
 
Operating system and embedded systems
Operating system and embedded systemsOperating system and embedded systems
Operating system and embedded systemsgayatrigayu1
 
54602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee0108310154602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee01083101premrings
 

Similar to Lab programs FOR 8TH SEM EC SUBJECT BY LOHITH KUMAR |11GUEE6018 (20)

codings related to avr micro controller
codings related to avr micro controllercodings related to avr micro controller
codings related to avr micro controller
 
Microcontroladores: programas de CCS Compiler.docx
Microcontroladores: programas de CCS Compiler.docxMicrocontroladores: programas de CCS Compiler.docx
Microcontroladores: programas de CCS Compiler.docx
 
Two digit-countdown-timer
Two digit-countdown-timerTwo digit-countdown-timer
Two digit-countdown-timer
 
C# Assignmet Help
C# Assignmet HelpC# Assignmet Help
C# Assignmet Help
 
8051 -5
8051 -58051 -5
8051 -5
 
ARM 7 LPC 2148 lecture
ARM 7 LPC 2148 lectureARM 7 LPC 2148 lecture
ARM 7 LPC 2148 lecture
 
COA_remaining_lab_works_077BCT033.pdf
COA_remaining_lab_works_077BCT033.pdfCOA_remaining_lab_works_077BCT033.pdf
COA_remaining_lab_works_077BCT033.pdf
 
Microsoft Word Hw#1
Microsoft Word   Hw#1Microsoft Word   Hw#1
Microsoft Word Hw#1
 
Lập trình C
Lập trình CLập trình C
Lập trình C
 
Samrt attendance system using fingerprint
Samrt attendance system using fingerprintSamrt attendance system using fingerprint
Samrt attendance system using fingerprint
 
Tai lieu ky thuat lap trinh
Tai lieu ky thuat lap trinhTai lieu ky thuat lap trinh
Tai lieu ky thuat lap trinh
 
C Programming :- An Example
C Programming :- An Example C Programming :- An Example
C Programming :- An Example
 
include.docx
include.docxinclude.docx
include.docx
 
Home automation system
Home automation system Home automation system
Home automation system
 
Senior design project code for PPG
Senior design project code for PPGSenior design project code for PPG
Senior design project code for PPG
 
C++ assignment
C++ assignmentC++ assignment
C++ assignment
 
Asssignment2
Asssignment2 Asssignment2
Asssignment2
 
Operating system and embedded systems
Operating system and embedded systemsOperating system and embedded systems
Operating system and embedded systems
 
54602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee0108310154602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee01083101
 
VERILOG CODE
VERILOG CODEVERILOG CODE
VERILOG CODE
 

More from UVCE

Mathematics new syallbus copy by Lohith 11guee6018
Mathematics new syallbus copy by Lohith 11guee6018Mathematics new syallbus copy by Lohith 11guee6018
Mathematics new syallbus copy by Lohith 11guee6018UVCE
 
3rd 4th-sem-be-syllabus-lohith -11 guee6018
3rd 4th-sem-be-syllabus-lohith -11 guee60183rd 4th-sem-be-syllabus-lohith -11 guee6018
3rd 4th-sem-be-syllabus-lohith -11 guee6018UVCE
 
8 th sem syllabus
8 th sem syllabus8 th sem syllabus
8 th sem syllabusUVCE
 
UVCE ELECTRONICS AND COMMUNICATION 7th SEM SYLLABUS BY LOHITH KUMAR R 11GUEE...
UVCE ELECTRONICS AND COMMUNICATION 7th SEM SYLLABUS BY LOHITH  KUMAR R 11GUEE...UVCE ELECTRONICS AND COMMUNICATION 7th SEM SYLLABUS BY LOHITH  KUMAR R 11GUEE...
UVCE ELECTRONICS AND COMMUNICATION 7th SEM SYLLABUS BY LOHITH KUMAR R 11GUEE...UVCE
 
20150128162345995 OFC LAB EXPRIMENT FOR 8TH SEM STUDENTS AT UVCE
20150128162345995 OFC LAB EXPRIMENT FOR 8TH SEM STUDENTS AT UVCE20150128162345995 OFC LAB EXPRIMENT FOR 8TH SEM STUDENTS AT UVCE
20150128162345995 OFC LAB EXPRIMENT FOR 8TH SEM STUDENTS AT UVCEUVCE
 
20150128163727950 ofc LAB EXPERIMENT CKT FOR 8TH SEM STUDENTS
20150128163727950 ofc LAB EXPERIMENT CKT FOR 8TH SEM STUDENTS 20150128163727950 ofc LAB EXPERIMENT CKT FOR 8TH SEM STUDENTS
20150128163727950 ofc LAB EXPERIMENT CKT FOR 8TH SEM STUDENTS UVCE
 
How to work in keil software FOR 8TH SEM EC STUDENTS UVCE BY LOHITH |11GUEE6018
How to work in keil software FOR 8TH SEM EC STUDENTS UVCE BY LOHITH |11GUEE6018How to work in keil software FOR 8TH SEM EC STUDENTS UVCE BY LOHITH |11GUEE6018
How to work in keil software FOR 8TH SEM EC STUDENTS UVCE BY LOHITH |11GUEE6018UVCE
 
8th sem subject Optical fiber communications by gerd keiser uploaded by Lohit...
8th sem subject Optical fiber communications by gerd keiser uploaded by Lohit...8th sem subject Optical fiber communications by gerd keiser uploaded by Lohit...
8th sem subject Optical fiber communications by gerd keiser uploaded by Lohit...UVCE
 
OFC problems for 8th sem Students UVCE
OFC problems for 8th sem Students UVCE OFC problems for 8th sem Students UVCE
OFC problems for 8th sem Students UVCE UVCE
 
8th Sem Subject Ofc 8th chapter notes by Lohith kumar 11GUEE6018
8th Sem Subject Ofc 8th chapter notes by Lohith kumar 11GUEE60188th Sem Subject Ofc 8th chapter notes by Lohith kumar 11GUEE6018
8th Sem Subject Ofc 8th chapter notes by Lohith kumar 11GUEE6018UVCE
 
8th Sem Subject Ofc 3rd chapter notes by Lohith kumar 11GUEE6018
8th Sem Subject Ofc 3rd chapter notes by Lohith kumar 11GUEE60188th Sem Subject Ofc 3rd chapter notes by Lohith kumar 11GUEE6018
8th Sem Subject Ofc 3rd chapter notes by Lohith kumar 11GUEE6018UVCE
 
8th Sem Subject OFC 2nd chapter notes by Lohith kumar 11GUEE6018
8th Sem Subject OFC 2nd chapter notes by Lohith kumar 11GUEE60188th Sem Subject OFC 2nd chapter notes by Lohith kumar 11GUEE6018
8th Sem Subject OFC 2nd chapter notes by Lohith kumar 11GUEE6018UVCE
 
8th Sem Subject Ofc1st chapter notes by Lohith kumar 11GUEE6018
8th Sem Subject Ofc1st chapter notes by Lohith kumar 11GUEE60188th Sem Subject Ofc1st chapter notes by Lohith kumar 11GUEE6018
8th Sem Subject Ofc1st chapter notes by Lohith kumar 11GUEE6018UVCE
 
EC(UVCE) 8th sem syllabus copy form lohith kumar 11guee6018
EC(UVCE) 8th sem syllabus copy form lohith kumar 11guee6018EC(UVCE) 8th sem syllabus copy form lohith kumar 11guee6018
EC(UVCE) 8th sem syllabus copy form lohith kumar 11guee6018UVCE
 
EC(UVCE) 7th sem syllabus copy form lohith kumar 11guee6018
EC(UVCE) 7th sem syllabus copy form lohith kumar 11guee6018EC(UVCE) 7th sem syllabus copy form lohith kumar 11guee6018
EC(UVCE) 7th sem syllabus copy form lohith kumar 11guee6018UVCE
 
EC(UVCE) 6th sem syllabus copy form lohith kumar 11guee6018
EC(UVCE) 6th sem syllabus copy form lohith kumar 11guee6018EC(UVCE) 6th sem syllabus copy form lohith kumar 11guee6018
EC(UVCE) 6th sem syllabus copy form lohith kumar 11guee6018UVCE
 
BU (UVCE)5th Sem Electronics syllabus copy from Lohith kumar R
BU (UVCE)5th Sem Electronics syllabus copy from Lohith kumar R BU (UVCE)5th Sem Electronics syllabus copy from Lohith kumar R
BU (UVCE)5th Sem Electronics syllabus copy from Lohith kumar R UVCE
 

More from UVCE (17)

Mathematics new syallbus copy by Lohith 11guee6018
Mathematics new syallbus copy by Lohith 11guee6018Mathematics new syallbus copy by Lohith 11guee6018
Mathematics new syallbus copy by Lohith 11guee6018
 
3rd 4th-sem-be-syllabus-lohith -11 guee6018
3rd 4th-sem-be-syllabus-lohith -11 guee60183rd 4th-sem-be-syllabus-lohith -11 guee6018
3rd 4th-sem-be-syllabus-lohith -11 guee6018
 
8 th sem syllabus
8 th sem syllabus8 th sem syllabus
8 th sem syllabus
 
UVCE ELECTRONICS AND COMMUNICATION 7th SEM SYLLABUS BY LOHITH KUMAR R 11GUEE...
UVCE ELECTRONICS AND COMMUNICATION 7th SEM SYLLABUS BY LOHITH  KUMAR R 11GUEE...UVCE ELECTRONICS AND COMMUNICATION 7th SEM SYLLABUS BY LOHITH  KUMAR R 11GUEE...
UVCE ELECTRONICS AND COMMUNICATION 7th SEM SYLLABUS BY LOHITH KUMAR R 11GUEE...
 
20150128162345995 OFC LAB EXPRIMENT FOR 8TH SEM STUDENTS AT UVCE
20150128162345995 OFC LAB EXPRIMENT FOR 8TH SEM STUDENTS AT UVCE20150128162345995 OFC LAB EXPRIMENT FOR 8TH SEM STUDENTS AT UVCE
20150128162345995 OFC LAB EXPRIMENT FOR 8TH SEM STUDENTS AT UVCE
 
20150128163727950 ofc LAB EXPERIMENT CKT FOR 8TH SEM STUDENTS
20150128163727950 ofc LAB EXPERIMENT CKT FOR 8TH SEM STUDENTS 20150128163727950 ofc LAB EXPERIMENT CKT FOR 8TH SEM STUDENTS
20150128163727950 ofc LAB EXPERIMENT CKT FOR 8TH SEM STUDENTS
 
How to work in keil software FOR 8TH SEM EC STUDENTS UVCE BY LOHITH |11GUEE6018
How to work in keil software FOR 8TH SEM EC STUDENTS UVCE BY LOHITH |11GUEE6018How to work in keil software FOR 8TH SEM EC STUDENTS UVCE BY LOHITH |11GUEE6018
How to work in keil software FOR 8TH SEM EC STUDENTS UVCE BY LOHITH |11GUEE6018
 
8th sem subject Optical fiber communications by gerd keiser uploaded by Lohit...
8th sem subject Optical fiber communications by gerd keiser uploaded by Lohit...8th sem subject Optical fiber communications by gerd keiser uploaded by Lohit...
8th sem subject Optical fiber communications by gerd keiser uploaded by Lohit...
 
OFC problems for 8th sem Students UVCE
OFC problems for 8th sem Students UVCE OFC problems for 8th sem Students UVCE
OFC problems for 8th sem Students UVCE
 
8th Sem Subject Ofc 8th chapter notes by Lohith kumar 11GUEE6018
8th Sem Subject Ofc 8th chapter notes by Lohith kumar 11GUEE60188th Sem Subject Ofc 8th chapter notes by Lohith kumar 11GUEE6018
8th Sem Subject Ofc 8th chapter notes by Lohith kumar 11GUEE6018
 
8th Sem Subject Ofc 3rd chapter notes by Lohith kumar 11GUEE6018
8th Sem Subject Ofc 3rd chapter notes by Lohith kumar 11GUEE60188th Sem Subject Ofc 3rd chapter notes by Lohith kumar 11GUEE6018
8th Sem Subject Ofc 3rd chapter notes by Lohith kumar 11GUEE6018
 
8th Sem Subject OFC 2nd chapter notes by Lohith kumar 11GUEE6018
8th Sem Subject OFC 2nd chapter notes by Lohith kumar 11GUEE60188th Sem Subject OFC 2nd chapter notes by Lohith kumar 11GUEE6018
8th Sem Subject OFC 2nd chapter notes by Lohith kumar 11GUEE6018
 
8th Sem Subject Ofc1st chapter notes by Lohith kumar 11GUEE6018
8th Sem Subject Ofc1st chapter notes by Lohith kumar 11GUEE60188th Sem Subject Ofc1st chapter notes by Lohith kumar 11GUEE6018
8th Sem Subject Ofc1st chapter notes by Lohith kumar 11GUEE6018
 
EC(UVCE) 8th sem syllabus copy form lohith kumar 11guee6018
EC(UVCE) 8th sem syllabus copy form lohith kumar 11guee6018EC(UVCE) 8th sem syllabus copy form lohith kumar 11guee6018
EC(UVCE) 8th sem syllabus copy form lohith kumar 11guee6018
 
EC(UVCE) 7th sem syllabus copy form lohith kumar 11guee6018
EC(UVCE) 7th sem syllabus copy form lohith kumar 11guee6018EC(UVCE) 7th sem syllabus copy form lohith kumar 11guee6018
EC(UVCE) 7th sem syllabus copy form lohith kumar 11guee6018
 
EC(UVCE) 6th sem syllabus copy form lohith kumar 11guee6018
EC(UVCE) 6th sem syllabus copy form lohith kumar 11guee6018EC(UVCE) 6th sem syllabus copy form lohith kumar 11guee6018
EC(UVCE) 6th sem syllabus copy form lohith kumar 11guee6018
 
BU (UVCE)5th Sem Electronics syllabus copy from Lohith kumar R
BU (UVCE)5th Sem Electronics syllabus copy from Lohith kumar R BU (UVCE)5th Sem Electronics syllabus copy from Lohith kumar R
BU (UVCE)5th Sem Electronics syllabus copy from Lohith kumar R
 

Recently uploaded

Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxdhanalakshmis0310
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 

Recently uploaded (20)

Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 

Lab programs FOR 8TH SEM EC SUBJECT BY LOHITH KUMAR |11GUEE6018

  • 1. Buzzer: #include <lpc214x.h> #define BUZZER_ON() IO1CLR=(1<<25) #define BUZZER_OFF() IO1SET=(1<<25) #define Count 100 void Buzzer_Delay(unsigned char j); void Buzzer_Delay(unsigned char j) { unsigned int i; for(;j>0;j--) { for(i=0; i<60000; i++); } } int main(void) { PINSEL0 = 0x0000000; PINSEL1 = 0x00000000; PINSEL2 = 0x00000000; IO1DIR = (1<<25) ; while(1) { BUZZER_ON(); Buzzer_Delay(Count); BUZZER_OFF(); } }
  • 2. LCD: #include "lcd.h" unsigned char Name[]="MyName"; unsigned char Surname[] = "Surname"; int main (void) { init_lcd(); lcd_putstring(0,Name); lcd_putstring(1,Surname); while (1) ; } -------------------------------not required to write if not asked for it------------------------------------------- #ifndef _LCD_H #define _LCD_H #define MAX_CHAR_IN_ONE_LINE 16 enum ROW_NUMBERS { LINE1, LINE2 }; void init_lcd(void); void lcd_putstring(unsigned char line, char *string); void lcd_clear(void); void lcd_backlight_on(void); int lcd_gotoxy(unsigned int x, unsigned int y); void lcd_putchar(int c); #endif
  • 3. Down counter: #include<p24fj128ga010.h> _CONFIG1( JTAGEN_OFF & GCP_OFF & GWRP_OFF & COE_OFF & FWDTEN_OFF & ICS_PGx2) _CONFIG2( FCKSM_CSDCMD & OSCIOFNC_OFF & POSCMOD_XT & FNOSC_PRI) void delay(); int main(void) { unsigned int b=255; TRISA = 0x0000; while(1) { PORTA=b; delay(); delay(); b--; if (!b) { delay(); delay(); delay(); delay(); b = 255; } } }
  • 4. void delay() { long int x; for(x=0;x<90000;x++); } UP counter: #include<p24fj128ga010.h> _CONFIG1( JTAGEN_OFF & GCP_OFF & GWRP_OFF & COE_OFF & FWDTEN_OFF & ICS_PGx2) _CONFIG2( FCKSM_CSDCMD & OSCIOFNC_OFF & POSCMOD_XT & FNOSC_PRI) void delay(); int main(void) { unsigned int b=1; TRISA = 0x0000; while(1) { PORTA=b; delay(); delay(); b++; if (!b) { delay();
  • 5. delay(); delay(); delay(); b = 0x0000; } } } void delay() { long int x; for(x=0;x<90000;x++); } Left shift: #include<p24fj128ga010.h> _CONFIG1( JTAGEN_OFF & GCP_OFF & GWRP_OFF & COE_OFF & FWDTEN_OFF & ICS_PGx2) _CONFIG2( FCKSM_CSDCMD & OSCIOFNC_OFF & POSCMOD_XT & FNOSC_PRI) #define init_count 1 void delay(); unsigned int counter; int main(void) { int i; TRISA = 0x0000; counter = init_count;
  • 6. while(1) { for(i=0;i<8;i++) { PORTA=counter; delay(); counter = counter << 1; } counter = 1; } } void delay() { long int x; for(x=0;x<90000;x++); } Right shift: #include<p24fj128ga010.h> _CONFIG1( JTAGEN_OFF & GCP_OFF & GWRP_OFF & COE_OFF & FWDTEN_OFF & ICS_PGx2) _CONFIG2( FCKSM_CSDCMD & OSCIOFNC_OFF & POSCMOD_XT & FNOSC_PRI) #define init_count 128 void delay(); unsigned int counter; int main(void)
  • 7. { int i; TRISA = 0x0000; counter = init_count; while(1) { for(i=0;i<8;i++) { PORTA=counter; delay(); counter = counter >> 1; } counter = 128; } } void delay() { long int x; for(x=0;x<60000;x++); } Voltage converter/ADC: #include<p24fj128ga010.h> _CONFIG1( JTAGEN_OFF & GCP_OFF & GWRP_OFF & COE_OFF & FWDTEN_OFF & ICS_PGx2) _CONFIG2( FCKSM_CSDCMD & OSCIOFNC_OFF & POSCMOD_XT & FNOSC_PRI)
  • 8. #define init_count 128 int main(void) { unsigned int ADC_Result; TRISA = 0x0000; AD1CON1 = 0x80E4; AD1CON2 = 0; AD1CON3 = 0x1F05; AD1CHS = 5; TRISBbits.TRISB2 = 1; TRISBbits.TRISB3 = 1; AD1PCFGbits.PCFG5 = 0; AD1CSSL = 0; AD1CON1bits.ADON = 1; while (1) { while(!AD1CON1bits.DONE); ADC_Result = (long) ADC1BUF0; ADC_Result >>= 7; PORTA = (0x80 >> ADC_Result); } }
  • 9. Note: Device specific keywords in the program for ex: PORTA or TRISA etc are case sensitive. Take care to ensure the cases in the program while executing.