Marks Teacher's Signature With Date: WWW - Mitwpu.edu - in
Marks Teacher's Signature With Date: WWW - Mitwpu.edu - in
Tech (ECE)
Trimester: VI Subject: Microcontroller and Applications
Name: Adhish Vairagade Class: C
Roll No: 1032201793 Batch: C3
Experiment No: 06
Name of the Experiment: Programming of on chip ADC
Theory:
Analog to digital converter is among the most widely used device for data acquisition. It is used to convert
the analog signals to digital numbers so that microcontroller can read and process them.
On-chip ADC Features:
10-Bit ADC
Up to 200 ksps
Built-in analog multiplexer with single-ended and differential mode
VREF from external pin, internal reference, or VDD
Hardware Connections: Connect single lead wire between P2.5 (Pin15 of PL3 connector) of EPBF340 board
and Pin1 of PL10 connector of ASK25. To provide the ground also connect 20pin flat cable between PL6
connector of EBF340 board and PL8 connector of ASK25.
Connect USB cable between PL8 connector of EPBF340 board and PC.
F340 Reference Device ASK25
P2.5 (Pin15 of PL3 connector) Pin 1 of PL10 connector (Pot RV2)
P0.4 TXD
P0.5 RXD
www.mitwpu.edu.in
Program: Attach printout of the tested code.
//adhishvairagade
//Pin 2.5 as Analog
input #include
"c8051F340.h" #define
SYSCLK 12000000
void delay(unsigned int Ms);
void main()
{
OSCICN=0X83; //System Clock 12MHz
XBR1=0X40; //Enable Crossbar
P4MDOUT=0XFF; //P4 LED's connected make
o/p P2MDIN=0XDF; //P2.5 analog input
P2SKIP=0X20; //Skip P2.5
REF0CN=0X80; //Set VDD as refrence voltage
for ADC AMX0P=0X04; //P2.5 as ANIP+
AMX0N=0X1F; //Connect ANIP- to GRND for single ended
ADC ADC0CF=(((SYSCLK/3000000)-1)<<3);
AD0EN=1; //Enable ADC;
{
ADC0CN = 0X90;
while(AD0BUSY == 1);//give start of conversion
{}//EOC (wait for end of conversion)
delay(3000);
P4 =~ADC0L; //display `10 bit A/D value on
LED delay(3000);
P4 =~ADC0H;
delay(3000);
}
while(1);
}
Result:
Digital output should be observed on the HyperTerminal.
www.mitwpu.edu.in
Conclusion:
We have learnt how to program an ADC i.e. Analog to Digital Converter on Silicon Laboratory software for
C8051F340 , upload it on development board and obtain the output using usb bootloader on hyper terminal .
Study Question:
1. Give the main factor affecting the step size of ADC in C8051F340.
2. Give the formats for control registers associated with C8051F340 ADC.
Additional link:
https://www.silabs.com/documents/public/data-sheets/C8051F34x.pdf
www.mitwpu.edu.in
www.mitwpu.edu.in
www.mitwpu.edu.in
www.mitwpu.edu.in