
Originally Posted by
mister_e
Ship me one, and I'll do it.
Me too! 
Or... You can try it yourself 
Most of this code was written for me by Jerson and I reconfigured to "fit my needs". The following will give you an idea on how to make the ISD1700 series jump and also telling them how high to jump AND how loud... 
Code:
SCLK var portc.0
MOSI var portc.1
MISO var portc.2
SS var portc.3
' This array contains data to be sent to the ISD
' and on return it contains data reveived from ISD
ISD_Data var byte[8]
SR0 var ISD_Data[0]
SR1 var ISD_Data[1]
isCmdErr var SR0.0
isINT var SR0.4
isReady var SR1.0
Reg var byte
Cnt var byte
bSPI var byte ' the byte being transferred on SPI
ADCON1 = %00000111 'Sets all A/D conversion to Digital input/output.
TRISA = %111111 ' All A Ports input
TRISC = %00000100 ' MISO is input
TRISB = %00000000
SS = 1
SCLK = 1
MOSI = 0
' Initialize the ISD
' ------------------------------------------------------------------------------------
gosub PowerUp
pause 10
gosub WR_APC2 ' In my application, this sets the volume and config bits.
'You can use it as well if you desire.
pause 10
gosub ClrInt
'This is the Set_Play command
SetPlay:
isCmdErr = 1
while isCmdErr
ss = 0
bSPI = $80
gosub SPI
ISD_Data[0]=bSPI
bSPI = $00
gosub SPI
ISD_Data[1]=bSPI
bSPI = $10 ' Start Address low byte. (First packet of memory after effects)(Use your begin low address here)
gosub SPI
ISD_Data[2]=bSPI
bSPI = $00 ' Start Address high byte (Use your begin high address here)
gosub SPI
ISD_Data[3]=bSPI
bSPI = $00 ' end address low byte (Use your end address here)
gosub SPI
ISD_Data[4]=bSPI
bSPI = $00 ' end address mid byte(Use your end address here)
gosub SPI
ISD_Data[5]=bSPI
bSPI = $00 ' end address high byte / Note end address is 24 bits long. (Use your end address here)
gosub SPI
ISD_Data[6]=bSPI
bSPI = $00
gosub SPI
ISD_Data[7]=bSPI
ss = 1
wend
return
PowerUp:
isCmdErr = 1
while isCmdErr
SS=0
bSPI=$01
gosub SPI
ISD_Data[0] = bSPI
bSPI=$00
gosub SPI
ISD_Data[1] = bSPI
SS=1
wend
return
'This is the command I use to set the volume as stated above. I have the factory defaults tagged in brackets for reference...
WR_APC2:
isCmdErr = 1
while isCmdErr
ss = 0
bSPI = $65
gosub SPI
ISD_Data[0]=bSPI
bSPI = %01000011
gosub SPI
ISD_Data[1]=bSPI 'Factory default
'high byte 'low byte
bSPI = %00000100 '(0100) (01000000)
gosub SPI
ISD_Data[2]=bSPI
ss=1
wend
return
' transact a byte with SPI interface
' You should come here after setting SS=0 for this to work
SPI:
for Cnt=0 to 7
MOSI=bSPI.0 ' shift MOSI from LSB
SCLK = 0 ' clock the MOSI data
if MISO then ' read the MOSI data
@ bsf status,c
else
@ bcf status,c
endif
@ rrf _bSPI ' shift MISO into MSB
SCLK = 1
next
return
' clear Interrupt and EOM bits
ClrInt:
isCmdErr = 1
while isCmdErr
SS=0
bSPI=$04
gosub SPI
ISD_Data[0] = bSPI
bSPI=$00
gosub SPI
ISD_Data[1] = bSPI
SS=1
wend
return
' read status of Chip
ReadStatus:
SS=0
bSPI=$05
gosub SPI
ISD_Data[0]=bSPI
bSPI=$00
gosub SPI
ISD_Data[1] = bSPI
bSPI=$00
gosub SPI
ISD_Data[2] = bSPI
SS=1
return
Brenon
Bookmarks