- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a sensor that outputs a voltage between 0 and 3V. When I use Delta Sigma, the reading from my PSoC is compared with a volt meter. The result is not the same as the volt meter, it may be off by 5-10 mV some times, but I just want to prove the concept, and I'm just glad that it has some reading.
However, when I remove the sensor, the reading still says 200mV instead of zero. What am I doing wrong?
Here is the code snippet of the sensor reading function:
void handleRead(uint8 *buf, uint8 len) {
int16 adcResult = 0;
int16 mVolts = 0;
if(ADC_IsEndConversion(ADC_RETURN_STATUS) != 0) {
adcResult = ADC_GetResult16();
if (((int16)adcResult) < 0) {
adcResult = 0u;
} else if (((int16)adcResult) > 16383) {
adcResult = 16383;
}
mVolts = ADC_CountsTo_mVolts(adcResult);
printf("sensor read: %d\n", mVolts);
}
memcpy(buf, &mVolts, len);
}
- Labels:
-
PSoC 5LP