Estimado Dogflu66 saludos,
Nuevamente recurro a tu sabiduría, hace un tiempo te consulte por como poder hacer funcionar el sensor de Humedad y temperatura DHT22, al cual pudiste hacerlo funcionar bajo PSI, hasta la fecha satisfactoriamente esta funciona de maravilla, ha sido de apoyo para aplicaciones simples como medir temperatura y observarla dentro de la casa, y en uno que otro trabajo que he efectuado.
Ahora yendo al grano con la consulta estoy trabajando con un datalogger, para almacenar los datos utilizo un logger diseñado por sparkfun el cual permite utilizar una memoria MicroSd para guardar datos y que se cominica mediante RS232 con el pic18f4550, con este actual trabajo utilizo las entradas ADC pudiendo procesar los datos adquiridos desde sensores que trabajen de 0 a 5 VDC sin problemas, utilizo el rtc ds1307para las horas y hasta el sensor 1 wire ds18b20 sin complicaciones y eventualidades.
Sin embargo no todo puede ser color rosa, como antes te mencione te solicite ayuda para el DHT 22, mi problema es que al querer enviar los datos al logger de sparkfun los datos almacenados en la memoria micro SD se muestran como código ASCII y no los datos reales que en este caso seria la temperatura, hora y otros datos.
Te adjunto lo que pasa a ser mi programación y humildemente nuevamente te pido apoyo con respecto a solucionar este cacho que me tiene ya mucho tiempo sin poder resolver.
Saludos.
AllDigital
Define CLOCK_FREQUENCY = 20
'configuracion de parametros para dht22
CMCON = 0x07
OSCCON = 0x7e
Dim hr As Word
Dim tmp As Word
Dim chk As Word
TRISA.1 = 1 'entrada RHT03 inicio
WaitMs 100
Call _rht03ini(8)
WaitMs 2000
'configuracion canales analogicos
'ADCON1 = %00001010
'Dim adc As Word
'adc = 0
'configuracion de puerto
Symbol tx = PORTC.6
'configuracion puerto i2c
Symbol sda = PORTB.0
Symbol scl = PORTB.1
'configuracion parametros de reloj
Dim seg As Byte
Dim min As Byte
Dim hora As Byte
Dim daym As Byte
Dim dias As Byte
Dim mes As Byte
Dim anno As Byte
Dim seg1 As Byte
Dim min1 As Byte
Dim hora1 As Byte
Dim dias1 As Byte
Dim mes1 As Byte
Dim anno1 As Byte
Dim y As Word
'sincronizacion de reloj y toma de datos
Gosub lcd3
Gosub reloj_rtc
Gosub calculo1
Gosub calculo
While y > 0
y = y - 1
Gosub lcd
Wend
'termino sincronizacion salto a inicio y comienza trabajo datalogger
inicio:
Call _rht03read()
hr = _ped1(_rht03read.HW)
tmp = _ped1(_rht03read.LW)
chk = _rht03chk()
'Adcin 1, adc
Gosub reloj_rtc
Gosub lcd3
Gosub calculo1
If seg1 = 0 Or seg1 = 10 Or seg1 = 20 Or seg1 = 30 Or seg1 = 40 Or seg1 = 50 Then
Gosub enviar
Endif
Goto inicio
End
Include "humedad.bas"
Include "trabajando con bits.bas"
reloj_rtc:
I2CRead sda, scl, 0xd1, 0x00, seg
WaitMs 20
I2CRead sda, scl, 0xd1, 0x01, min
WaitMs 20
I2CRead sda, scl, 0xd1, 0x02, hora
WaitMs 20
I2CRead sda, scl, 0xd1, 0x03, daym
WaitMs 20
I2CRead sda, scl, 0xd1, 0x04, dias
WaitMs 20
I2CRead sda, scl, 0xd1, 0x05, mes
WaitMs 20
I2CRead sda, scl, 0xd1, 0x06, anno
WaitMs 20
Return
calculo1:
'conversion de hexa a decimal segundos
If seg >= 0 And seg <= 9 Then seg1 = seg
If seg >= 16 And seg <= 25 Then seg1 = seg - 6
If seg >= 32 And seg <= 41 Then seg1 = seg - 12
If seg >= 48 And seg <= 57 Then seg1 = seg - 18
If seg >= 64 And seg <= 73 Then seg1 = seg - 24
If seg >= 80 And seg <= 89 Then seg1 = seg - 30
'conversion de hexa a decimal minutos
If min >= 0 And min <= 9 Then min1 = min
If min >= 16 And min <= 25 Then min1 = min - 6
If min >= 32 And min <= 41 Then min1 = min - 12
If min >= 48 And min <= 57 Then min1 = min - 18
If min >= 64 And min <= 73 Then min1 = min - 24
If min >= 80 And min <= 89 Then min1 = min - 30
'conversion de hexa a decimal hora
If hora >= 0 And hora <= 9 Then hora1 = hora
If hora >= 16 And hora <= 25 Then hora1 = hora - 6
If hora >= 32 And hora <= 41 Then hora1 = hora - 12
'conversion de hexa a decimal dias
If dias >= 0 And dias <= 9 Then dias1 = dias
If dias >= 16 And dias <= 25 Then dias1 = dias - 6
If dias >= 32 And dias <= 41 Then dias1 = dias - 12
If dias >= 48 And dias <= 57 Then dias1 = dias - 18
'conversion de hexa A decimal mes
If mes >= 0 And mes <= 9 Then mes1 = mes
If mes >= 16 And mes <= 25 Then mes1 = mes - 6
'conversion de hexa a decimal año
If anno >= 0 And anno <= 9 Then anno1 = anno
If anno >= 16 And anno <= 25 Then anno1 = anno - 6
Return
calculo:
If min1 >= 0 And min1 <= 4 Then y = 300 - min1 * 60 - (60 - (63 - seg1))
If min1 >= 5 And min1 <= 9 Then y = 600 - min1 * 60 - (60 - (63 - seg1))
If min1 >= 10 And min1 <= 14 Then y = 900 - min1 * 60 - (60 - (63 - seg1))
If min1 >= 15 And min1 <= 19 Then y = 1200 - min1 * 60 - (60 - (63 - seg1))
If min1 >= 20 And min1 <= 24 Then y = 1500 - min1 * 60 - (60 - (63 - seg1))
If min1 >= 25 And min1 <= 29 Then y = 1800 - min1 * 60 - (60 - (63 - seg1))
If min1 >= 30 And min1 <= 34 Then y = 2100 - min1 * 60 - (60 - (63 - seg1))
If min1 >= 35 And min1 <= 39 Then y = 2400 - min1 * 60 - (60 - (63 - seg1))
If min1 >= 40 And min1 <= 44 Then y = 2700 - min1 * 60 - (60 - (63 - seg1))
If min1 >= 45 And min1 <= 49 Then y = 3000 - min1 * 60 - (60 - (63 - seg1))
If min1 >= 50 And min1 <= 54 Then y = 3300 - min1 * 60 - (60 - (63 - seg1))
If min1 >= 55 And min1 <= 59 Then y = 3600 - min1 * 60 - (60 - (63 - seg1))
Return
enviar:
Serout tx, 9600, #hora1
WaitMs 10
Serout tx, 9600, ":"
WaitMs 10
Serout tx, 9600, #min1
WaitMs 10
Serout tx, 9600, ":"
WaitMs 10
Serout tx, 9600, #seg1
WaitMs 10
Serout tx, 9600, ";"
WaitMs 10
Serout tx, 9600, #hr.HB
WaitMs 10
Serout tx, 9600, "."
WaitMs 10
Serout tx, 9600, #hr.LB
WaitMs 10
Serout tx, 9600, ";"
WaitMs 10
Serout tx, 9600, #tmp.HB
WaitMs 10
Serout tx, 9600, "."
WaitMs 10
Serout tx, 9600, #tmp.LB, CrLf
WaitMs 10
Return