Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Cdigo:
'****************************************************************
'* Name
: trans629serout.BAS
'* Date
: 26/10/2013
'* Notes :
'*
'****************************************************************
'configuracion de fuses (fusibles)
@ DEVICE pic12F629, intrc_osc_noclkout, wdt_off, pwrt_off, mclr_off, bod_off, protect_off
'includes
include "modedefs.bas"
DEFINE OSCCAL_1K 1
DEFINE OSC 4
inicio:
if bot1=0 then pres1
if bot2=0 then pres2
if bot3=0 then pres3
if bot4=0 then pres4
goto inicio
'acciones
pres1:
serout pulso,N2400,["A"]
pause 10
goto inicio
pres2:
serout pulso,N2400,["B"]
pause 10
goto inicio
pres3:
serout pulso,N2400,["C"]
pause 10
goto inicio
pres4:
serout pulso,N2400,["D"]
pause 10
goto inicio
end
Receptores:
carrito a control remoto:
Cdigo:
'****************************************************************
'* Name
*
*
'* Date
: 26/10/2013
'* Notes :
'*
'****************************************************************
'configuracion de fuses (fusibles)
@ DEVICE pic12F629, intrc_osc_noclkout, wdt_off, pwrt_off, mclr_off, bod_off, protect_off
'includes
include "modedefs.bas"
DEFINE OSCCAL_1K 1
DEFINE OSC 4 'oscilador interno a 4mhz
CMCON=7 'COMPARADOR OFF
'configuracion de puertos
TRISIO=%00001000
GPIO=%00001000
'declaracion de variables
LED1 var GPIO.0
LED2 VAR GPIO.1
LED3 VAR GPIO.4
LED4 VAR GPIO.5
pulso var GPIO.3
ancho var byte
'loop de inicio
inicio:
serin pulso,N2400,50,res,ancho
on off:
Cdigo:
'****************************************************************
'* Name
: on off.BAS
'* Date
: 26/10/2013
'* Notes :
'*
'****************************************************************
'configuracion de fuses (fusibles)
@ DEVICE pic12F629, intrc_osc_noclkout, wdt_off, pwrt_off, mclr_off, bod_off, protect_off
'includes
include "modedefs.bas"
DEFINE OSCCAL_1K 1
DEFINE OSC 4 'oscilador interno a 4mhz
CMCON=7 'COMPARADOR OFF
'configuracion de puertos
TRISIO=%00001000
GPIO=%00001000
'declaracion de variables
LED1 var GPIO.0
LED2 VAR GPIO.1
LED3 VAR GPIO.4
gosub leepuertos
goto apagados
tres:
high led3
pause 300
gosub lectura
if ancho="C" then apagatres
gosub leepuertos
goto tres
apagatres:
low led3
pause 300
gosub lectura
if ancho="C" then tres
gosub leepuertos
goto apagatres
cuatro:
high led4
pause 300
gosub lectura
if ancho="D" then apagacuatro
gosub leepuertos
goto cuatro
apagacuatro:
low led4
pause 300
gosub lectura
if ancho="D" then cuatro
gosub leepuertos
goto apagacuatro
lectura:
serin pulso,N2400,ancho
return
leepuertos:
if ancho="A" then uno
if ancho="B" then dos
if ancho="C" then tres
if ancho="D" then cuatro
return
end
push boton:
Cdigo:
'****************************************************************
'* Name
: receptor push.BAS
'* Date
: 26/10/2013
'* Notes :
'*
'****************************************************************
'configuracion de fuses (fusibles)
@ DEVICE pic12F629, intrc_osc_noclkout, wdt_off, pwrt_off, mclr_off, bod_off, protect_off
'includes
include "modedefs.bas"
DEFINE OSCCAL_1K 1
DEFINE OSC 4 'oscilador interno a 4mhz
CMCON=7 'COMPARADOR OFF
'configuracion de puertos
TRISIO=%00001000
GPIO=%00001000
'declaracion de variables
LED1 var GPIO.0
LED2 VAR GPIO.1
LED3 VAR GPIO.4
LED4 VAR GPIO.5
pulso var GPIO.3
ancho var byte
'loop de inicio
inicio:
serin pulso,N2400,50,res,ancho
if ancho="A" then adel
if ancho="B" then atras
if ancho="C" then izq
if ancho="D" then der
goto inicio
adel:
HIGH LED1
low led2
low led3
low led4
goto inicio
atras:
low LED1
high led2
low led3
low led4
goto inicio
izq:
low LED1
low led2
high led3
low led4
goto inicio
der:
low LED1
low led2
low led3
high led4
goto inicio
'pone todos los puertos de salida a cero
res:
LOW LED1:LOW LED2:LOW LED3:LOW LED4
goto inicio
end