SlideShare a Scribd company logo
2
Most read
4
Most read
Interfacing diagram:
Code:
#include<stdio.h>
#include "LPC1768_Includes.h"
void hextoASCII(int myValue);
int main()
{
unsigned int rx;
PINSEL3 = 0xC0000000; // configure port 1 for ADC input p1.31
PCONP = 1 << 12; // A/D converter (ADC) power/clock control bit.
AD0CR = 0x01200220; // A/D Control Register, SEL, CLKDIV, BURST bit
AD0GDR = 0x05000000; // A/D Global Data Register
while((AD0GDR & 0x80000000)!=0x80000000); //check done bit conversion
rx=(AD0GDR & 0x0000FFF0);
rx = rx >>4;
hextoASCII(rx);
}
void hextoASCII(int myValue) //hex to ascii conversion
{
unsigned int i, d1, d2,d3,d4;
d1 = myValue% 0x0A;
d1 = d1 | 0x30;
d2 = (myValue/0x0A) % 0x0A;
d2 = d2 | 0x30;
d3 = (myValue/0x0A/0x0A)% 0x0A;
d3 = d3 | 0x30;
d4 = (myValue/0x0A/0x0A/0x0A)% 0x0A;
d4 = d4 | 0x30;
//UART0 configuration
PINSEL0=0x00000050;
PCONP=0x08;
U0FCR = 0x07;
U0LCR = 0x83;
U0DLL = 0x75;
U0DLM = 0x00;
U0LCR = 0x03;
U0TER = 0x80;
while(1)
{ //transmitting bit by bit
while(!(U0LSR & 0x20));
U0THR=d4;
for(i=0;i<255;i++);
while(!(U0LSR & 0x20));
U0THR=d3;
for(i=0;i<255;i++);
while(!(U0LSR & 0x20));
U0THR=d2;
for(i=0;i<255;i++);
while(!(U0LSR & 0x20));
U0THR=d1;
for(i=0;i<255;i++);
while(!(U0LSR & 0x20));
U0THR=' ';
for(i=0;i<255;i++);
}
}
Calculations:
Step size=
𝑉𝑟𝑒𝑓
2 𝑛 =
3.3
212= 8.056641 x 10−4
Vout=
𝑉𝑖𝑛
𝑆𝑡𝑒𝑝 𝑠𝑖𝑧𝑒
Observation Table:
Vin (volts) Vout (Therotical) Vout (hex) Vout (decimal)
1 1241.212 0x04D9 1241
1.5 1861.818 0x0745 1861
2 2482.590 0x09B2 2482
2.5 3103.042 0x0C1F 3103
3 3723.636 0x0E8B 3723
3.3 4095.999 0x0FFF 4095
Output:
1V
1.5 V
2V
2.5 V
3V
3.3V

More Related Content

PDF
UVM REF GUIDE (1).pdf
PDF
SFO15-TR9: PSCI, ACPI (and UEFI to boot)
PDF
Verilog lab mauual
PDF
Spectre(v1%2 fv2%2fv4) v.s. meltdown(v3)
PPT
Fundamentals of FPGA
PPTX
Introduction to armv8 aarch64
PDF
CPU Verification
PDF
LCA13: Power State Coordination Interface
UVM REF GUIDE (1).pdf
SFO15-TR9: PSCI, ACPI (and UEFI to boot)
Verilog lab mauual
Spectre(v1%2 fv2%2fv4) v.s. meltdown(v3)
Fundamentals of FPGA
Introduction to armv8 aarch64
CPU Verification
LCA13: Power State Coordination Interface

What's hot (20)

