I am using the PSoC 4000S device in a product I am working on and I need to use a thermistor to measure temperature. I do not see the thermistor component selection available in Creator for this device. Is this component not available in the PSoC 4000S? If it is not available how best can I use a thermistor on a 4000S device?
Unfortunately the thermistor component is not available for 4000s device. If you want to port the code please the thermistor.c file in a project with a supported PSoC4 device(eg: PSoC 4200). In the component you can obtain the temperature through Equation or LUT. The tradeoffs between the two methods are memory, speed, range, and resolution. The Equation method is more accurate and has a fixed range and accuracy. The Equation method uses more memory because it requires the floating point math library. The LUT uses less memory and has a faster response time. You can see how it is implemented in both cases.
I was able to get some great feed back from Motoo Tanaka and odissey1 but I am stuck on getting an actual ADC count reading on the 4000S. As i read the datasheet on the 4000S ADC component, the API only returns a mVolt value and not an actual ADC count value. I could calculate count using the LSB but I believe it would not be as accurate sense it involves Vref. It would be nice to utilize the components calibration ability, at least as i understand it. Anyway is there a way to get a ADC_count instead of a ADC_mVolt reading?
I will attach my work sheet i did for AD conversions that helps me to understand whats behind the hood, my be helpful to others.
Yes I tried it on my favorite prototyping board CY8KIT-043 that has a 4200M part on it and it works fine. My issue is i need to use the 4000S part that has the ADC_CSD for cost reasons. This particular part is only about 50 cents and this project is very cost sensitive!
I am presently stuck sense the API of the ADC_CSD only returns mV and not a count.
In my system my Vref or in this case as you call it VDDA is a bit shady. I am using a high voltage buck converter IC (HV9910) which has a built in reference so I can produce 4 to 5 volts (from 9V to 450V DC input voltage) to power my PSoC device for free. Its regulation is not the greatest based on the current from the PSoC and an indicator LED I need to use.
Anyway what do you think of me measuring the VDDA just prior to doing the thermistor measurement so my thermistor temperature would be more accurate. I don't need supper accuracy in this application I just need to do some thermal compensation by adjusting my PWM from my PSoC to on my Buck regulator IC.
Just before i left the office yesterday to head out to see my new granddaughter in Texas, which i am very excited to see! I was able with your help to get my thermistor routine running. I will attach a copy for review if you would like to see were I left off. I was able to add a measurement of VDDA to the routine. I also included the fast log calculation.
With the device i am suing i only have 16k of flash and had to remove the UART section of code so i could get it to run. I used the debugger to see if i was getting the correct readings on the CSD. I did not have time before i left to see how accurate the temperature is with the current code i was able to get running. My code writing skills are at a beginner level at best but i love learning. At this point i believe it should work well but i am very concerned about the memory it is taking up just to read my thermistor. In my project i also have to read battery voltage, a mode level pin as well has control the PWM on my buck converter and all the other code need to make it all operate properly. I can go to a 32k device if needed but i was hoping to use the 16k device.
Your mention of the thermistor calculator which I have reviewed does both a floating calculation and a table version calculation which uses a lot less memory. If i read that data sheet right that particular component uses the math to do a differential measurements of the voltages. The ADC_CSD does not have this ability. At the moment i am not sure how to do the math correct so i can do a simular approach using the ADC_CSD. I hope over the weekend to review the math so i can see if i can give this type of approach a go also. I have never done a table kind of table reading in C before so this should be interesting.
I want to thank you for your kind attention and time you have helped me ... Thank you very much.
Thermistor Test PSoC 4000S ADC_CSD_Fast_Log.cyprj.Archive01.zip