Está en la página 1de 10

transmisor:

Cdigo:
'****************************************************************
'* Name

: trans629serout.BAS

'* Author : Cesar Quinteros

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


'*

: All Rights Reserved

'* Date

: 26/10/2013

'* Version : 1.0

'* 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

'scilador interno a 4mhz

CMCON=7 'COMPARADOR OFF


'configuracion de puertos
TRISIO=%00110011
GPIO=%00110011
'declaracion de variables
bot1 var GPIO.0
bot2 var GPIO.1
bot3 var GPIO.4
bot4 var GPIO.5
pulso var GPIO.2
'loop de inicio

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

: autito (carrito) a control remoto.BAS

'* Author : Cesar Quinteros]

*
*

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


'*

: All Rights Reserved

'* Date

: 26/10/2013

'* Version : 1.0

'* 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
high led4
goto inicio
atras:
low LED1
high led2
high led3
low led4
goto inicio
izq:
low LED1
high led2
low led3
high led4
goto inicio
der:
high LED1
low led2
high led3
low led4
goto inicio
'pone todos los puertos de salida a cero
res:

LOW LED1:LOW LED2:LOW LED3:LOW LED4


goto inicio
end

on off:
Cdigo:
'****************************************************************
'* Name

: on off.BAS

'* Author : Cesar Quinteros]

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


'*

: All Rights Reserved

'* Date

: 26/10/2013

'* Version : 1.0

'* 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
clear
apagauno:
low led1
pause 300
gosub lectura
if ancho="A" then uno
gosub leepuertos
goto apagauno
uno:
high led1
pause 300
gosub lectura
if ancho="A" then apagauno
gosub leepuertos
goto uno
dos:
high led2
pause 300
gosub lectura
if ancho="B" then apagados
gosub leepuertos
goto dos
apagados:
low led2
pause 300
gosub lectura
if ancho="B" then dos

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

'* Author : Cesar Quinteros]

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


'*

: All Rights Reserved

'* Date

: 26/10/2013

'* Version : 1.0

'* 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

También podría gustarte