'dosador de mistura à partri de ph d'agua '11-05-2016 'Claudio , Kleber symbol v1 = 0 symbol v2 = 1 symbol v3 = 2 symbol v4 = 3 symbol v5 = 4 symbol v6 = 5 symbol m1 = 6 symbol m2 = 7 symbol niv1 = pin0 symbol niv2 = pin1 symbol niv3 = pin2 symbol niv4 = pin3 symbol liga = pin4 symbol desliga = pin5 symbol contador = pin7 inicio:'inicia circuito dando condiçoes de liga e desliga low v1 low v2 low v3 low v4 low v5 low v6 low m1 if liga =1 and desliga =0 then 'liga goto ligado endif if liga = 1 and desliga = 1 then 'desliga goto inicio endif if liga =0 and desliga = 1 then 'dsliga goto inicio endif goto inicio ligado: low m2 low m1 low v1 low v2 low v3 low v4 low v5 low v6 if niv1 = 0 and niv2 = 0 then 'condições para agua rua(alimentador) goto rua endif if niv1 = 0 and niv2 = 1 then 'condições para agua rua(alimentador) goto rua endif if liga =0 and desliga = 1 then 'desliga goto inicio endif if liga =0 and desliga =0 then'desliga goto inicio endif if liga = 1 and desliga = 1 then 'desliga goto inicio endif if niv3=1 and niv4 = 1 then 'condiçoes para bomba de recalque goto bomba_recalque endif readadc 1,b6 ' condições para medição de ph if b6 < 110 then goto nutrientes1 endif if b6 >110 then goto nutrientes2 endif if b6 = 110 then b8 = 1 goto regador endif if liga =0 and desliga = 1 then 'desliga goto inicio endif if liga = 1 and desliga = 1 then 'desliga goto inicio endif base: low v5 if liga =0 and desliga = 1 then 'desliga goto inicio endif if liga = 1 and desliga = 1 then 'desliga goto inicio endif low v3 high v4 'liga valvula 4 com base high m1 ' liga motor do agitador pause 10000 if liga =0 and desliga = 1 then 'desliga goto inicio endif if liga = 1 and desliga = 1 then 'desliga goto inicio endif readadc 1,b6 ' condições para medição de ph if b6 < 110 then goto base endif if b6 >110 then goto acido endif if b6 = 110 then b8 = 1 goto regador 'envia para regador de acordo com medição de ph endif goto base acido: low v4 if liga =0 and desliga = 1 then 'desliga goto inicio endif if liga = 1 and desliga = 1 then 'desliga goto inicio endif low v3 'desliga valvula 3 com base high v5 'liga valvula 5 com acido high m1 'liga agitador pause 60000 if liga =0 and desliga = 1 then 'desliga goto inicio endif if liga = 1 and desliga = 1 then 'desliga goto inicio endif readadc 1,b6 ' condições para medição de ph if b6 >110 then goto acido endif if b6 < 110 then goto base endif if b6 = 110 then b8 = 1 goto regador'envia para regador de acordo com medição de ph endif goto acido nutrientes1: if liga =0 and desliga = 1 then 'desliga goto inicio endif if liga = 1 and desliga = 1 then 'desliga goto inicio endif high v3 pause 10000 if liga =0 and desliga = 1 then 'desliga goto inicio endif if liga = 1 and desliga = 1 then 'desliga goto inicio endif low v3 goto base 'envia para base após adição de nutrientes nutrientes2: if liga =0 and desliga = 1 then 'desliga goto inicio endif if liga = 1 and desliga = 1 then 'desliga goto inicio endif high v3 pause 10000 if liga =0 and desliga = 1 then 'desliga goto inicio endif if liga = 1 and desliga = 1 then 'desliga goto inicio endif low v3 goto acido'envia para acido após adição de nutrientes rua: if liga =0 and desliga = 1 then 'desliga goto inicio endif if liga = 1 and desliga = 1 then 'desliga goto inicio endif high v2 if niv1 = 1 and niv2 = 1 then goto ligado ' após verificação de nível 1 e 2=1 envia para subrotina ligado endif goto rua regador: if liga =0 and desliga = 1 then 'desliga goto inicio endif if liga = 1 and desliga = 1 then 'desliga goto inicio endif low v2 low v3 low v4 low v5 low v6 low m1 readadc 1,b6 ' condições para medição de ph if b6 >110 then goto acido endif if b6 < 110 then goto base endif if b6 = 110 then endif if liga =0 and desliga = 1 then 'desliga goto inicio endif if liga = 1 and desliga = 1 then 'desliga goto inicio endif goto ciclo if niv3 = 1 and niv4 =1 then goto bomba_recalque ' após verificação de nível 3 e 4 =1 envia para subrotina bomba_recalque endif ciclo: if liga =0 and desliga = 1 then 'desliga goto inicio endif if liga = 1 and desliga = 1 then 'desliga goto inicio endif low m2 if niv3 = 1 and niv4 =1 then goto bomba_recalque ' após verificação de nível 3 e 4 =1 envia para subrotina bomba_recalque endif if liga =0 and desliga = 1 then 'desliga goto inicio endif if liga = 1 and desliga = 1 then 'desliga goto inicio endif for b7 = b8 to 3 ' contador com 3 ciclos high v1 pause 5000 low v1 if liga =0 and desliga = 1 then 'desliga goto inicio endif if liga = 1 and desliga = 1 then 'desliga goto inicio endif if niv3 = 1 and niv4 = 1 then goto bomba_recalque ' após verificação de nível 3 e 4 =1 envia para subrotina bomba_recalque endif readadc 1,b6 ' condições para medição de ph if b6 >110 then goto acido endif if b6 < 110 then goto base endif if b6 = 110 then endif pause 10000 if liga =0 and desliga = 1 then 'desliga goto inicio endif if liga = 1 and desliga = 1 then 'desliga goto inicio endif b8 = b8 + 1 'condições para FOR b7 usando b8+1 ( for b7 = b8 to 3 ' contador com 3 ciclos) next b7 dreno: if liga =0 and desliga = 1 then 'desliga goto inicio endif if liga = 1 and desliga = 1 then 'desliga goto inicio endif high v6 'liga valvula 6 acionando dreno if niv3 = 0 and niv4 = 0 then ' condições para saida da subrotina dreno goto ligado' após verificação de nível 3 e 4 =0 envia para subrotina ligado endif goto dreno if liga =0 and desliga = 1 then 'desliga goto inicio endif if liga = 1 and desliga = 1 then 'desliga goto inicio endif bomba_recalque: if liga =0 and desliga = 1 then 'desliga goto inicio endif if liga = 1 and desliga = 1 then 'desliga goto inicio endif high m2 pause 10000 if niv3 = 0 and niv4 = 1 then' condições para saida da subrotina bomba_recalque goto ciclo' após verificação de nível 3 e 4 =0 envia para subrotina ciclo endif if niv3 = 0 and niv4 = 0 then goto ligado' após verificação de nível 3 e 4 =0 envia para subrotina ligado endif goto bomba_recalque