Copy Link
Add to Bookmark
Report
NuKE Issue 08-013
-----BEGIN PGP SIGNED MESSAGE-----
NuKE_NuKE_NuKe_NuKE_NuKE_NuKE_NuKE_NuKE_NuKE_NuKE_N
uK Nu
KE "The PIC16C55 listing for the" uK
E_ "Call Blocker Unit" KE
_N E_
Nu _N
uK Nu
KE_NuKE_NuKE_NuKE_NuKE_NuKE_NuKE_NuKE_NuKE_NuKE_NuK
NuKE Info-Journal #8
April 1994
The first have is the actual assemble language for the Call Blocker Unit,
the second half consists of the Compiled PASM output that you will need
to burn into the IC with your multi-purpose EPROM/Micro burner.
;******************************************************************************
; CALL BLOCKER
; This version has been upgraded to be compatible
; with both "Single Data Message Format" and
; "Multiple Data Message Format".
;******************************************************************************
;
;watchdog enabled
;
list P=16C55
ind equ 0h
rtcc equ 1h
pc equ 2h
status equ 3h
fsr equ 4h
port_a equ 5h
port_b equ 6h
port_c equ 7h
c equ 0h
dc equ 1h
z equ 2h
pd equ 3h
to equ 4h
MSB equ 7h
LSB equ 0h
;
cs equ 0h
clk equ 1h
di equ 2h
do equ 3h
;
count equ 8h
count2 equ 9h
rcv_reg equ 0Ah
addrs equ 0Bh
addrs2 equ 0Ch
rd_reg equ 0Dh
wt_reg equ 0Eh
num equ 0Fh
length equ 1Fh
;
org 1FF
goto start
org 0
;
rcv clrf rtcc
movlw b'00001101' ;assign prescaler to wdt (320ms minimum)
option
clrwdt
rcv0 btfsc port_b,7 ;detect start bit
goto rcv0 ;WDT timeout if no start bit within 320ms
clrwdt
movlw b'00000100' ;assign prescaler to rtcc (clk/32)
option
movlw 0x08 ;8 data bits
movwf count
clrf rcv_reg
clrf rtcc
rcv1 movlw 0x23 ;delay = 1.5 bits
subwf rtcc,w
btfss status,z
goto rcv1
rcv2 clrwdt
bcf status,c
rrf rcv_reg
btfsc port_b,7 ;check state of input bit
bsf rcv_reg,MSB
clrf rtcc
rcv3 movlw 0x17 ;delay = 1 bit
subwf rtcc,w
btfss status,z
goto rcv3
decfsz count
goto rcv2 ;get next bit
rcv4 clrwdt
btfss port_b,7 ;detect stop bit
goto rcv4
retlw 0x00
;
clock bsf port_a,clk ;clk high
bcf port_a,clk ;clk low
retlw 0x00
;
read clrwdt
movlw b'11111000'
tris port_a
movf addrs,w ;get address
movwf addrs2
bsf port_a,cs ;select eeprom
bsf port_a,di ;start bit and opcode
call clock
call clock
bcf port_a,di
call clock
call clock
movlw 0x08 ;8 address bits
movwf count
rd1 bcf port_a,di
rlf addrs2 ;get next address bit
btfsc status,c
bsf port_a,di
call clock
decfsz count
goto rd1
movlw 0x08 ;8 data bits
movwf count
rd2 call clock
bcf status,c
rlf rd_reg
btfsc port_a,do ;get next data bit
bsf rd_reg,LSB
decfsz count
goto rd2
btfsc port_c,3 ;check S2 (directory)
swapf rd_reg ;if S2 = open dir = "A" else "B"
movlw b'00001111' ;strip off first 4 bits
andwf rd_reg
bcf port_a,cs ;deselect eeprom
clrwdt
retlw 0x00
;
write clrwdt
movlw b'11111000'
tris port_a
movf addrs,w ;get address
movwf addrs2
bsf port_a,cs ;select eeprom
bsf port_a,di ;start bit and opcode
call clock
call clock
bcf port_a,di
call clock
call clock
movlw 0x08 ;8 address bits
movwf count
wt1 bcf port_a,di
rlf addrs2 ;get next address bit
btfsc status,c
bsf port_a,di
call clock
decfsz count
goto wt1
movlw 0x08 ;8 data bits
movwf count
wt2 call clock
bcf status,c
rlf rd_reg
btfsc port_a,do ;get next data bit
bsf rd_reg,LSB
decfsz count
goto wt2
bcf port_a,cs ;deselect eeprom
btfsc port_c,3 ;check S2 (directory)
swapf wt_reg ;if S2 = open dir = "A" else "B"
movlw b'00001111' ;set to strip off "A" side of rd_reg
btfss port_c,3 ;check S2 (directory)
movlw b'11110000' ;strip "B" side if S2 = closed
andwf rd_reg,w
iorwf wt_reg ;place data in write register
movf addrs,w ;get address
movwf addrs2
bsf port_a,cs ;select eeprom
bsf port_a,di ;start bit
call clock
bcf port_a,di ;write enable
call clock
call clock
bsf port_a,di
movlw 0x09
movwf count
wt3 call clock
decfsz count
goto wt3
bcf port_a,cs ;deselect eeprom
clrwdt
bsf port_a,cs ;select eeprom
bsf port_a,di ;start bit
call clock
bcf port_a,di ;opcode
call clock
bsf port_a,di ;opcode
call clock
call clock
movlw 0x08 ;8 address bits
movwf count
wt4 bcf port_a,di
rlf addrs2 ;get next address bit
btfsc status,c
bsf port_a,di
call clock
decfsz count
goto wt4
movlw 0x08 ;8 data bits
movwf count
wt5 bcf port_a,di
rlf wt_reg ;output next data bit
btfsc status,c
bsf port_a,di
call clock
decfsz count
goto wt5
bcf port_a,cs ;deselect eeprom
bsf port_a,cs ;select eeprom
wt6 btfss port_a,do ;test for ready condition
goto wt6
bcf port_a,cs ;deselect eeprom
bsf port_a,cs ;select eeprom
bsf port_a,di ;start bit
call clock
bcf port_a,di ;write disable
movlw 0x0B
movwf count
wt7 call clock
decfsz count
goto wt7
bcf port_a,cs ;deselect eeprom
retlw 0x00
;
dtmf clrwdt
movlw b'11111111'
tris port_b
dt2 btfss port_b,4 ;wait for valid DTMF tone
goto dtmf
movlw b'00001111'
andwf port_b,w ;read tone
movwf num
dt1 clrwdt
btfsc port_b,4 ;wait for end of tone
goto dt1
retlw 0x00
;
c_relay btfsc port_c,0 ;bypass if relay already closed
retlw 0x00
movlw 0x16 ;delay 0.2 sec (movement of relay armature)
btfss port_c,1 ;test if off hook
movlw 0xFF ;delay 2.3 sec (wait for loop current)
movwf count
bsf port_c,0 ;close relay
cr2 movlw 0x01
movwf rtcc
cr1 clrwdt
movf rtcc,w
btfss status,z
goto cr1
decfsz count
goto cr2 ;end delay
retlw 0x00
;
o_relay btfss port_c,0 ;bypass if relay already open
retlw 0x00
bcf port_c,0 ;open relay
movlw 0x16 ;delay 0.2 sec (movement of relay armature)
movwf count
or2 movlw 0x01
movwf rtcc
or1 clrwdt
movf rtcc,w
btfss status,z
goto or1
decfsz count
goto or2 ;end 0.2 sec delay
retlw 0x00
;
;******************************************************************************
; START
;******************************************************************************
;
start movlw b'00000100' ;assign prescaler to rtcc (clk/32)
option
clrwdt
clrf port_a
movlw b'11111000'
tris port_a
clrf port_b
movlw b'11111111'
tris port_b
bcf port_c,5 ;LED off
movlw b'11011110'
tris port_c
btfsc port_c,2 ;test if S1 closed (bypass)
goto st6
call c_relay ;close relay
goto start
st6 btfss port_c,1 ;test if phone off hook
goto offhook
call o_relay ;open relay
btfsc port_b,5 ;check for ring detect
goto start
movlw 0x21 ;delay 0.3 sec
movwf count
st2 movlw 0x01
movwf rtcc
st1 clrwdt
movf rtcc,w
btfss status,z
goto st1
decfsz count
goto st2 ;end 0.3 sec delay
btfsc port_b,5 ;varify ring detect after 0.3 sec
goto start
st3 clrwdt
btfss port_b,5 ;detect end of ring
goto st3
movlw 0xFF ;loop for 2.3 sec
movwf count
st4 movlw 0x01
movwf rtcc
st5 clrwdt
btfss port_b,6 ;check for carrier detect
goto st_bit ;look for start bit
movf rtcc,w
btfss status,z
goto st5
decfsz count
goto st4 ;end 2.3 sec loop
goto start ;goto start if no carrier
;
st_bit movlw 0x6E ;loop for 1 sec
movwf count
sb1 movlw 0x01
movwf rtcc
sb2 clrwdt
btfss port_b,7 ;check for start bit
goto get_id ;get caller ID
movf rtcc,w
btfss status,z
goto sb2
decfsz count
goto sb1 ;end 1 sec loop
goto start ;goto start if no start bit
;
get_id movlw 0x10 ;set fsr at first register address
movwf fsr
id1 call rcv
movlw 0x04 ;look for type = 04
subwf rcv_reg,w
btfsc status,z
goto SDMF
movlw 0x80 ;look for type = 80
subwf rcv_reg,w
btfsc status,z
goto MDMF
goto id1 ;get next word
;
SDMF call rcv ;get "message length"
movf rcv_reg,w ;load "message length" into register
movwf length
movlw 0x08 ;get and discard date and time
movwf count2
SDMF1 call rcv
decfsz count2
goto SDMF1
movlw 0x0F ;test if absence of area code
xorwf length,w
btfsc status,z
goto get_num7
goto get_num
;
MDMF call rcv ;get and discard "message length"
type call rcv ;get "parameter type"
movlw 0x02 ;look for type = 02
xorwf rcv_reg,w
btfss status,z
goto tp1
call rcv ;get "parameter length"
movlw 0x07 ;test if absence of area code
xorwf rcv_reg,w
btfsc status,z
goto get_num7
goto get_num
tp1 call rcv ;get "parameter length"
movf rcv_reg,w ;load "parameter length" into register
movwf length
tp2 call rcv ;get and discard all words in parameter
decfsz length ;test if end of parameter
goto tp2
goto type
;
get_num btfss port_c,4 ;test if using area code
goto id4
movlw 0x0A ;set for 10 numbers
movwf count2
id3 call rcv ;get next word
movlw b'00001111' ;strip off first 4 bits
andwf rcv_reg,w
btfsc status,z ;if word = "0" make "10"
movlw b'00001010'
movwf ind ;place word in register
incf fsr ;set for next register address
decfsz count2
goto id3
goto match
id4 call rcv ;get and discard area code
call rcv
call rcv
get_num7 movlw 0x07 ;set for 7 numbers
movwf count2
id5 call rcv ;get next word
movlw b'00001111' ;strip off first 4 bits
andwf rcv_reg,w
btfsc status,z ;if word = "0" make "10"
movlw b'00001010'
movwf ind ;place word in register
incf fsr ;set for next register address
decfsz count2
goto id5
;
match clrf addrs ;set for first eeprom address
m1 movlw 0x10 ;set for first register address
movwf fsr
m2 call read ;get number from eeprom
movlw b'00001100' ;test for "#"
xorwf rd_reg,w
btfsc status,z
goto found ;match found
movlw b'00001011' ;test for "*"
xorwf rd_reg,w
btfsc status,z
goto start ;no match found
movf ind,w ;test for match
xorwf rd_reg,w
btfss status,z
goto m3
incf fsr ;set for next register address
incf addrs ;set for next eeprom address
goto m2
m3 incf addrs ;set for next eeprom address
call read ;get number from eeprom
movlw b'00001100' ;test for "#"
xorwf rd_reg,w
btfss status,z
goto m3
incf addrs ;set for next eeprom address
goto m1
;
found call c_relay ;close relay
movlw 0x04 ;loop for 6 sec
movwf count2
f1 movlw 0xA4
movwf count
f2 movlw 0x01
movwf rtcc
f3 clrwdt
btfss port_b,5 ;check for ring detect
goto found ;repeat if ring detected
movf rtcc,w
btfss status,z
goto f3
decfsz count
goto f2
decfsz count2
goto f1 ;end 6 sec loop
goto start
;
offhook movlw 0x16 ;delay 0.2 sec
movwf count
oh2 movlw 0x01
movwf rtcc
oh1 clrwdt
btfsc port_b,4 ;test for DTMF tone within 0.2 sec
goto prog ;goto prog if tone present
movf rtcc,w
btfss status,z
goto oh1
decfsz count
goto oh2 ;end 0.2 sec delay
call c_relay ;close relay
goto start
;
prog bsf port_c,5 ;turn on LED
call dtmf ;get number from phone
movlw b'00001100' ;test for "#"
xorwf num,w
btfss status,z
goto pr2
clrf addrs ;set for first eeprom address
pr1 call dtmf ;get number from phone
movf num,w ;place number in write register
movwf wt_reg
call write ;write number to eeprom
incf addrs ;next eeprom address
movlw b'00001011' ;test for "*"
xorwf num,w
btfsc status,z
goto pr2 ;end programing if "*"
movlw 0xFE ;test if end of memory
xorwf addrs,w
btfss status,z
goto pr1 ;go get next number from phone
movlw b'00001100' ;write "#" to eeprom
movwf wt_reg
call write
incf addrs ;set for next eeprom address
movlw b'00001011' ;write "*" to eeprom
movwf wt_reg
call write
pr2 bcf port_c,5 ;turn off LED
call c_relay ;close relay
goto start
end
- --------------------------------------------------------------------------------
:1000000061000D0C02000400E606040A0400040C62
:100010000200080C28006A006100230C81004307DD
:100020000D0A040003042A03E606EA056100170C22
:1000300081004307170AE802110A0400E6071D0AB7
:1000400000082505250400080400F80C05000B0233
:100050002C0005054505210921094504210921092F
:10006000080C280045046C03030645052109E80235
:10007000320A080C2800210903046D0365060D05EA
:10008000E8023B0A6706AD030F0C6D01050404008E
:1000900000080400F80C05000B022C0005054505BE
:1000A00021092109450421092109080C28004504DA
:1000B0006C03030645052109E802570A080C2800CD
:1000C000210903046D0365060D05E802600A0504B5
:1000D0006706AE030F0C6707F00C4D012E010B02F3
:1000E0002C0005054505210945042109210945057F
:1000F000090C28002109E8027A0A05040400050514
:100100004505210945042109450521092109080C56
:10011000280045046C03030645052109E802890A05
:10012000080C280045046E03030645052109E80272
:10013000920A0504050565079B0A050405054505A2
:10014000210945040B0C28002109E802A40A050432
:1001500000080400FF0C06008607A90A0F0C4601E0
:100160002F0004008606B10A000807060008160CD6
:100170002707FF0C28000705010C210004000102DD
:100180004307BE0AE802BC0A000807070008070484
:10019000160C2800010C2100040001024307CC0AC0
:1001A000E802CA0A0008040C020004006500F80C0A
:1001B00005006600FF0C0600A704DE0C07004706DA
:1001C000E30AB509D30A2707860BC509A606D30A91
:1001D000210C2800010C2100040001024307EC0A55
:1001E000E802EA0AA606D30A0400A607F40AFF0CEE
:1001F0002800010C21000400C607040B010243077C
:10020000FB0AE802F90AD30A6E0C2800010C21004F
:100210000400E607110B01024307080BE802060B76
:10022000D30A100C24000009040C8A0043061D0B9D
:10023000800C8A0043062A0B130B00090A023F00B8
:10024000080C29000009E902220B0F0C9F0143064C
:100250004E0B3D0B00090009020C8A014307360BC7
:100260000009070C8A0143064E0B3D0B00090A02E8
:100270003F000009FF02390B2B0B87074B0B0A0CC1
:10028000290000090F0C4A0143060A0C2000A402B1
:10029000E902410B590B000900090009070C29006C
:1002A00000090F0C4A0143060A0C2000A402E902CF
:1002B000500B6B00100C240024090C0C8D0143061C
:1002C000740B0B0C8D014306D30A00028D0143070A
:1002D0006C0BA402AB025C0BAB0224090C0C8D016D
:1002E00043076C0BAB025A0BB509040C2900A40C94
:1002F0002800010C21000400A607740B010243072B
:100300007B0BE802790BE902770BD30A160C280065
:10031000010C210004008606940B010243078A0B9E
:10032000E802880BB509D30AA705A9090C0C8F01AF
:100330004307AF0B6B00A9090F022E004909AB025E
:100340000B0C8F014306AF0BFE0C8B0143079B0B7D
:100350000C0C2E004909AB020B0C2E004909A70416
:10036000B509D30AFF0FFF0FFF0FFF0FFF0FFF0F9E
:10037000FF0FFF0FFF0FFF0FFF0FFF0FFF0FFF0F0D
:10038000FF0FFF0FFF0FFF0FFF0FFF0FFF0FFF0FFD
:10039000FF0FFF0FFF0FFF0FFF0FFF0FFF0FFF0FED
:1003A000FF0FFF0FFF0FFF0FFF0FFF0FFF0FFF0FDD
:1003B000FF0FFF0FFF0FFF0FFF0FFF0FFF0FFF0FCD
:1003C000FF0FFF0FFF0FFF0FFF0FFF0FFF0FFF0FBD
:1003D000FF0FFF0FFF0FFF0FFF0FFF0FFF0FFF0FAD
:1003E000FF0FFF0FFF0FFF0FFF0FFF0FFF0FFF0F9D
:1003F000FF0FFF0FFF0FFF0FFF0FFF0FFF0FD30ABE
:0A1FF60010163600000082CD010D28
-----BEGIN PGP SIGNATURE-----
Version: 2.2
iQCVAgUBLfmnRk0EOTLgG0HDAQH5aQP/ezVbVvFe7PXIaDSniqJZKuwU2gNvSh6u
M5k7qQnEJ9mm0t/dAFpSpM4hGVmHx1xnMIvYyH87VFTCogwUhqUcWL/4xGzaZ72Y
RBWJvhlgTsE4Nkn/puSqtQzCxTRhuLZxBdQO7O4Tsy3lEoabCO9FYWDIZSmjAP82
+TKpH7qKBl8=
=QWFc
-----END PGP SIGNATURE-----