SlideShare a Scribd company logo
Lab 8: 20 points
EE 337: Microprocessors Laboratory (Spring 2021)
Section: S2 (Third year UG)
Indian Institute of Technology Bombay
Date: March 19, 2021
Refer to Prof. Dinesh Sharma’s slides and notes on serial peripheral interface (SPI) to do
this lab.
1. [20 points] In this lab session, you will use the serial port interface (SPI) to interface an
analog-to-digital converter (ADC) MCP3008 with the 8051 micro-controller. The MCP3008
is part of the lab kit. You will use this setup to measure temperature using an LM35 sensor,
which is also part of the lab kit.
Use the given main.c, spi.c, mcp3008.h and lcd.h to complete this lab.
i) The micro-controller is to be configured for serial communication with the ADC
MCP3008. Complete the function spi init in spi.c to configure the SPI so that
the microcontroller is the master and the ADC is the slave.
ii) You will next test the ADC setup using a potential divider circuit (series of resistors
provided in the kit can be connected between supply and ground terminals) as shown
in Fig 1. By varying the point at which the output is taken, voltages ranging from 0 to
3.3 volts can be obtained as output. As shown this output is connected to CH0 of the
ADC. By compiling the project and running the code on the Pt-51 kit, the measured
output voltage will be displayed on the LCD in the format shown.
Volt.: 03229 mV
Verify that the displayed voltage corresponds to the potential divider circuit’s resistor
values.
Figure 1: Pt51 interfacing with ADC and potential divider.
iii) Once the ADC setup is verified using the potential divider circuit, it can be used for
sensing and displaying the temperature in ◦C. Connect the sensor output to CH7 of the
ADC as shown in Fig. 2. This setup measures the voltage output from the sensor and
displays the measured room temperature on the LCD. The output provided by the
sensor is 10mV/◦C . Uncomment and update the relevant sections in main.c, compile
the code and run it on the Pt51 kit. The room temperature will be displayed on the
second row of the LCD as shown. Verify that this value matches approximately your
room temperature. The first row will continue to display the voltage corresponding to
the potential divider circuit’s output.
Volt.: 03229 mV
Temp.: xxx.x oC
Figure 2: Pt51 interfacing with ADC and temperature sensor.
TA Checkpoints
1. Verify that the student can demonstrate the SPI setup to measure the output of the
potential divider circuit.
2. Verify that the student can demonstrate the SPI setup to measure the room temperature.

More Related Content

What's hot

Pt 51 kit - Peripheral self-test
Pt 51 kit - Peripheral self-testPt 51 kit - Peripheral self-test
Pt 51 kit - Peripheral self-test
rajbabureliance
 
8051 Interrupts
8051 Interrupts8051 Interrupts
8051 Interrupts
SaravananVijayakumar4
 
Lab7 s2
Lab7 s2Lab7 s2
8051 Timers
8051 Timers8051 Timers
Lab3 s1
Lab3 s1Lab3 s1
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
Sivaranjan Goswami
 
Serial IO for 8051
Serial IO for 8051Serial IO for 8051
Serial IO for 8051
SaravananVijayakumar4
 
Intel Hex Format
Intel Hex FormatIntel Hex Format
Intel Hex Format
SaravananVijayakumar4
 
EE 337 Lab 1 for Section 1 (2nd year UG)
 EE 337 Lab 1 for Section 1 (2nd year UG) EE 337 Lab 1 for Section 1 (2nd year UG)
EE 337 Lab 1 for Section 1 (2nd year UG)
SaravananVijayakumar4
 
Lab2 s2
Lab2 s2Lab2 s2
Lab5 s1
Lab5 s1Lab5 s1
Csa ic
Csa icCsa ic
Csa ic
PCTE
 
ControlLogix Timers FA16
ControlLogix Timers FA16ControlLogix Timers FA16
ControlLogix Timers FA16
John Todora
 
Node finder presentation
Node finder presentationNode finder presentation
Node finder presentation
Varun Varshney
 
Temperature sensor with raspberry pi
Temperature sensor with raspberry piTemperature sensor with raspberry pi
Temperature sensor with raspberry pi
Santosh Kumar Kar
 
Counters ibrahem
Counters ibrahemCounters ibrahem
Counters ibrahem
Ibranoz1990
 
Class9
Class9Class9

What's hot (18)

Pt 51 kit - Peripheral self-test
Pt 51 kit - Peripheral self-testPt 51 kit - Peripheral self-test
Pt 51 kit - Peripheral self-test
 
8051 Interrupts
8051 Interrupts8051 Interrupts
8051 Interrupts
 
Lab7 s2
Lab7 s2Lab7 s2
Lab7 s2
 
