Hello - I have started playing with an ISD4002 and have a working circuit and program. If I just want to record a message using the REC command and then play it back using the PLAY command, everything works fine. However, when trying to specify the address to start recording and playback (using SETREC and SETPLAY), I get nothing. I have poured through the forum and the spec sheet, but I can't seem to find out what I'm doing wrong. I would like to be able to record 2 different messages on the ISD chip and be able to chose which one to play back. I am using a PIC16LF628A chip and V2.5 PBP. Any insight would be appreciated. Thanks! Here is my code:
Code:@ DEVICE HS_OSC ; Hi Speed Osc @ DEVICE WDT_ON ; Enable Watch dog timer @ DEVICE PWRT_ON ; Disable MCLR pin @ DEVICE MCLR_OFF ; Enable Power-up timer @ DEVICE BOD_OFF ; Enable Brown-out detect @ DEVICE CPD_OFF ; Code Protect Off @ DEVICE PROTECT_OFF ; EEPROM Protect Off include "ModeDefs.bas" DEFINE OSC 20 ' I/O Definition ' =============== ' TRISA = %00001100 ' PORTA Output on : ' PORTA.0 : Record LED ' PORTA.1 : Play Led ' ' PORTA Input on : ' PORTA.2 : "ALT PLAY" Button ' PORTA.3 : "PLAY" button ' TRISB = %01111001 ' PORTB Output on : ' PORTB.1 : ISD4002 SS pin ' PORTB.2 : ISD4002 SCLK pin ' PORTB.7 : ISD4002 MOSI pin ' ' PORTB Input on : ' PORTB.0 : ISD4002 INT pin ' PORTB.5 : ISD4002 MISO pin ' PORTB.6 : ISD4002 RAC pin ' PORTB.3 : "SETUP" button ' PORTB.4 : "RECORD" button OPTION_REG.7 = 0 ' enable pull-up on PORTB CMCON = 7 ' disable analog comparator ' Variable definition ' =================== ' RecordLED var PORTA.0 PlayLED var PORTA.1 AltPlayBtn var PORTA.2 ' "ALT PLAY" button PlayBtn var PORTA.3 ' "PLAY" button StopBtn var PORTB.3 ' "STOP" button RecordBtn var PORTB.4 ' "RECORD" button INT var PORTB.0 ' ISD4002 INT pin SS var PORTB.1 ' ISD4002 SS pin SCLK var PORTB.2 ' ISD4002 SCLK pin MOSI var PORTB.7 ' ISD4002 MOSI pin MISO var PORTB.5 ' ISD4002 MISO pin RAC var PORTB.6 ' ISD4002 RAC pin ' ISD4002 Control Values: ' bits 0, 1 & 2 are actually bits 9, 10 & 11 of address CmdPwrUp con $20 '%00100000 Power up the device CmdPlay con $F0 '%11110000 Start playback CmdRec con $B0 '%10110000 Start recording CmdStop con $30 '%00110000 Stop current operation CmdStopPwrDn con $10 '%00010000 Stop playback or record and power down CmdSetPlay CON $70 '%11100000 Set the playback address CmdSetRec CON $A0 '%10100000 Set the record address ISDAddress var word '**************************************************************** Pause 1000 high PlayLed HIgh RecordLED pause 500 low PlayLed Low recordled Start: 'scan buttons if Recordbtn = 1 then high recordLED pause 250 gosub RecordAudio low RecordLED endif if PlayBtn = 1 then high PlayLED pause 250 gosub PlayBack low PlayLED endif goto Start '**************************************************************** RecordAudio: ' Record message LOW SS 'Select isd4002 SHIFTOUT MOSI,SCLK,LSBFIRST,[CmdPwrUp\8] HIGH SS 'De-Select isd4002 PAUSE 25 LOW SS SHIFTOUT MOSI,SCLK,LSBFIRST,[CmdPwrUp\8] HIGH SS PAUSE 50 'start recording at address 0 ISDAddress.lowbyte = %00000001 ISDAddress.Highbyte = CmdsetRec 'ISDAddress = 10100000 00000001 LOW SS SHIFTOUT MOSI,SCLK,LSBFIRST,[ISDAddress\16] HIGH SS Wait4Stop: if StopBtn = 0 then goto Wait4Stop gosub StopOp 'Issue Stop Operation cmd return '**************************************************************** PlayBack: ' Play Audio LOW SS SHIFTOUT MOSI,SCLK,LSBFIRST,[CmdPwrUp\8] HIGH SS PAUSE 25 'start playback from address 0 ISDAddress.lowbyte = %00000001 ISDAddress.Highbyte = CmdsetPlay LOW SS SHIFTOUT MOSI,SCLK,LSBFIRST,[ISDAddress\16] 'Start Playback HIGH SS pause 25 Wait4Done: if int = 1 or StopBtn = 1 then goto wait4done gosub StopPwrDn return '**************************************************************** StopPwrDn: ' Reset ISDInt and power down cmd LOW SS SHIFTOUT MOSI,SCLK,LSBFIRST,[CmdStopPwrDn\8] HIGH SS pause 20 return '**************************************************************** StopOp: ' Stop Operation LOW SS SHIFTOUT MOSI,SCLK,LSBFIRST,[CmdStop\8] HIGH SS pause 20 return '**************************************************************** end




Bookmarks