pa equ 0x05
pb equ 0x06
est equ 0x03
tmr equ 0x01
int equ 0x0b
op equ 0x0c
org 0
bsf est,5
clrf pa
clrf pb
movlw b'11010011';activo preescaler x16, se lo asigno a tmr0
movwf option ;y lo pongo en modo temporizacion
bcf est,5
clrf tmr
main call off
call on ;bit1=1
call off
call on ;bit2=1
call off
call on ;bit3=1
call on
call off ;bit4=0
call on
call off ;bit5=0
call on
call off ;bit6=0
call on
call off ;bit7=0
call on
call off ;bit8=0
call on
call off ;bit9=0
call on
call off ;bit10=0
call on
call off ;bit11=0
call on
call off ;bit12=0
call on
call off ;bit13=0
call on
call off ;bit14=0
call del_89;espera de 50 bits
call off
call on ;bit1=1
call off
call on ;bit2=1
call on
call off ;bit3=0
call on
call off ;bit4=0
call on
call off ;bit5=0
call on
call off ;bit6=0
call on
call off ;bit7=0
call on
call off ;bit8=0
call on
call off ;bit9=0
call on
call off ;bit10=0
call on
call off ;bit11=0
call on
call off ;bit12=0
call on
call off ;bit13=0
call on
call off ;bit14=0
call del_89;espera de 50 bits
goto main
del_14 nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
return
del_11 nop
nop
nop
nop
nop
nop
nop
return
off movlw d'201'
movwf tmr
exp btfss int,2
goto exp
bcf int,2
return ;en total, con el uso del call y el return y todo sumado, da 896us justos de delay
on movlw d'32'
movwf op
on1 bsf pb,0
call del_14
bcf pb,0
call del_11
decfsz op,1
goto on1
return ;en total 32 ciclos a
;35.7KHz y ciclo de act.=50%
del_89 movlw d'251'
movwf tmr
exp2 btfss int,2
goto exp2
bcf int,2
return
end