Saludos a todos soy novato y siempre me ha apasionado la electronica, cuantos años que se ha perdido por no tener internet al vivir el el campo, que bien encontrar sitios como este para aprender y compartir experiencias.
Estoy intentando hacer mi segundo proyecto con un pic 18f4550 , que es para empezar hacer un controlador de temperatura y despues seguire con el modulo gsm de telefono por teclado, demasiado proyecto para un novato verdad y sin experiencia en programacion recien estoy empezando. Ahora he empezado ha estudiar la ecuacion para la linealizacion de la ntc, ya he compredido algo y ahi algunas calculadoras Steinhart-Hart Thermistor en internet.
Voy a empezar a ver si se puede cambiar Symbol thermistor = PORTA.0 y Symbol TestLED = PORTB.0 por registros para que funcione un lcd de dos lineas ,Declare LCD_Lines 2,Declare LCD_DTPin PORTB.0,Declare LCD_ENPin PORTB.5 ,Declare LCD_RSPin PORTB.4 ,que es como yo lo entiendo. Si alguien quiere participar gracias, asi aprendere mas rapido.
Aqui os dejo el codigo que he encontrado en internet . Calculo de ntc de 10k
Device 18F4550 'PIC Utilizado
Xtal = 4 'Oscilador de 4MHZ
'===== ALIAS DEFINITIONS =======================================================
Symbol Thermistor = PORTA.0 'Thermistor Divider Circuit input
Symbol TestLED = PORTB.0 'LED Used for various purposes
'===============================================================================
'FLOAT_DISPLAY_TYPE = FAST 'More accurate floating point to decimal routine
'===== VARIABLE DEFINITIONS ====================================================
Dim i As Word ' Create a generic Word size variable
Dim ThermistorInput_Adval As Word 'Variable to store the thermistor A to D value (0-1023)
Dim Steinhart_a As Float 'Thermistor Constant Values
Dim Steinhart_b As Float 'Thermistor Constant Values
Dim Steinhart_c As Float 'Thermistor Constant Values
Dim x0 As Float 'General Purpose variables used for for storage during calculations
Dim x1 As Float 'General Purpose variables used for for storage during calculations
Dim x2 As Float 'General Purpose variables used for for storage during calculations
Dim x3 As Float 'General Purpose variables used for for storage during calculations
Dim x4 As Float 'General Purpose variables used for for storage during calculations
Dim x5 As Float 'General Purpose variables used for for storage during calculations
Dim mV As Float 'Resolution * Adval
Dim mVolts As Float
Dim TEMPORARY As Float 'Temporary variable for the thermistor linearisation
Dim RESISTANCE As Float 'Holds the resistance of the thermistor for a given temperature
Dim lnResistance As Float 'Holds the "ln(Resistance)" value
Dim lnResistanceCubed As Float 'Holds the "ln(Resistance)³" value
Dim Kelvin As Float 'Holds the floating point temperature in degrees Kelvin
Dim Fahrenheit As Float 'Holds the floating point temperature in degrees Fahrenheit
Dim Celsius As Float 'Holds the floating point temperature in degrees Celsius
'===============================================================================
'===== CONSTANTS DEFINITIONS ===================================================
'Steinhart-Hart Algorithm Constants
'Constant values used for the Steinhart-Hart thermistor linearisation routine
'T = 1/ ( a + b(lnR) + c(lnR)³)
Steinhart_a = 0.001125498166 'Thermistor's a-value: From Data Sheet
Steinhart_b = 0.0002346771694 'Thermistor's b-value: From Data Sheet
Steinhart_c = 0.00000008579674698 'Thermistor's c-value: From Data Sheet
Symbol Vref = 3300.00 'Constant used for Vref
Symbol Resolution = Vref / 1024.00 'Quatasising constant for ADC reading to Voltage calculation
Symbol Resistor_value = 16900 'Value of Resistor in Resistor/Thermistor voltage divider circuit
'===============================================================================
'===== Main Loop ==============================================================
GetTemp:
GoSub GetAdval
GoSub ConvertAdvalToTemp
GoSub DisplayTemp
DelayMS 500
Return
'===============================================================================
'===== SUBROUTINE ==============================================================
GetAdval:
' Read the value from the Analogue to Digital Converter AN0
ThermistorInput_Adval = ADIn 0
Return
'===============================================================================
'===== SUBROUTINE ==============================================================
ConvertAdvalToTemp:
'Start Steinhart-Hart Linerization Algorithm
' FORMULA relating Thermistor Resistance to Temperature:
'[ T = 1/ ( a + b(lnR) + c(lnR)³) ]
'Where:
'T = Temp in Kelvin
'lnR = Natural Log of Resistance
'a, b & c, are Thermistor constants from data sheet
mV = Resolution * ThermistorInput_Adval
TEMPORARY = Vref - mV
x0 = Resolution * ThermistorInput_Adval
x1 = x0 * Resistor_value
RESISTANCE = x1 / TEMPORARY
'Start log calculation here
Calculate_lnResistance: '...Command not availible for 16F PICs
lnResistance = Log RESISTANCE 'Deduce the Natural Logarithm a value
'Continue Steinhart-Hart Algorithm
Steinhart_Hart_Algorithm:
x2 = lnResistance * lnResistance
lnResistanceCubed = lnResistance * x2
x3 = Steinhart_b * lnResistance
x4 = Steinhart_c * lnResistanceCubed
x5 = (Steinhart_a + x3 + x4)
Kelvin = 1 / x5
Celsius = Kelvin - 273.15
Fahrenheit = (Kelvin * 1.

- 459.67
'End of Steinhart-Hart Algorithm
Return
'===============================================================================
'===== SUBROUTINE ==============================================================
DisplayTemp: ' Transmit the result serially
HRSOut "Result (In Fahrenheit) = ", Dec1 Fahrenheit, 13,10 '13=CR & 10=LF
DelayMS 100
HRSOut "Result (In Celsius) = ", Dec1 Celsius, 13,10 '13=CR & 10=LF
DelayMS 100
HRSOut "Result (In Kelvin) = ", Dec1 Kelvin, 13,10,13,10 '13=CR & 10=LF
DelayMS 100
Return