8051 Timers
8051 Timers8051 Timers
8051 Timers
 
Lab3 s1
Lab3 s1Lab3 s1
Lab3 s1
 
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
 
Serial IO for 8051
Serial IO for 8051Serial IO for 8051
Serial IO for 8051
 
Intel Hex Format
Intel Hex FormatIntel Hex Format
Intel Hex Format
 
EE 337 Lab 1 for Section 1 (2nd year UG)
 EE 337 Lab 1 for Section 1 (2nd year UG) EE 337 Lab 1 for Section 1 (2nd year UG)
EE 337 Lab 1 for Section 1 (2nd year UG)
 
Jp
Jp Jp
Jp
 
Lab2 s2
Lab2 s2Lab2 s2
Lab2 s2
 
Lab5 s1
Lab5 s1Lab5 s1
Lab5 s1
 
Csa ic
Csa icCsa ic
Csa ic
 
ControlLogix Timers FA16
ControlLogix Timers FA16ControlLogix Timers FA16
ControlLogix Timers FA16
 
Node finder presentation
Node finder presentationNode finder presentation
Node finder presentation
 
Temperature sensor with raspberry pi
Temperature sensor with raspberry piTemperature sensor with raspberry pi
Temperature sensor with raspberry pi
 
Counters ibrahem
Counters ibrahemCounters ibrahem
Counters ibrahem
 
Class9
Class9Class9
Class9
 

Similar to Lab8 s2

ENG3104 Engineering Simulations and Computations Semester 2, 2.docx
ENG3104 Engineering Simulations and Computations Semester 2, 2.docxENG3104 Engineering Simulations and Computations Semester 2, 2.docx
ENG3104 Engineering Simulations and Computations Semester 2, 2.docx
YASHU40
 
IMPLEMENTING A DIGITAL MULTIMETER
IMPLEMENTING A DIGITAL MULTIMETERIMPLEMENTING A DIGITAL MULTIMETER
IMPLEMENTING A DIGITAL MULTIMETER
Vijay Elavunkal
 
Simulation of 3 bit Flash ADC in 0.18μmTechnology using NG SPICE Tool for Hig...
Simulation of 3 bit Flash ADC in 0.18μmTechnology using NG SPICE Tool for Hig...Simulation of 3 bit Flash ADC in 0.18μmTechnology using NG SPICE Tool for Hig...
Simulation of 3 bit Flash ADC in 0.18μmTechnology using NG SPICE Tool for Hig...
ijsrd.com
 
Electical Power Subsystem _CDR.pptx
Electical Power Subsystem _CDR.pptxElectical Power Subsystem _CDR.pptx
Electical Power Subsystem _CDR.pptx
Aldi Walai
 
510 277-283
510 277-283510 277-283
510 277-283
idescitation
 
Automated Air Cooled Three Level Inverter system using Arduino
Automated Air Cooled Three Level Inverter system using ArduinoAutomated Air Cooled Three Level Inverter system using Arduino
Automated Air Cooled Three Level Inverter system using Arduino
IJEEE
 
FPGA Implementation with Digital Devices
FPGA Implementation with Digital Devices FPGA Implementation with Digital Devices
FPGA Implementation with Digital Devices
Sachin Mehta
 
IJSRED-V2I5P32
IJSRED-V2I5P32IJSRED-V2I5P32
IJSRED-V2I5P32
IJSRED
 
506 267-276
506 267-276506 267-276
506 267-276
idescitation
 
TRANSFORMER FAULT DETECTION AND MONITORING
TRANSFORMER FAULT DETECTION AND MONITORINGTRANSFORMER FAULT DETECTION AND MONITORING
TRANSFORMER FAULT DETECTION AND MONITORING
IRJET Journal
 
lesson2.ppsx
lesson2.ppsxlesson2.ppsx
lesson2.ppsx
SivaSankar306103
 
Study and Development of Temperature & Humidity monitoring system through Wir...
Study and Development of Temperature & Humidity monitoring system through Wir...Study and Development of Temperature & Humidity monitoring system through Wir...
Study and Development of Temperature & Humidity monitoring system through Wir...
IJERA Editor
 
Temperature Controlled Fan Report
Temperature Controlled Fan ReportTemperature Controlled Fan Report
Temperature Controlled Fan ReportPeeyush Pashine
 
HOME AUTOMATION SYSTEM DESIGN USING ROUND ROBIN SCHEDULING ALGORITHM
HOME AUTOMATION SYSTEM DESIGN USING ROUND ROBIN SCHEDULING ALGORITHMHOME AUTOMATION SYSTEM DESIGN USING ROUND ROBIN SCHEDULING ALGORITHM
HOME AUTOMATION SYSTEM DESIGN USING ROUND ROBIN SCHEDULING ALGORITHM
IRJET Journal
 
