Pic16f690 ADC with LM35 temperature sensor

Thread Starter

Krentin018

Joined Mar 27, 2016
4
Hi, I am making a thermometer using the LM35 interfaced to the pic16f690 for a school project using the assembly language. The temperature in degrees Celsius needs to be displayed on two multiplexed seven segment displays.

I am using MPLABX with the PicKit 3 to program the MCU and simulator to debug. I am having trouble with the ADC of the LM35, the result stored in ADRESL and ADRESH stays at 0 and does not change. In the simulator ADRESL and ADRESH does not update with changing voltage from the LM35, but I have noticed that it only changes the moment the simulation is paused, when resumed thereafter the registers do not update until the simulator is paused again.

Apart from the ADC issue the rest of the code has been tested and verified working.

I am using AN0 as the analogue input, VDD for reference voltage, PortC to display on the SSD's, RB4 and RB5 to multiplex and Fosc/4.

Thanks in advance:)
 

Attachments

atferrari

Joined Jan 6, 2004
3,452
For your particular micro, check if ADC is actually simulated. In fact, for any new micro always check what MPSIM does not simulate.
 
Last edited:

AlbertHall

Joined Jun 4, 2014
8,364
You must set up a stimulus file for the ADC input.
For a quick testing method you could add code after the ADC 'measurement' is complete to write your desired values to ADRESL and ADRESH.
 

Thread Starter

Krentin018

Joined Mar 27, 2016
4
For your particular micro, check if DC is actually simulated. In fact, for any new micro always check what MPSIM does not simulate.
I am new to Pic programming so i'm not so sure how to do that but it does accept the analogue input correctly but just not during its runtime or on the chip.

You must set up a stimulus file for the ADC input.
For a quick testing method you could add code after the ADC 'measurement' is complete to write your desired values to ADRESL and ADRESH.
I have tested with some values of ADRESL and ADRESH (on chip as well) and the rest of the code does what it should be doing, the problem is with the actual conversion.
 
Top