Incubadora

Buenas noches quisiera que me ayuden en un proyecto ( MIKROC , DHT11, PIC16F877A,que estoy haciendo, se trata de una incubadora, la cuestión que tengo avanzado hasta la lectura de la temperatura y la humedad , pero en la programación de la condicional para el encendido , apagado del ventilador y la calefacción creo que estoy haciéndolo mal por que se quedan en off las dos salidas.
 

Adjuntos

  • manejoDHT11.rar
    40 KB · Visitas: 24
Buenas noches quisiera que me ayuden en un proyecto ( MIKROC , DHT11, PIC16F877A,que estoy haciendo, se trata de una incubadora, la cuestión que tengo avanzado hasta la lectura de la temperatura y la humedad , pero en la programación de la condicional para el encendido , apagado del ventilador y la calefacción creo que estoy haciéndolo mal por que se quedan en off las dos salidas.
hola amigo, hace mucho tiempo publique una incubadora ,la cual maneja humedad y por supuesto temperatura,control de movimiento etc,todo es programable,voy a dejar aca la carpeta y el video de como se programa todo,el video es un poquito largo quizas pero sirve para poder programarla, es 100% funcional,no tiene errores, es todo de mi autoria asique cualquier cosa se puede modificar algo que alguien crea necesario
PD: devido a que la carpeta es muy grande subo toda la info en 3 carpetas mas chicas , asique el que la arme que publique como le va ..incubadora
aca dejo el archivo BAS


Código:
'****************************************************************

'*  Name    : incu.BAS                                          *

'*  Author  : [Richard Alonso]                                  *

'*  Notice  : Copyright (c) 2017 [select VIEW...EDITOR OPTIONS] *

'*          : All Rights Reserved                               *

'*  Date    : 11/11/2018                                        *

'*  Version : 1.3                                               *

'*  Notes   :pic 162628a (DHT-11)                               *

'*          :                                                   *

'****************************************************************

cmcon = 7

define LCD_DREG   PORTB   

DEFINE LCD_DBIT 0       

DEFINE LCD_RSREG PORTA

DEFINE LCD_RSBIT 4

DEFINE LCD_EREG PORTB

DEFINE LCD_EBIT 4

DEFINE LCD_BITS 4

DEFINE LCD_LINES 4

define osc 8

dht var byte[32]

humedad var byte

haut var byte

bas var byte

temp var byte

x var byte

dht11 var portb.7

led1_hum var porta.1

led2_temp var porta.0

sumo var porta.2

resto var porta.3

ok var portb.6

valor_temp var byte

valor_hum var byte



TIEMPO VAR word

tiempoh var tiempo.HighByte

tiempol var tiempo.lowbyte

M VAR BYTE   'para el motor

m = 0

tiempo_2 var word

tiempo_2 = 0

MOTOR VAR PORTB.5

segundos var byte

segundos =0

suma var byte

suma =0

aumento var word

aumento =0

p var byte

p = 0

R VAR BYTE

R = 50

read 0,valor_hum

read 1,valor_temp

READ 2,TIEMPO

read 3,tiempoh

read 4,tiempol

read 5,segundos                                                               

READ 6, TIEMPO_2                             

pause 500





salto:

low motor

low led1_hum

low led2_temp

r = r -1

lcdout $fe,$2,"MODO AUTOMATICO ~ ",DEC r,32         

LCDOUT $FE,$C0,"PARA INICIAR AJUSTES "

LCDOUT $FE, $94, "PRECIONE TECLA OK"





if ok = 0 then voy

if r =< 0 then LIMPIO

pause 250



goto salto



voy:

lcdout $fe,$1

pause 10



ajuste_hum:

if ok = 0 then voy

if sumo = 0 then

valor_hum = valor_hum + 1

pause 50

endif

if resto = 0 then

valor_hum = valor_hum -1

endif

pause 50

if valor_hum=> 90 then

valor_hum =90

endif

if valor_hum =< 20 then

valor_hum = 20

endif

write 0,valor_hum

pause 100

if ok = 0 then espero_1

lcdout $fe,$2,"Ajuste Humedad ",dec valor_hum,"%",32,32



goto ajuste_hum



espero_1:

if ok = 0 then espero_1

LCDOUT $FE,$1

pause 500



ajuste_temp:



if sumo =0 then

valor_temp = valor_temp + 1

pause 50

endif

if resto = 0 then

valor_temp = valor_temp -1

endif

pause 50

if valor_temp => 50 then

valor_temp =50

endif

if valor_temp =< 0 then

valor_temp = 0

endif

write 1,valor_temp

pause 100

if ok = 0 then espero_2

lcdout $fe,$2," Ajuste Temp  ",dec valor_temp,"c·",32



goto ajuste_temp



espero_2:

if ok = 0 then espero_2

LCDOUT $FE,$1

pause 500





AJUSTE_TIEMPO:



if sumo =0 then

TIEMPO = TIEMPO + 720

TIEMPO_2= TIEMPO_2 +1

pause 50

endif

if resto = 0 then          'MAXIMO DE ESPERA 6 HORAS

TIEMPO = TIEMPO - 720

TIEMPO_2 = TIEMPO_2 -1

endif

pause 50

if (tiempo_2 > 6) or (tiempo >4321) then

lcdout $fe,$1

tiempo =0

TIEMPO_2 =0

endif

if tiempo_2 =< 1 then

tiempo = 720

TIEMPO_2 =1

endif

write 2,TIEMPO

write 3,tiempoh

write 4,tiempol

WRITE 6,TIEMPO_2

pause 100

if ok = 0 then espero_3

lcdout $fe,$2,"Movimiento Bandeja "

lcdout $fe,$c0,"Cada ~ ",DEC Tiempo_2," Hs",32

goto ajuste_tiempo



espero_3:

if ok = 0 then espero_3

lcdout $fe,$1

pause 150



ajuste_segundos:



if sumo =0 then

segundos = segundos + 1

pause 50

endif

if resto = 0 then

segundos = segundos -1

endif

pause 50

if segundos > 60 then

segundos =0

endif

if segundos =< 0 then

segundos = 0

endif

write 5,segundos

pause 100

if ok = 0 then TEST

lcdout $fe,$2,"Mover Bandeja",32

lcdout $fe,$c0,"Durante ",dec segundos," Seg",32

LCDOUT $FE, $94, "TEST OPR y SUELTE OK"

LCDOUT $FE, $D4,"finalizar OK x5 seg"

m = 0

goto ajuste_segundos



TEST:



m = m +1

pause 500

if (ok = 0) and (m => 10) then

m = 0 :goto limpio

endif

  if ok = 0 then TEST



high motor

p = p +1

PAUSE 500

LCDOUT $FE,$2,"Prueba Motor "

lcdout $fe,$c0," segundos ~ ",dec p,32

IF p <= SEGUNDOS THEN TEST

low motor

p = 0

goto espero_3



LIMPIO:

LCDOUT $FE,$1

lcdout  $fe,$2," SISTEMA LISTO  "

LCDOUT 254,64,$1F,$1E,$1C,$10,$1C,$1E,$1F,$00 ;en esta linea esta el pacman                                                   

LCDOUT 254,72,$04,$15,$1F,$04,$0E,$1B,$11,$00 ;aca un muñeco

LCDOUT 254,80,$1F,$07,$03,$01,$03,$07,$1F,$00 ;otra ves el pacman

LCDOUT $FE, $C0, " ","     ",0,1,2,3

pause 3000



main:

pause 4000

r = 0

aumento = aumento + 1



read 0,valor_hum

pause 90

read 1,valor_temp

pause 90

read 2,tiempo

pause 90

read 3,tiempoh

read 4,tiempol

read 5,segundos

pause 90

READ 6,TIEMPO_2

PAUSE 90

if humedad < valor_hum then

high led1_hum

else

low led1_hum

endif

if temp < valor_temp then

high led2_temp

else

low led2_temp

endif



TRISB.7 = 0 'portb.7 = salida

dht11 = 1 ' lo pongo en  1

pause 500 ' espera medio segundo

dht11 = 0 : pause 25 ' enviar 20ms bajo

dht11 = 1 : pauseus 40 'enviar 40us alto



PulsIn PORTB.7, 1, haut  'respuesta del dht-11

if haut < 15 then goto main



for x = 31 to 0 step-1 'captura de 8 bits enter humedad

PulsIN PORTB.7, 1, dht[x] ' 1

next x



For x = 31 to 0 step-1 'conversion en 1 o 0: 14 o 5

if dht[x] > 9 then

dht[x]=1 'parte décimal de la temperatura siempre a 0

else

dht[x]=0

endif

next x



humedad=dht[31]*128+dht[30]*64+dht[29]*32+dht[28]*16+dht[27]*8+dht[26]*4+dht[25]*2+dht[24]*1

temp=dht[15]*128+ dht[14]*64+dht[13]*32+dht[12]*16+dht[11]*8+dht[10]*4+dht[9]*2+dht[8]*1

LCDOUT $FE,$2,"Humedad = ",dec humedad,"% "

LCDOUT $FE,$C0,"Temperatura =",dec  temp,"·"     

LCDOUT $FE, $94," INCUBADORA DIGITAL "

LCDOUT $FE, $D4,"  RGA  22/11/2018   "

IF AUMENTO => TIEMPO THEN goto BANDEJA

goto main



BANDEJA:

lcdout $fe,$c0,"Moviendo Bandeja"

high motor

p = p + 1

pause 920

SUMA = 0

AUMENTO = 0

READ 5,SEGUNDOS

pause 80

if P <= segundos then bandeja



if p > segundos then

low motor

p =0

endif

LCDOUT $FE,$1

PAUSE 10

goto main



;     Programa de libre distribucion,escrito en basic (pbp)

;     serviceelectronica@hotmail.com richard  alonso (minas uruguay )

;

;                       ____   ____    ____

;                      |    | |       |    |

;                      |___/  |  __   |____|

;                      |\     |    |  |    |

;                              ----

;                      whatsapp +59895058979
 

Adjuntos

  • 1.rar
    3.9 MB · Visitas: 33
  • 2.rar
    5.2 MB · Visitas: 57
  • 3.rar
    5.2 MB · Visitas: 64
Última edición por un moderador:
Atrás
Arriba