0% found this document useful (0 votes)
14 views7 pages

Marks Teacher's Signature With Date: WWW - Mitwpu.edu - in

The document outlines an experiment for programming the on-chip ADC of the C8051F340 microcontroller, detailing the aim, apparatus, theory, hardware connections, and a sample C program. It includes instructions for setting up the hardware and programming the ADC to convert analog signals to digital values, which are then displayed on a HyperTerminal. The conclusion emphasizes the learning outcomes related to ADC programming and usage on the development board.

Uploaded by

Krish Shah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views7 pages

Marks Teacher's Signature With Date: WWW - Mitwpu.edu - in

The document outlines an experiment for programming the on-chip ADC of the C8051F340 microcontroller, detailing the aim, apparatus, theory, hardware connections, and a sample C program. It includes instructions for setting up the hardware and programming the ADC to convert analog signals to digital values, which are then displayed on a HyperTerminal. The conclusion emphasizes the learning outcomes related to ADC programming and usage on the development board.

Uploaded by

Krish Shah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

S. Y. B.

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

Marks Teacher’s Signature with date


Performed on: 11/05/22

Submitted on: 18/05/22

Aim: Write C program for programming of on chip ADC of C8051F340.

Apparatus: EPBF340 Board, ASK25 board, Connectors

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);
}

void delay(unsigned int Ms)


{
unsigned int n;
unsigned int i;
for (n=0; n < Ms; n++)
{
for (i=0; i < 2500; i++);
}
}

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

You might also like