project - Copy
project - Copyproject - Copy
project - Copypiedaholic
 
Dynometer project data acquisition filtering
Dynometer project data acquisition filteringDynometer project data acquisition filtering
Dynometer project data acquisition filtering
Ra'uf Tailony
 
Electric Circuits Lab Series RC Circuits Phase Angle, Phase Lag.docx
Electric Circuits Lab Series RC Circuits Phase Angle, Phase Lag.docxElectric Circuits Lab Series RC Circuits Phase Angle, Phase Lag.docx
Electric Circuits Lab Series RC Circuits Phase Angle, Phase Lag.docx
pauline234567
 
Designing Of Time and Power Efficient Model for Controlling Of Critical Process
Designing Of Time and Power Efficient Model for Controlling Of Critical ProcessDesigning Of Time and Power Efficient Model for Controlling Of Critical Process
Designing Of Time and Power Efficient Model for Controlling Of Critical Process
International Journal of Engineering Inventions www.ijeijournal.com
 
Beme lab-manual new (3) (1)2323
Beme lab-manual new (3) (1)2323Beme lab-manual new (3) (1)2323
Beme lab-manual new (3) (1)2323
ptv
 

Similar to Lab8 s2 (20)

ENG3104 Engineering Simulations and Computations Semester 2, 2.docx
ENG3104 Engineering Simulations and Computations Semester 2, 2.docxENG3104 Engineering Simulations and Computations Semester 2, 2.docx
ENG3104 Engineering Simulations and Computations Semester 2, 2.docx
 
IMPLEMENTING A DIGITAL MULTIMETER
IMPLEMENTING A DIGITAL MULTIMETERIMPLEMENTING A DIGITAL MULTIMETER
IMPLEMENTING A DIGITAL MULTIMETER
 
Simulation of 3 bit Flash ADC in 0.18μmTechnology using NG SPICE Tool for Hig...
Simulation of 3 bit Flash ADC in 0.18μmTechnology using NG SPICE Tool for Hig...Simulation of 3 bit Flash ADC in 0.18μmTechnology using NG SPICE Tool for Hig...
Simulation of 3 bit Flash ADC in 0.18μmTechnology using NG SPICE Tool for Hig...
 
Electical Power Subsystem _CDR.pptx
Electical Power Subsystem _CDR.pptxElectical Power Subsystem _CDR.pptx
Electical Power Subsystem _CDR.pptx
 
510 277-283
510 277-283510 277-283
510 277-283
 
Automated Air Cooled Three Level Inverter system using Arduino
Automated Air Cooled Three Level Inverter system using ArduinoAutomated Air Cooled Three Level Inverter system using Arduino
Automated Air Cooled Three Level Inverter system using Arduino
 
FPGA Implementation with Digital Devices
FPGA Implementation with Digital Devices FPGA Implementation with Digital Devices
FPGA Implementation with Digital Devices
 
IJSRED-V2I5P32
IJSRED-V2I5P32IJSRED-V2I5P32
IJSRED-V2I5P32
 
506 267-276
506 267-276506 267-276
506 267-276
 
Lab burner
Lab burnerLab burner
Lab burner
 
TRANSFORMER FAULT DETECTION AND MONITORING
TRANSFORMER FAULT DETECTION AND MONITORINGTRANSFORMER FAULT DETECTION AND MONITORING
TRANSFORMER FAULT DETECTION AND MONITORING
 
lesson2.ppsx
lesson2.ppsxlesson2.ppsx
lesson2.ppsx
 
Study and Development of Temperature & Humidity monitoring system through Wir...
Study and Development of Temperature & Humidity monitoring system through Wir...Study and Development of Temperature & Humidity monitoring system through Wir...
Study and Development of Temperature & Humidity monitoring system through Wir...
 
Temperature Controlled Fan Report
Temperature Controlled Fan ReportTemperature Controlled Fan Report
Temperature Controlled Fan Report
 
HOME AUTOMATION SYSTEM DESIGN USING ROUND ROBIN SCHEDULING ALGORITHM
HOME AUTOMATION SYSTEM DESIGN USING ROUND ROBIN SCHEDULING ALGORITHMHOME AUTOMATION SYSTEM DESIGN USING ROUND ROBIN SCHEDULING ALGORITHM
HOME AUTOMATION SYSTEM DESIGN USING ROUND ROBIN SCHEDULING ALGORITHM
 
project - Copy
project - Copyproject - Copy
project - Copy
 