DOCX
Design of Elevator Controller using Verilog HDL
ODP
axi protocol
PDF
44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick
PDF
SPI Protocol in LPC2148
PPT
Verilog Tasks and functions
PDF
Understanding a kernel oops and a kernel panic
PPTX
QEMU - Binary Translation
PDF
UVM TUTORIAL;
PDF
Session 8,9 PCI Express
PDF
Boost UDP Transaction Performance
PPTX
Verilog presentation final
PPTX
Introduction to System verilog
PDF
Microcontroller pic 16f877 architecture and basics
DOC
Kb64 Reversal Of Reposted Line Item
PDF
POWER10 innovations for HPC
PPTX
AMBA BUS.pptx
PDF
Machinekit - Build Real Time Systems with Python
PDF
Mass update for asset master shut down activation process steps
PDF
Note - (EDK2) Acpi Tables Compile and Install
PPT
Verilog tutorial
Design of Elevator Controller using Verilog HDL
axi protocol
44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick
SPI Protocol in LPC2148
Verilog Tasks and functions
Understanding a kernel oops and a kernel panic
QEMU - Binary Translation
UVM TUTORIAL;
Session 8,9 PCI Express
Boost UDP Transaction Performance
Verilog presentation final
Introduction to System verilog
Microcontroller pic 16f877 architecture and basics
Kb64 Reversal Of Reposted Line Item
POWER10 innovations for HPC
AMBA BUS.pptx
Machinekit - Build Real Time Systems with Python
Mass update for asset master shut down activation process steps
Note - (EDK2) Acpi Tables Compile and Install
Verilog tutorial
Ad

Similar to ADC (Analog to Digital conversion) using LPC 1768 (20)

DOCX
Microcontroladores: programas de CCS Compiler.docx
DOCX
codings related to avr micro controller
DOCX
Direct analog
PPTX
Vechicle accident prevention using eye bilnk sensor ppt
PPTX
LCD_Example.pptx
PDF
An Example MIPS
PDF
Analog To Digital Conversion (ADC) Programming in LPC2148
PPTX
Sensors and Actuators in Arduino, Introduction
TXT
PIC and LCD
PDF
Combine the keypad and LCD codes in compliance to the following requ.pdf
DOCX
Uart
PDF
04 adc (pic24, ds pic with dma)
PDF
Program LCD ARM
PDF
Functions for Nano 5 Card
PPTX
131080111003 mci
PPTX
Linux Serial Driver
PPTX
Programming A Robot Using
PPTX
26. 8255 control word programming
PPTX
PPTX
STM_ADC para microcontroladores STM32 - Conceptos basicos
Microcontroladores: programas de CCS Compiler.docx
codings related to avr micro controller
Direct analog
Vechicle accident prevention using eye bilnk sensor ppt
LCD_Example.pptx
An Example MIPS
Analog To Digital Conversion (ADC) Programming in LPC2148
Sensors and Actuators in Arduino, Introduction
PIC and LCD
Combine the keypad and LCD codes in compliance to the following requ.pdf
Uart
04 adc (pic24, ds pic with dma)
Program LCD ARM
Functions for Nano 5 Card
131080111003 mci
Linux Serial Driver
Programming A Robot Using
26. 8255 control word programming
STM_ADC para microcontroladores STM32 - Conceptos basicos
Ad

More from Omkar Rane (20)

PDF
Enabling SSL Elasticsearch on server
PDF
Anti lock braking (ABS) Model based Design in MATLAB-Simulink
PPTX
Autosar fundamental
PPTX
Stress Management
PPTX
Bootloaders (U-Boot)
PPTX
Concept of Diversity & Fading (wireless communication)
PPTX
Tata Motors GDC .LTD Internship
PDF
Machine Learning Model for M.S admissions
PDF
Timer 0 programming on LPC 1768
PDF
PWM based motor speed control using LPC 1768
PDF
UART interfacing on LPC1768 (Cortex M3 micro controller)
PDF
LED Blinking logic on LPC1768
PDF
CAN interfacing on LPC1768 (ARM Cortex M3 based Micro controller)
PPTX
Vlisi Course project presentation:Keypad Scanner
PDF
VlSI course project report : Keypad Scanner
PPTX
LPC 1768 A study on Real Time clock features
PDF
Nexys4ddr rm FPGA board Datasheet
PDF
Linear Regression (Machine Learning)
DOCX
transmission gate based design for 2:1 Multiplexer in micro-wind
DOCX
2:1 Multiplexer using NAND gate in Microwind
Enabling SSL Elasticsearch on server
Anti lock braking (ABS) Model based Design in MATLAB-Simulink
Autosar fundamental
Stress Management
Bootloaders (U-Boot)
Concept of Diversity & Fading (wireless communication)
Tata Motors GDC .LTD Internship
Machine Learning Model for M.S admissions
Timer 0 programming on LPC 1768
PWM based motor speed control using LPC 1768
UART interfacing on LPC1768 (Cortex M3 micro controller)
LED Blinking logic on LPC1768
CAN interfacing on LPC1768 (ARM Cortex M3 based Micro controller)
Vlisi Course project presentation:Keypad Scanner
VlSI course project report : Keypad Scanner
LPC 1768 A study on Real Time clock features
Nexys4ddr rm FPGA board Datasheet
Linear Regression (Machine Learning)
transmission gate based design for 2:1 Multiplexer in micro-wind
2:1 Multiplexer using NAND gate in Microwind

