2 of 2 people found this helpful
Please refer to this tutorial which explains how to interface the thermistor in detail in Mbed ecosystem: https://iotexpert.com/2019/12/09/mouser-psoc-6-wifi-bt-mbed-l4-temperature-thread/
Let me know if you still the same issue.
So the ref voltage is 1.2V? That's confusing, how is the ADC able to measure up to 3.3V?
float refVoltage = thermOut.read() * 2.4; // Range of ADC 0->2*Vref float refCurrent = refVoltage / 10000.0; // 10k Reference Resistor float thermVoltage = 3.3 - refVoltage; // Assume supply voltage is 3.3v
I am just confused why they are scaling the input from the ADC by 2.4? That seems to be 2*Vref, but that would imply that it can only measure up to 2.4V, which would be strange for measuring a system that is driven by 3.3V. I guess in this case we can assume the voltage will never go above 2.4V... I just need some clarification on what Vref is, and what mbed is scaling its AnalogIn to.
1 of 1 people found this helpful
Please note that when you call read() it calls the HAL layers for the ADC block and we have some default configurations there due to which the range is (0 to 2*Vref) as shown below:
You can refer to the PDL documentation to understand what each of the macros mean.
We have explained more about the different configurations and how they affect the range in the component datasheet. You can refer that to understand more.
You can then modify the macros as per the requirement to get the desired range in the file "cyhal_adc.c"