Dynometer project data acquisition filtering
Dynometer project data acquisition filteringDynometer project data acquisition filtering
Dynometer project data acquisition filtering
 
Electric Circuits Lab Series RC Circuits Phase Angle, Phase Lag.docx
Electric Circuits Lab Series RC Circuits Phase Angle, Phase Lag.docxElectric Circuits Lab Series RC Circuits Phase Angle, Phase Lag.docx
Electric Circuits Lab Series RC Circuits Phase Angle, Phase Lag.docx
 
Designing Of Time and Power Efficient Model for Controlling Of Critical Process
Designing Of Time and Power Efficient Model for Controlling Of Critical ProcessDesigning Of Time and Power Efficient Model for Controlling Of Critical Process
Designing Of Time and Power Efficient Model for Controlling Of Critical Process
 
Beme lab-manual new (3) (1)2323
Beme lab-manual new (3) (1)2323Beme lab-manual new (3) (1)2323
Beme lab-manual new (3) (1)2323
 

More from rajbabureliance

Lab7 s1
Lab7 s1Lab7 s1
Lab7 s1
Lab7 s1Lab7 s1
Lab3 s2
Lab3 s2Lab3 s2
Lab3 s2
Lab3 s2Lab3 s2
Lab2 s1
Lab2 s1Lab2 s1
EE337 Course Introduction
EE337 Course IntroductionEE337 Course Introduction
EE337 Course Introduction
rajbabureliance
 
EE337 Course Introduction
EE337 Course IntroductionEE337 Course Introduction
EE337 Course Introduction
rajbabureliance
 

More from rajbabureliance (7)

Lab7 s1
Lab7 s1Lab7 s1
Lab7 s1
 
Lab7 s1
Lab7 s1Lab7 s1
Lab7 s1
 
Lab3 s2
Lab3 s2Lab3 s2
Lab3 s2
 
Lab3 s2
Lab3 s2Lab3 s2
Lab3 s2
 
Lab2 s1
Lab2 s1Lab2 s1
Lab2 s1
 
EE337 Course Introduction
EE337 Course IntroductionEE337 Course Introduction
EE337 Course Introduction
 
EE337 Course Introduction
EE337 Course IntroductionEE337 Course Introduction
EE337 Course Introduction
 

Recently uploaded

The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 

Recently uploaded (20)

The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 

Lab8 s2

  • 1. Lab 8: 20 points EE 337: Microprocessors Laboratory (Spring 2021) Section: S2 (Third year UG) Indian Institute of Technology Bombay Date: March 19, 2021 Refer to Prof. Dinesh Sharma’s slides and notes on serial peripheral interface (SPI) to do this lab. 1. [20 points] In this lab session, you will use the serial port interface (SPI) to interface an analog-to-digital converter (ADC) MCP3008 with the 8051 micro-controller. The MCP3008 is part of the lab kit. You will use this setup to measure temperature using an LM35 sensor, which is also part of the lab kit. Use the given main.c, spi.c, mcp3008.h and lcd.h to complete this lab. i) The micro-controller is to be configured for serial communication with the ADC MCP3008. Complete the function spi init in spi.c to configure the SPI so that the microcontroller is the master and the ADC is the slave. ii) You will next test the ADC setup using a potential divider circuit (series of resistors provided in the kit can be connected between supply and ground terminals) as shown in Fig 1. By varying the point at which the output is taken, voltages ranging from 0 to 3.3 volts can be obtained as output. As shown this output is connected to CH0 of the ADC. By compiling the project and running the code on the Pt-51 kit, the measured output voltage will be displayed on the LCD in the format shown. Volt.: 03229 mV Verify that the displayed voltage corresponds to the potential divider circuit’s resistor values. Figure 1: Pt51 interfacing with ADC and potential divider. iii) Once the ADC setup is verified using the potential divider circuit, it can be used for sensing and displaying the temperature in ◦C. Connect the sensor output to CH7 of the ADC as shown in Fig. 2. This setup measures the voltage output from the sensor and displays the measured room temperature on the LCD. The output provided by the sensor is 10mV/◦C . Uncomment and update the relevant sections in main.c, compile
  • 2. the code and run it on the Pt51 kit. The room temperature will be displayed on the second row of the LCD as shown. Verify that this value matches approximately your room temperature. The first row will continue to display the voltage corresponding to the potential divider circuit’s output. Volt.: 03229 mV Temp.: xxx.x oC Figure 2: Pt51 interfacing with ADC and temperature sensor. TA Checkpoints 1. Verify that the student can demonstrate the SPI setup to measure the output of the potential divider circuit. 2. Verify that the student can demonstrate the SPI setup to measure the room temperature.