Recently uploaded (20)

PPTX
Geodesy 1.pptx...............................................
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
DOCX
573137875-Attendance-Management-System-original
PPTX
Construction Project Organization Group 2.pptx
PDF
PPT on Performance Review to get promotions
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
Digital Logic Computer Design lecture notes
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
Strings in CPP - Strings in C++ are sequences of characters used to store and...
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Geodesy 1.pptx...............................................
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
573137875-Attendance-Management-System-original
Construction Project Organization Group 2.pptx
PPT on Performance Review to get promotions
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
UNIT-1 - COAL BASED THERMAL POWER PLANTS
bas. eng. economics group 4 presentation 1.pptx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Digital Logic Computer Design lecture notes
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
Model Code of Practice - Construction Work - 21102022 .pdf
Lesson 3_Tessellation.pptx finite Mathematics
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Foundation to blockchain - A guide to Blockchain Tech
Strings in CPP - Strings in C++ are sequences of characters used to store and...
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx

ADC (Analog to Digital conversion) using LPC 1768

  • 1. Interfacing diagram: Code: #include<stdio.h> #include "LPC1768_Includes.h" void hextoASCII(int myValue); int main() { unsigned int rx; PINSEL3 = 0xC0000000; // configure port 1 for ADC input p1.31 PCONP = 1 << 12; // A/D converter (ADC) power/clock control bit. AD0CR = 0x01200220; // A/D Control Register, SEL, CLKDIV, BURST bit AD0GDR = 0x05000000; // A/D Global Data Register
  • 2. while((AD0GDR & 0x80000000)!=0x80000000); //check done bit conversion rx=(AD0GDR & 0x0000FFF0); rx = rx >>4; hextoASCII(rx); } void hextoASCII(int myValue) //hex to ascii conversion { unsigned int i, d1, d2,d3,d4; d1 = myValue% 0x0A; d1 = d1 | 0x30; d2 = (myValue/0x0A) % 0x0A; d2 = d2 | 0x30; d3 = (myValue/0x0A/0x0A)% 0x0A; d3 = d3 | 0x30; d4 = (myValue/0x0A/0x0A/0x0A)% 0x0A; d4 = d4 | 0x30; //UART0 configuration PINSEL0=0x00000050; PCONP=0x08; U0FCR = 0x07;
  • 3. U0LCR = 0x83; U0DLL = 0x75; U0DLM = 0x00; U0LCR = 0x03; U0TER = 0x80; while(1) { //transmitting bit by bit while(!(U0LSR & 0x20)); U0THR=d4; for(i=0;i<255;i++); while(!(U0LSR & 0x20)); U0THR=d3; for(i=0;i<255;i++); while(!(U0LSR & 0x20)); U0THR=d2; for(i=0;i<255;i++); while(!(U0LSR & 0x20)); U0THR=d1; for(i=0;i<255;i++); while(!(U0LSR & 0x20)); U0THR=' '; for(i=0;i<255;i++); } }
  • 4. Calculations: Step size= 𝑉𝑟𝑒𝑓 2 𝑛 = 3.3 212= 8.056641 x 10−4 Vout= 𝑉𝑖𝑛 𝑆𝑡𝑒𝑝 𝑠𝑖𝑧𝑒 Observation Table: Vin (volts) Vout (Therotical) Vout (hex) Vout (decimal) 1 1241.212 0x04D9 1241 1.5 1861.818 0x0745 1861 2 2482.590 0x09B2 2482 2.5 3103.042 0x0C1F 3103 3 3723.636 0x0E8B 3723 3.3 4095.999 0x0FFF 4095 Output: 1V