include "modedefs.bas"
DEFINE OSC 4
CMCON=7
TRISA = %00000000 'todo el puerto a como salida
TRISB = %00000001 'todo el puerto b como salida menor portb.0 es entrada
SYMBOL REL1 = PORTA.0
SYMBOL REL2 = PORTA.1
SYMBOL REL3 = PORTA.2
SYMBOL REL4 = PORTA.3
SYMBOL REL5 = PORTA.4
SYMBOL REL6 = PORTA.5
SYMBOL RX = PORTB.0 'RX ENTRADA
SYMBOL TX = PORTB.1 'TX SALIDA
B0 VAR BYTE
B1 VAR BYTE
;TX = 1
'serout2 Tx,16780,[13] 'ponle esta linea tambien
INICIO:
GOTO ACTIVAR
ACTIVAR:
SerIn2 tX,16468,100,DESACTIVAR,[WAIT("Activar R"),DEC B0]
SELECT CASE B0
CASE 0
serout2 RX,16468,["ERROR DE COMANDO"]
GOTO INICIO
CASE 1
HIGH REL1
PAUSE 1000
GOTO ENVIAR1
GOTO INICIO
CASE 2
HIGH REL2
PAUSE 1000
GOTO ENVIAR2
GOTO INICIO
CASE 3
HIGH REL3
PAUSE 1000
GOTO ENVIAR3
GOTO INICIO
end select
GOTO INICIO
DESACTIVAR:
SerIn2 tX,16468,100,INICIO,[WAIT("Desactivar R"),DEC B1]
SELECT CASE B1
CASE 0
serout2 RX,16468,["ERROR DE COMANDO"]
GOTO INICIO
CASE 1
LOW REL1
PAUSE 1000
GOTO DESACTIVAR1
GOTO INICIO
CASE 2
LOW REL2
PAUSE 1000
GOTO DESACTIVAR2
GOTO INICIO
CASE 3
LOW REL3
PAUSE 1000
GOTO DESACTIVAR3
GOTO INICIO
end select
GOTO INICIO
ENVIAR1:
serout2 RX,16468,["AT+CMGF = ",#B0,13]
PAUSE 1000
serout2 RX,16468,["AT+CMGS=",34,"092661649",34,13]
PAUSE 1000
SEROUT2 RX,16468,["R1 activado ",#B0,26]
GOTO INICIO
ENVIAR2:
serout2 RX,16468,["AT+CMGF = ",#B0,13]
PAUSE 1000
serout2 RX,16468,["AT+CMGS=",34,"092661649",34,13]
PAUSE 1000
SEROUT2 RX,16468,["R2 activado ",#B0,26]
GOTO INICIO
ENVIAR3:
serout2 RX,16468,["AT+CMGF = ",#B0,13]
PAUSE 1000
serout2 RX,16468,["AT+CMGS=",34,"092661649",34,13]
PAUSE 1000
SEROUT2 RX,16468,["R3 activado ",#B0,26]
GOTO INICIO
DESACTIVAR1:
serout2 RX,16468,["AT+CMGF = ",#B0,13]
PAUSE 1000
serout2 RX,16468,["AT+CMGS=",34,"092661649",34,13]
PAUSE 1000
SEROUT2 RX,16468,["R1 desactivado ",#B0,26]
GOTO INICIO
DESACTIVAR2:
serout2 RX,16468,["AT+CMGF = ",#B0,13]
PAUSE 1000
serout2 RX,16468,["AT+CMGS=",34,"092661649",34,13]
PAUSE 1000
SEROUT2 RX,16468,["R2 desactivado ",#B0,26]
GOTO INICIO
DESACTIVAR3:
serout2 RX,16468,["AT+CMGF = ",#B0,13]
PAUSE 1000
serout2 RX,16468,["AT+CMGS=",34,"092661649",34,13]
PAUSE 1000
SEROUT2 RX,16468,["R3 desactivado ",#B0,26]
GOTO INICIO