I have been trying to read in values from the ADC of the Psoc 4700s, but I have not been successful with producing results. I am using the 10 bit ADC described in this datasheet, but I still can't find any tutorials using this ADC. In my code I start the ADC, Start Conversion, and read, but I am still not getting any values. Here is some code that I am using:

 uint16 val = ADC_ReadResult_mVolts(0u);

However in the debug mode I am receiving optimized_out for the value of val, but other variables have values so I know that the debugger is working.


Update: I looked up the problem for receiving optimized_out for values and it was because the compiler was optimized and seemed to change something with the variables when debugging. I turned off the compiler optimization and the ADC works now also I took out the second line of code above since it is called in the third line. I do plan on turning on the compiler optimization back on when I am done debugging though.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.