- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello everyone, i'm trying to run this program, i don't know why, but i can't see none number in relation the temperature sensor. Someone help me!!!
Look at the image:
I'm trying to do this exercise:
The KIT GROVE temperature sensor is a thermistor (LM358 - a semiconductor
temperature sensitive) that can be used to measure temperature. The range of
The operation of the LM358 is -40 - 125 ° C with a sensitivity of ± 1.5 ° C.
Read the signal provided by the thermistor using an ADC and use the code below to map the
value in degrees Celsius. Send the result by serial
int an_read;
int VREFplus = 4095; // Voltage value VREF + => 2 ^ n - 1
float temperature;
int B = 3975; // constant B for resistance
// do the Analog Reading here and put the result in an_read
// get the resistance of the sensor
resistance = (float) (VREFplus-an_read) * 10000 / an_read;
// convert to temperature via datasheet
temperature = 1 / (log (resistance / 10000) /B+1/298.15) -273.15;
In the above code, "an_read" is the value read from the ADC and B is a constant obtained from the datasheet of
sensor.
Solved! Go to Solution.
- Labels:
-
PSoC 4 Architecture
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Would you read my post?
printf and float rhapsody (aka, yet another printf and floating topic)
moto
P.S.
> sprintf(strTEMP, "Temperature: %f \n\n", temperature);
< sprintf(strTEMP, "Temperature: %f \r\n", temperature);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Would you read my post?
printf and float rhapsody (aka, yet another printf and floating topic)
moto
P.S.
> sprintf(strTEMP, "Temperature: %f \n\n", temperature);
< sprintf(strTEMP, "Temperature: %f \r\n", temperature);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Moto