Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A temprature sensor has the sensitivity of 0.01V/ 0 C. An optimal signal conditi

ID: 653559 • Letter: A

Question

A temprature sensor has the sensitivity of 0.01V/0C. An optimal signal conditioning circuit is used to connect it to a 10-bit unpolar ADC. The ADC had VRH = 5.0V and VRL=0.0V. The output consists of a two-digit seven segment display for a digital thermometer.

What are the statements in C programming language to calculate the display number(DisplayNumber) from the ADC results ( ConvResult) ? Show your calculation.

HINT: Find out what is the output range with a two digit displays then find out the output voltages of the sensor at the extremes of that range. Use the method in the question above to derive the gain and offset of the signal conditioning circuit. Pick to temperatures within the display range. Calculate the output voltages of the signal conditioning cirucit at these two temperatures. Estimate the conversion results of these two voltages. Calculate the parameters required for the C statement. If floating point math is used, the statment should have the form of DisplayNumber = ConvResult / X + Y;

Verify your answers by using a temperature within the display range.

Explanation / Answer

#define encoderPinA 2
#define encoderPinB 3
#define displayTXPin 10
#define displayRXPin 11
#include <stdio.h>
#include <NewSoftSerial.h>
NewSoftSerial displaySerial(displayRXPin, displayTXPin);

volatile unsigned int encoderPos = 0;

void setup()
{
pinMode(encoderPinA, INPUT);
pinMode(encoderPinB, INPUT);
attachInterrupt(0, readEncoderA, CHANGE);
attachInterrupt(1, readEncoderB, CHANGE);
  
pinMode(displayTXPin, OUTPUT);
displaySerial.begin(9600);
  
displaySerial.print("v");
  
displaySerial.print(0x7A, BYTE);
displaySerial.print(0x05, BYTE);
displaySerial.print("xxx0");
}
void loop()
{
displayNumber(encoderPos);
}


void displayNumber(int num)
{
char buf[4];
sprintf(buf, "%4d", num);
displaySerial.print(buf);
}

void readEncoderA()
{
if (digitalRead(encoderPinA) == HIGH)
{
encoderPos += (digitalRead(encoderPinB) == LOW)? 1: -1;
}
else
{
encoderPos += (digitalRead(encoderPinB) == HIGH)? 1: -1;
}
}
void readEncoderB()
{
if (digitalRead(encoderPinB) == HIGH)
{
encoderPos += (digitalRead(encoderPinA) == HIGH)? 1: -1;
}
else
{
encoderPos += (digitalRead(encoderPinA) == LOW)? 1: -1;
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote