Hi guys,
For my project I am building a mini-weather station, and a part of it includes using a thermal-resistance transducer and a PIC18F4550. For the moment, I do not have the thermometer, but my professor said that I can use a 10k Ohm potentiometer to simulate/calibrate it.
I asked my professor to help me get started, and this is what he said:

Right now, I have a 10k Ohm potentiometer hooked up to AN0, VDD, and GND. In addition, I have a 7-segment display so that I can see the temperature.
I am not sure what I am doing wrong, this is what I have:
Anyways, that's my attempt at this temperature probe. Thanks in advance for the help! 
For my project I am building a mini-weather station, and a part of it includes using a thermal-resistance transducer and a PIC18F4550. For the moment, I do not have the thermometer, but my professor said that I can use a 10k Ohm potentiometer to simulate/calibrate it.
I asked my professor to help me get started, and this is what he said:
So, after having done this, I'm going to you guys for help.You'll want to read Chapter 21 in the PIC18F4550 datasheet. The pins in the PIC's port 'A' (RA0, RA1, etc) which are connected to the switches and the J_ADC connector have alternate names/applications, e.g RA0=AN0, RA1=AN1 etc (see the pin diagram in the datasheet) so you will be physically connecting to those pins in their roles as AN0, etc. The ADC conversion data will be generated and controlled by the ADC registers as described in TAble 21-2 of the datasheet. Its pretty complicated, but you should be able to find some examples online that will help.
Right now, I have a 10k Ohm potentiometer hooked up to AN0, VDD, and GND. In addition, I have a 7-segment display so that I can see the temperature.
I am not sure what I am doing wrong, this is what I have:
Rich (BB code):
temp:
call temp_inits
bsf ADCON0,1,0 ; Start the Conversion
temp2 btfsc ADCON0,1,0 ; Wait for AD Conversion to Complete
bra temp2
movf ADRESH,0,0
dispW digit1 ; Displays contents of W(in hex)
movf ADRESL,0,0
dispW digit2
return
temp_inits:
movlw 0x1 ; Select AN0 and ADON = 1
movwf ADCON0
movlw 0x0 ; Enable Analog Input from AN0
movwf ADCON1
; ***** this parts pretty confusing for me
movlw 0xfb ; 20Tad, Frc (found ex and used same values)
movwf ADCON2
return
Last edited: