Winbond ISD1700 Voice Recorder


Closed Thread
Results 1 to 40 of 59

Hybrid View

  1. #1
    Join Date
    Sep 2005
    Location
    Dayton, Ohio
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    This works so far to play back 4 sounds repeatedly. The volume setting via apc2 works also. Next I plan to get rid of the PAUSE delays and monitor status to determine when each sound finished playing.

    Code:
    'DEMO PLAYER FOR ISD1700
    'Code Version: 01 
    'Words Used = 354
    'Revision Date: 8 Feb 2009
    'PicBasic Pro Compiler version 2.50b
    'Processor=PIC16F684  (WDT=ON, MCLR=INPUT, OSC=INTOSC)
    
    'Modified from code posted by Jerson and Brenon
    
    'Memory Reference:
    'ISD17XX First Address = 0x010
    'ISD1730 Max Address   = 0x0FF
    'ISD1760 Max Address   = 0x1EF
    'ISD1790 Max Address   = 0x2DF
    
    	DEFINE OSC 8
    '*************************************************************
    '*************************************************************
    '******************** DEFINE VARIABLES ***********************
    '*************************************************************
    '*************************************************************
    temp_bit    VAR BIT
    
    temp		VAR BYTE
    spi_cnt 	             var byte	' counter for SPI transfer
    bSPI 		var byte 	' the byte being transferred on SPI
    
    s_addr		VAR WORD	' Start Address
    e_addr		VAR WORD	' End Address
    
    ISD_Data 	var byte[7]	' This array contains data to/from ISD
    
    SR0a 		var ISD_Data[0]
    SR0b 		var ISD_Data[1]
    SR1 		var ISD_Data[2]    ' only valid after ReadStatus
    
    isCmdErr 	var SR0a.0	             ' 1=previous command failed/ignored
    isFull 		var SR0a.1	' 1=memory full
    isPU		var SR0a.2	' 1=ISD powered up
    isEOM		VAR SR0a.3	' 1=EOM detected (clear by CLR_INT command)
    isINT 		var SR0a.4	' 1=current operation completed (clear by CLR_INT command)
    
    isReady 	var SR1.0	' 1=Ready to receive SPI command (only valid after ReadStatus)
    				        ' Some SPI commands can still be sent when isReady=0
    
    '*************************************************************
    '*************************************************************
    '******************** PIN ASSIGNMENTS ************************
    '*************************************************************
    '*************************************************************
    Symbol sensor	= PORTA.0			' 
    Symbol miso		= PORTA.3			'ISD1760 SPI MISO 
    Symbol led1	    = PORTC.1			'  
    Symbol led2	    = PORTC.2			'
    Symbol ss		= PORTC.3			'ISD1760 SLAVE SELECT  
    Symbol sclk		= PORTC.4			'ISD1760 SPI CLOCK 
    Symbol mosi 	= PORTC.5         	'ISD1760 SPI MOSI	
    	
    '*************************************************************
    '*************************************************************
    '******************** INITIALIZATION *************************
    '*************************************************************
    '*************************************************************
    initialize:
        CLEAR
    	OSCCON = %01111000
    	CMCON0 = 7				'turn off comparators
    	ANSEL = 0
    	
    	PR2 = 35				'PWM Period (40K=49, 56K=35) (35 to 55)
    	CCPR1L = 15				'PWM Duty Cycle (1 to 15)
    	T2CON = 4				'Timer2 = ON; Prescale = 1:1
    	CCP1CON = 0				'PWM module off
    	OPTION_REG = %11111111	'Turn off PortA weak pull-ups
    	
    	TRISA = %111111    		'set PortA directions
    	WPUA =  %000000			'enable weak pull-ups PortA
    	IOCA =  %000000			'disable PORTA.0 Int On Change
    
    	TRISC = %000000    		'set PortC directions
    
    	PORTA = %000000
    	PORTC = %000000    		'
    	
    	HIGH ss			'start with Slave Select HIGH
    	HIGH sclk		'start with SPI Clock HIGH
    	LOW MOSI		'start with MOSI LOW
    	
        INPUT sensor
    	LOW led1
    	LOW led2
    	
    	
    start:                       'Initialize the ISD
    	GoSub isd_pu
    	PAUSE 50		         '50 mS Power Up Delay (per datasheet)
    	GoSub isd_wr_apc 	     'set volume and config bits 
    	PAUSE 10
    	GoSub isd_clr_int	     'clear interrupt and EOM
    '*************************************************************	
    '*************************************************************
    '********************* MAIN PROGRAM **************************
    '*************************************************************
    '*************************************************************
    main_loop:	'(MAIN PROGRAM LOOP)
         
        PAUSE 2000
        
        s_addr = $010
        e_addr = $02b
        GOSUB isd_set_play
    
        PAUSE 2500
        
        GOSUB isd_stop
        
        PAUSE 2000
        
        s_addr = $02c
        e_addr = $048
        GOSUB isd_set_play
        
        PAUSE 2500
    
        GOSUB isd_stop
        
        PAUSE 2000
            
        s_addr = $049
        e_addr = $07c
        GOSUB isd_set_play
        
        PAUSE 4800
    
        GOSUB isd_stop
        
        PAUSE 2000
            
        s_addr = $07d
        e_addr = $093
        GOSUB isd_set_play
        
        PAUSE 2000
    
        GOSUB isd_stop
            
    	GoTo 	main_loop
    
    
    '*************************************************************	
    '*************************************************************
    '********************** SUBROUTINES **************************
    '*************************************************************
    '*************************************************************
    isd_pu:				
    	LOW ss
    
    	bSPI=$01		'Power Up Command
    	GoSub isd_spi
    	ISD_Data[0] = bSPI 	'SR0a
    
    	bSPI=$00
    	GoSub isd_spi
    	ISD_Data[1] = bSPI 	'SR0b
    
    	HIGH ss
    
    	RETURN
    
    '--------------------------------------------------------------------------
    isd_wait_ready:
    	GOSUB isd_rd_status
    	IF isReady = 0 THEN isd_wait_ready
    	RETURN
    
    '--------------------------------------------------------------------------
    isd_set_play:
    	LOW ss
    
    	bSPI = $80		'Set Play Command (7 bytes)
    	GoSub isd_spi
    	ISD_Data[0] = bSPI	'SR0a
    
    	bSPI = $00 
    	GoSub isd_spi
    	ISD_Data[1] = bSPI 	'SR0b
    
    	bSPI = s_addr.LowByte 	' Start Address low byte. 
    	GoSub isd_spi
    	ISD_Data[2] = bSPI	'SR0a
    
    	bSPI = s_addr.HighByte 	' Start Address high byte 
    	GoSub isd_spi
    	ISD_Data[3] = bSPI 	'SR0b
    
    	bSPI = e_addr.LowByte 	' End Address low byte 
    	GoSub isd_spi
    	ISD_Data[4] = bSPI 	'SR0a
    
    	bSPI = e_addr.HighByte 	' End Address high byte
    	GoSub isd_spi
    	ISD_Data[5] = bSPI 	'SR0b
    
    	bSPI = $00		' Reserved Address - set to "0"
    	GoSub isd_spi
    	ISD_Data[6] = bSPI 	'SR0a
    
    	HIGH ss
    
    	RETURN
    
    '--------------------------------------------------------------------------
    isd_wr_apc:			'Write to APC Register using bits D2:D0 to set Volume 
    	LOW ss
    
    	bSPI = $65		'Write APC2 
    	GoSub isd_spi
    	ISD_Data[0] = bSPI 	'SR0a
    
    	bSPI = %01000011	'Volume set by D2:D0 (000=Max)
    				'Output set by D7 (0=Aud, 1=Aux)
    	GoSub isd_spi
    	ISD_Data[1] = bSPI 	'SR0b
    					
    	bSPI = %00000100 	'PWM Speaker Output D8 (0=Enable, 1=Disable)
    				
    	GoSub isd_spi
    	ISD_Data[2] = bSPI 	'SR0a
    
    	HIGH ss
    
    	RETURN
    
    '--------------------------------------------------------------------------
    isd_spi:				        ' shift SPI data out and into SPI byte 
    	FOR spi_cnt = 0 to 7        '
    		MOSI = bSPI.0 		    ' shift LSB of byte onto MOSI line
    		LOW SCLK 		        ' clock MISO data out to uC (Falling Edge)
    		temp_bit = miso         '
    		HIGH SCLK		        ' clock MOSI into ISD1700 (Rising Edge)
    		bSPI = bSPI >> 1 		' shift SPI byte Right
    		bSPI.7 = temp_bit
    	NEXT spi_cnt
    
    	RETURN
    
    '--------------------------------------------------------------------------
    isd_clr_int:					' CLEAR INTERRUPT AND EOM BITS
    	LOW SS
    	
    	bSPI=$04		'Clear Interrupt Command
    	gosub isd_spi
    	ISD_Data[0] = bSPI 	'SR0a
    
    	bSPI=$00
    	gosub isd_spi
    	ISD_Data[1] = bSPI 	'SR0b
    
    	HIGH SS
    
    	RETURN
    
    '--------------------------------------------------------------------------
    isd_stop:					' Stop Immediately
    	LOW ss
    
    	bSPI=$02		'Stop Command
    	gosub isd_spi
    	ISD_Data[0] = bSPI 	'SR0a
    
    	bSPI=$00
    	gosub isd_spi
    	ISD_Data[1] = bSPI 	'SR0b
    
    	HIGH ss
    
    	RETURN
    
    '--------------------------------------------------------------------------
    isd_pd:					' Stop Immediately
    	LOW ss
    
    	bSPI=$07		'Power Down Command
    	gosub isd_spi
    	ISD_Data[0] = bSPI 	'SR0a
    
    	bSPI=$00
    	gosub isd_spi
    	ISD_Data[1] = bSPI 	'SR0b
    
    	HIGH ss
    
    	RETURN
    
    '--------------------------------------------------------------------------
    isd_rd_status:				'read status of ISD1700 
    	LOW ss
    
    	bSPI=$05		'Read Status Command
    	gosub isd_spi
    	ISD_Data[0] = bSPI	'SR0a
    
    	bSPI=$00
    	gosub isd_spi
    	ISD_Data[1] = bSPI	'SR0b
    
    	bSPI=$00
    	gosub isd_spi
    	ISD_Data[2] = bSPI	'SR1
    
    	HIGH ss
    
    	RETURN
    
    '*************************************************************
    '*************************************************************
    
    
    	End
    Jim Robertson
    "MilesTag" DIY Lasertag
    www.lasertagparts.com/mtdesign.htm
    Dayton, Ohio

  2. #2
    Join Date
    Sep 2005
    Location
    Dayton, Ohio
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    I did some further testing. Seems the best way to determine when a sound has finished playing is to monitor the INT status bit. Just remember to clear the INT before each SET_PLAY.

    The PLAY bit will not work as it does not get cleared until you change to another mode (i.e. RECORD).

    The READY bit will not tell when the sound is completed playing, rather it tells you that the chip is ready to receive another SPI command (which can happen before the sound is complete when using SETPLAY).

    I couldn't find how to edit the previous post, so here are the changed parts:
    (obviously your start/end addresses will be different)

    Code:
    mainloop:
    
        PAUSE 1000
            
        s_addr = $049
        e_addr = $07c
        GOSUB isd_set_play
        
        GOSUB isd_wait_int
        GoSub isd_clr_int
        
        PAUSE 1000
            
        s_addr = $07d
        e_addr = $093
        GOSUB isd_set_play
        
        GOSUB isd_wait_int
        GoSub isd_clr_int
        
        GoTo 	main_loop
    
    '--------------------------------------------------------------------------
    isd_wait_int:
    	GOSUB isd_rd_status
    	IF isINT = 0 THEN isd_wait_int
    	RETURN
    Jim Robertson
    "MilesTag" DIY Lasertag
    www.lasertagparts.com/mtdesign.htm
    Dayton, Ohio

  3. #3
    Join Date
    Jun 2007
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by milestag View Post
    I did some further testing. Seems the best way to determine when a sound has finished playing is to monitor the INT status bit. Just remember to clear the INT before each SET_PLAY...
    So monitoring the Int bit - reads 0 when the file is playing and sets to 1 when completed... I have completed the program for this chip in my application! : INSERT BOUNCY HERE:


    I'd REALLY like to thank Jerson for the initial beginning of this coding and to thank Jim for the clarifications needed to succeedingly write the final piece to operate my products.


    Brenon
    Last edited by ivirscar; - 8th February 2009 at 20:53. Reason: Clarification of post...

  4. #4
    Join Date
    Jan 2014
    Posts
    84


    Did you find this post helpful? Yes | No

    Default Re: Winbond ISD1700 Voice Recorder

    I tried to play a recorded sound on ISD1730 but something is wrong. I use 16F1503 set at 4 MHZ. Can somebody help me..? Thx in advance


    CODE:

    #CONFIG
    __config _CONFIG1, _FOSC_INTOSC & _MCLRE_OFF & _CP_ON & _CLKOUTEN_OFF
    __config _CONFIG2, _LVP_OFF & _LPBOR_OFF
    #ENDCONFIG

    DEFINE OSC 4
    OSCCON = %01101000 ' set 4MHz internal osc


    CM1CON0.7 = 0 ; Disable comparator 1
    CM2CON0.7 = 0 ; Disable comparator 2

    ADCON0 = 0 'all ports set as digital
    ADCON1 = 0

    TRISA = %00100000 'PORTA.5 as input
    ANSELA = %00000000
    PORTA = 0

    TRISC = %00000100 'PORTC.3 as input
    LATC = 0
    PORTC = 0
    ANSELC = 0


    '******************** DEFINE VARIABLES ***********************

    temp_bit VAR BIT

    temp VAR BYTE
    spi_cnt var byte ' counter for SPI transfer
    bSPI var byte ' the byte being transferred on SPI

    s_addr VAR WORD ' Start Address
    e_addr VAR WORD ' End Address

    ISD_Data var byte[7] ' This array contains data to/from ISD

    SR0a var ISD_Data[0]
    SR0b var ISD_Data[1]
    SR1 var ISD_Data[2] ' only valid after ReadStatus

    isCmdErr var SR0a.0 ' 1=previous command failed/ignored
    isFull var SR0a.1 ' 1=memory full
    isPU var SR0a.2 ' 1=ISD powered up
    isEOM VAR SR0a.3 ' 1=EOM detected (clear by CLR_INT command)
    isINT var SR0a.4 ' 1=current operation completed (clear by CLR_INT command)

    isReady var SR1.0 ' 1=Ready to receive SPI command (only valid after ReadStatus)
    ' Some SPI commands can still be sent when isReady=0


    '******************** PIN ASSIGNMENTS ************************


    Symbol LED = PORTA.0 '
    Symbol miso = PORTC.2 'ISD1730 SPI MISO
    Symbol ss = PORTC.3 'ISD1730 SLAVE SELECT
    Symbol sclk = PORTC.1 'ISD1730 SPI CLOCK
    Symbol mosi = PORTC.0 'ISD1730 SPI MOSI

    '******************** INITIALIZATION *************************
    initialize:

    HIGH ss 'start with Slave Select HIGH
    HIGH sclk 'start with SPI Clock HIGH
    LOW MOSI 'start with MOSI LOW
    LOW led


    start: 'Initialize the ISD
    GoSub isd_pu
    PAUSE 50 '50 mS Power Up Delay (per datasheet)
    GoSub isd_clr_int 'clear interrupt and EOM


    '********************* MAIN PROGRAM **************************

    main_loop: '(MAIN PROGRAM LOOP)

    Playloop:
    if porta.5 = 1 then play
    goto playloop

    Play:
    high led ' LED for play

    if porta.5 = 1 then play 'wont play until button is released

    s_addr = $010 'playing back from the same 16 rows
    e_addr = $01f

    GOSUB isd_set_play

    PAUSE 2000

    GOSUB isd_stop

    low led
    goto main_loop
    end

    '********************** SUBROUTINES **************************
    isd_pu:
    LOW ss
    bSPI=$01 'Power Up Command
    GoSub isd_spi
    ISD_Data[0] = bSPI 'SR0a
    bSPI=$00
    GoSub isd_spi
    ISD_Data[1] = bSPI 'SR0b
    HIGH ss
    RETURN

    '--------------------------------------------------------------------------
    isd_wait_ready:
    GOSUB isd_rd_status
    IF isReady = 0 THEN isd_wait_ready
    RETURN

    '--------------------------------------------------------------------------
    isd_set_play:
    LOW ss

    bSPI = $80 'Set Play Command (7 bytes)
    GoSub isd_spi
    ISD_Data[0] = bSPI 'SR0a

    bSPI = $00
    GoSub isd_spi
    ISD_Data[1] = bSPI 'SR0b

    bSPI = s_addr.LowByte ' Start Address low byte.
    GoSub isd_spi
    ISD_Data[2] = bSPI 'SR0a

    bSPI = s_addr.HighByte ' Start Address high byte
    GoSub isd_spi
    ISD_Data[3] = bSPI 'SR0b

    bSPI = e_addr.LowByte ' End Address low byte
    GoSub isd_spi
    ISD_Data[4] = bSPI 'SR0a

    bSPI = e_addr.HighByte ' End Address high byte
    GoSub isd_spi
    ISD_Data[5] = bSPI 'SR0b

    bSPI = $00 ' Reserved Address - set to "0"
    GoSub isd_spi
    ISD_Data[6] = bSPI 'SR0a

    HIGH ss

    RETURN

    '--------------------------------------------------------------------------
    isd_spi: ' shift SPI data out and into SPI byte
    FOR spi_cnt = 0 to 7 '
    MOSI = bSPI.0 ' shift LSB of byte onto MOSI line
    LOW SCLK ' clock MISO data out to uC (Falling Edge)
    temp_bit = miso '
    HIGH SCLK ' clock MOSI into ISD1700 (Rising Edge)
    bSPI = bSPI >> 1 ' shift SPI byte Right
    bSPI.7 = temp_bit
    NEXT spi_cnt

    RETURN

    '--------------------------------------------------------------------------
    isd_clr_int: ' CLEAR INTERRUPT AND EOM BITS
    LOW SS

    bSPI=$04 'Clear Interrupt Command
    gosub isd_spi
    ISD_Data[0] = bSPI 'SR0a

    bSPI=$00
    gosub isd_spi
    ISD_Data[1] = bSPI 'SR0b

    HIGH SS

    RETURN

    '--------------------------------------------------------------------------
    isd_stop: ' Stop Immediately
    LOW ss

    bSPI=$02 'Stop Command
    gosub isd_spi
    ISD_Data[0] = bSPI 'SR0a

    bSPI=$00
    gosub isd_spi
    ISD_Data[1] = bSPI 'SR0b

    HIGH ss

    RETURN

    '--------------------------------------------------------------------------
    isd_rd_status: 'read status of ISD1700
    LOW ss '

    bSPI=$05 'Read Status Command
    gosub isd_spi
    ISD_Data[0] = bSPI 'SR0a

    bSPI=$00
    gosub isd_spi
    ISD_Data[1] = bSPI 'SR0b

    bSPI=$00
    gosub isd_spi
    ISD_Data[2] = bSPI 'SR1

    HIGH ss

    RETURN

  5. #5
    derbende's Avatar
    derbende Guest


    Did you find this post helpful? Yes | No

    Default Re: Winbond ISD1700 Voice Recorder

    thank you very much for the nice code.

    I have tested your code and it is working proerly. I can play and erase the voices by using ISD_ERASE and ISD_PLAY function. However I couldn't record any voices. I am very glad if you can help me. I can nor record any voices in defined addresses. how can I do it?



    Quote Originally Posted by milestag View Post
    This works so far to play back 4 sounds repeatedly. The volume setting via apc2 works also. Next I plan to get rid of the PAUSE delays and monitor status to determine when each sound finished playing.

    Code:
    'DEMO PLAYER FOR ISD1700
    'Code Version: 01 
    'Words Used = 354
    'Revision Date: 8 Feb 2009
    'PicBasic Pro Compiler version 2.50b
    'Processor=PIC16F684  (WDT=ON, MCLR=INPUT, OSC=INTOSC)
    
    'Modified from code posted by Jerson and Brenon
    
    'Memory Reference:
    'ISD17XX First Address = 0x010
    'ISD1730 Max Address   = 0x0FF
    'ISD1760 Max Address   = 0x1EF
    'ISD1790 Max Address   = 0x2DF
    
    	DEFINE OSC 8
    '*************************************************************
    '*************************************************************
    '******************** DEFINE VARIABLES ***********************
    '*************************************************************
    '*************************************************************
    temp_bit    VAR BIT
    
    temp		VAR BYTE
    spi_cnt 	             var byte	' counter for SPI transfer
    bSPI 		var byte 	' the byte being transferred on SPI
    
    s_addr		VAR WORD	' Start Address
    e_addr		VAR WORD	' End Address
    
    ISD_Data 	var byte[7]	' This array contains data to/from ISD
    
    SR0a 		var ISD_Data[0]
    SR0b 		var ISD_Data[1]
    SR1 		var ISD_Data[2]    ' only valid after ReadStatus
    
    isCmdErr 	var SR0a.0	             ' 1=previous command failed/ignored
    isFull 		var SR0a.1	' 1=memory full
    isPU		var SR0a.2	' 1=ISD powered up
    isEOM		VAR SR0a.3	' 1=EOM detected (clear by CLR_INT command)
    isINT 		var SR0a.4	' 1=current operation completed (clear by CLR_INT command)
    
    isReady 	var SR1.0	' 1=Ready to receive SPI command (only valid after ReadStatus)
    				        ' Some SPI commands can still be sent when isReady=0
    
    '*************************************************************
    '*************************************************************
    '******************** PIN ASSIGNMENTS ************************
    '*************************************************************
    '*************************************************************
    Symbol sensor	= PORTA.0			' 
    Symbol miso		= PORTA.3			'ISD1760 SPI MISO 
    Symbol led1	    = PORTC.1			'  
    Symbol led2	    = PORTC.2			'
    Symbol ss		= PORTC.3			'ISD1760 SLAVE SELECT  
    Symbol sclk		= PORTC.4			'ISD1760 SPI CLOCK 
    Symbol mosi 	= PORTC.5         	'ISD1760 SPI MOSI	
    	
    '*************************************************************
    '*************************************************************
    '******************** INITIALIZATION *************************
    '*************************************************************
    '*************************************************************
    initialize:
        CLEAR
    	OSCCON = %01111000
    	CMCON0 = 7				'turn off comparators
    	ANSEL = 0
    	
    	PR2 = 35				'PWM Period (40K=49, 56K=35) (35 to 55)
    	CCPR1L = 15				'PWM Duty Cycle (1 to 15)
    	T2CON = 4				'Timer2 = ON; Prescale = 1:1
    	CCP1CON = 0				'PWM module off
    	OPTION_REG = %11111111	'Turn off PortA weak pull-ups
    	
    	TRISA = %111111    		'set PortA directions
    	WPUA =  %000000			'enable weak pull-ups PortA
    	IOCA =  %000000			'disable PORTA.0 Int On Change
    
    	TRISC = %000000    		'set PortC directions
    
    	PORTA = %000000
    	PORTC = %000000    		'
    	
    	HIGH ss			'start with Slave Select HIGH
    	HIGH sclk		'start with SPI Clock HIGH
    	LOW MOSI		'start with MOSI LOW
    	
        INPUT sensor
    	LOW led1
    	LOW led2
    	
    	
    start:                       'Initialize the ISD
    	GoSub isd_pu
    	PAUSE 50		         '50 mS Power Up Delay (per datasheet)
    	GoSub isd_wr_apc 	     'set volume and config bits 
    	PAUSE 10
    	GoSub isd_clr_int	     'clear interrupt and EOM
    '*************************************************************	
    '*************************************************************
    '********************* MAIN PROGRAM **************************
    '*************************************************************
    '*************************************************************
    main_loop:	'(MAIN PROGRAM LOOP)
         
        PAUSE 2000
        
        s_addr = $010
        e_addr = $02b
        GOSUB isd_set_play
    
        PAUSE 2500
        
        GOSUB isd_stop
        
        PAUSE 2000
        
        s_addr = $02c
        e_addr = $048
        GOSUB isd_set_play
        
        PAUSE 2500
    
        GOSUB isd_stop
        
        PAUSE 2000
            
        s_addr = $049
        e_addr = $07c
        GOSUB isd_set_play
        
        PAUSE 4800
    
        GOSUB isd_stop
        
        PAUSE 2000
            
        s_addr = $07d
        e_addr = $093
        GOSUB isd_set_play
        
        PAUSE 2000
    
        GOSUB isd_stop
            
    	GoTo 	main_loop
    
    
    '*************************************************************	
    '*************************************************************
    '********************** SUBROUTINES **************************
    '*************************************************************
    '*************************************************************
    isd_pu:				
    	LOW ss
    
    	bSPI=$01		'Power Up Command
    	GoSub isd_spi
    	ISD_Data[0] = bSPI 	'SR0a
    
    	bSPI=$00
    	GoSub isd_spi
    	ISD_Data[1] = bSPI 	'SR0b
    
    	HIGH ss
    
    	RETURN
    
    '--------------------------------------------------------------------------
    isd_wait_ready:
    	GOSUB isd_rd_status
    	IF isReady = 0 THEN isd_wait_ready
    	RETURN
    
    '--------------------------------------------------------------------------
    isd_set_play:
    	LOW ss
    
    	bSPI = $80		'Set Play Command (7 bytes)
    	GoSub isd_spi
    	ISD_Data[0] = bSPI	'SR0a
    
    	bSPI = $00 
    	GoSub isd_spi
    	ISD_Data[1] = bSPI 	'SR0b
    
    	bSPI = s_addr.LowByte 	' Start Address low byte. 
    	GoSub isd_spi
    	ISD_Data[2] = bSPI	'SR0a
    
    	bSPI = s_addr.HighByte 	' Start Address high byte 
    	GoSub isd_spi
    	ISD_Data[3] = bSPI 	'SR0b
    
    	bSPI = e_addr.LowByte 	' End Address low byte 
    	GoSub isd_spi
    	ISD_Data[4] = bSPI 	'SR0a
    
    	bSPI = e_addr.HighByte 	' End Address high byte
    	GoSub isd_spi
    	ISD_Data[5] = bSPI 	'SR0b
    
    	bSPI = $00		' Reserved Address - set to "0"
    	GoSub isd_spi
    	ISD_Data[6] = bSPI 	'SR0a
    
    	HIGH ss
    
    	RETURN
    
    '--------------------------------------------------------------------------
    isd_wr_apc:			'Write to APC Register using bits D2:D0 to set Volume 
    	LOW ss
    
    	bSPI = $65		'Write APC2 
    	GoSub isd_spi
    	ISD_Data[0] = bSPI 	'SR0a
    
    	bSPI = %01000011	'Volume set by D2:D0 (000=Max)
    				'Output set by D7 (0=Aud, 1=Aux)
    	GoSub isd_spi
    	ISD_Data[1] = bSPI 	'SR0b
    					
    	bSPI = %00000100 	'PWM Speaker Output D8 (0=Enable, 1=Disable)
    				
    	GoSub isd_spi
    	ISD_Data[2] = bSPI 	'SR0a
    
    	HIGH ss
    
    	RETURN
    
    '--------------------------------------------------------------------------
    isd_spi:				        ' shift SPI data out and into SPI byte 
    	FOR spi_cnt = 0 to 7        '
    		MOSI = bSPI.0 		    ' shift LSB of byte onto MOSI line
    		LOW SCLK 		        ' clock MISO data out to uC (Falling Edge)
    		temp_bit = miso         '
    		HIGH SCLK		        ' clock MOSI into ISD1700 (Rising Edge)
    		bSPI = bSPI >> 1 		' shift SPI byte Right
    		bSPI.7 = temp_bit
    	NEXT spi_cnt
    
    	RETURN
    
    '--------------------------------------------------------------------------
    isd_clr_int:					' CLEAR INTERRUPT AND EOM BITS
    	LOW SS
    	
    	bSPI=$04		'Clear Interrupt Command
    	gosub isd_spi
    	ISD_Data[0] = bSPI 	'SR0a
    
    	bSPI=$00
    	gosub isd_spi
    	ISD_Data[1] = bSPI 	'SR0b
    
    	HIGH SS
    
    	RETURN
    
    '--------------------------------------------------------------------------
    isd_stop:					' Stop Immediately
    	LOW ss
    
    	bSPI=$02		'Stop Command
    	gosub isd_spi
    	ISD_Data[0] = bSPI 	'SR0a
    
    	bSPI=$00
    	gosub isd_spi
    	ISD_Data[1] = bSPI 	'SR0b
    
    	HIGH ss
    
    	RETURN
    
    '--------------------------------------------------------------------------
    isd_pd:					' Stop Immediately
    	LOW ss
    
    	bSPI=$07		'Power Down Command
    	gosub isd_spi
    	ISD_Data[0] = bSPI 	'SR0a
    
    	bSPI=$00
    	gosub isd_spi
    	ISD_Data[1] = bSPI 	'SR0b
    
    	HIGH ss
    
    	RETURN
    
    '--------------------------------------------------------------------------
    isd_rd_status:				'read status of ISD1700 
    	LOW ss
    
    	bSPI=$05		'Read Status Command
    	gosub isd_spi
    	ISD_Data[0] = bSPI	'SR0a
    
    	bSPI=$00
    	gosub isd_spi
    	ISD_Data[1] = bSPI	'SR0b
    
    	bSPI=$00
    	gosub isd_spi
    	ISD_Data[2] = bSPI	'SR1
    
    	HIGH ss
    
    	RETURN
    
    '*************************************************************
    '*************************************************************
    
    
    	End

Similar Threads

  1. ISD1700 series Winbond chipcorder
    By rickeybell in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 21st March 2010, 06:13
  2. optical voice link
    By Macgman2000 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 18th May 2008, 21:11
  3. Voice CODEC
    By Ron Marcus in forum Off Topic
    Replies: 0
    Last Post: - 15th May 2005, 19:28

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts