; using 20X2 connected to ISD1760 to achieve, as in this code example, 94.1 FM, the announcement of a radio tuner frequency
;
;
;PINS Set up
;C.O SDO to MOSI ISD1760
;B.5 SDI to MISO ISD1760
;B.7 SCLK
;
;
; ******** Directives ******
# com 5
# picaxe 20X2
;
;
;****** Constants and Variables *******
symbol CS = C.0
symbol i = b1 ; counter i
symbol k = b2 ; counter k
;************ Main Program ************
do
let k = 0
for i = 1 to 5 ; for count of 5: Play 5 sound clips
gosub Rst ; goto Reset subroutine ; ;
gosub PU ; goto ISD1760 power up subroutine;
if i = 1 then let b3 = 9 endif
if i = 2 then let b3 = 4 endif
if i = 3 then let b3 = 10 endif
if i = 4 then let b3 = 1 endif
if i = 5 then let b3 = 11 endif
gosub Fwd
gosub Ply
next i
Rst: ; ISD Reset subroutine
Low CS ; select 1760
let b0 = 0x03 ; set b0 to first byte of reset command
spiout B.7, C.1, LSBFirst_L, (b0/8) ; send first byte , LSB first, 8 bits
let b0 = 0x00 ; set b0 to second byte of reset command
spiout B.7, C.1, LSBFirst_L, (b0/8) ; send second byte, LSB first, 8 bits
High CS ; deselect ISD1760
return
PU: ; ISD1760 Power up routine
Low CS ; select ISD1760
let b0 = 0x01 ; set b0 to first byte of PU command
spiout B.7, C.1, LSBFirst_L, (b0/8) ; send first byte, LSB first, 8 bits
let b0 = 0x00 ; send b0 to second byte of PU command
spiout B.7, C.1, LSBFirst_L, (b0/8) ; send second byte, LSB first, 8 bits
High CS ; deselect ISD1760
return
Ply: ; ISD1760 Play routine
Low CS ; select ISD1760
let b0 = 0x40 ; set b0 to first byte of Play command
spiout B.7, C.1, LSBFirst_L, (b0/8) ; send first bytee, LSB first, 8 bits
let b0 = 0x00 ; set b0 to second byte of Play command
spiout B.7, C.1, LSBFirst_L, (b0/8) ; send second byte, LSB first,8 bits
High CS ; deselect ISD1760
pause 1500
return ; wait 1.5 seconds for message to play
Fwd: ; ISD1760 Forward to next message
if b3 = 0 then return endif ; if b3 = 0 then do nothing
for k = k to b3 ; forward b3 number of times
Low CS ; select ISD1760
let b0 = 0x48 ; set b0 to first byte of Fwd command
spiout B.7, C.1, LSBFirst_L, (b0/8) ; send first byte, LSB first, 8 bits
let b0 = 0x00 ; set b0 to second byte of Fwd command
spiout B.7, C.1, LSBFirst_L, (b0/8) ; send seccond byte, LSB first, 8 bits
High CS ; de-select ISD1760
next k
return
loop ; (loop was missing from author's program)
end
;**************************** END *****************************