|
|
View previous topic :: View next topic |
Author |
Message |
Guest
|
voice recording with 16F77 (ISD4003 chip) |
Posted: Thu Nov 24, 2005 9:57 pm |
|
|
hi,
i have problems in recording audio signal into isd4003 voice chip. I want
to record DTMF tones to the chip. I found DTMF tone generator on the net
and use it as source. I pull an audio signal from pc sound card, and
convert the audio level to about 25mVp-p (32mVp-p max for ISD4003).
I use isd4003.c provided by CCS and redefined the connections to follows:
Code: |
#define ISD4003_SS PIN_D7
#define ISD4003_MOSI PIN_D6
#define ISD4003_MISO PIN_D5
#define ISD4003_CLK PIN_D3
|
Unfortunately, when calling stop_message() after issuing record_message(0),
the return address is still 0, meaning no progress in records. Below is my
code:
Code: |
#include <16F77.h>
#fuses hs, nowdt, noput, noprotect, nobrownout
#use delay(clock=9830400)
#include "isd4003_custom.c"
#byte portd = 8
#use fast_io(d)
#define rs232_rcv PIN_A1
#define rs232_xmit PIN_A0
#use rs232(baud=9600, xmit=rs232_xmit, rcv=rs232_rcv, stream=com1)
#define fp fprintf
void main() {
long voice_address=0;
long last_address=0;
char reply;
delay_ms(1000);
set_tris_d(0x00);
fp(com1, "Voice chip ISD4003 test.\r\n");
fp(com1, "Initialize ISD chip...\r\n");
init_isd();
stop_message();
fp(com1, "Done!\r\n");
delay_ms(10);
fp(com1, "Ready. Enter 01h(record), 02h(stop), 03h(play)\r\n");
while(1) {
if(!input(rs232_rcv)) {
reply = fgetc(com1);
fp(com1, "Command -> %X\r\n", reply);
delay_ms(10);
switch(reply) {
case 0x01:
fp(com1, "Recording at address=%ld. Enter 02h to stop.\r\n", voice_address);
record_message(voice_address);
break;
case 0x02:
last_address = stop_message();
fp(com1, "Stopped. Last address=%ld\r\n", last_address); // <---- NO CHANGE IN ADDRESS RETURNED
break;
case 0x03:
fp(com1, "Playing voice. Enter 02h to stop.\r\n");
play_message(0);
break;
default: break;
}
reply = 0;
}
}
}
|
Any help? 10q |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Nov 25, 2005 2:30 pm |
|
|
If you look at the CCS example file, Ex_Voice.C, and the driver file,
ids4003.c, you'll notice that they don't use fast_io mode. They use
the default standard i/o mode, and let the compiler handle the TRIS.
You have instead decided to set the TRIS yourself, and enabled fast_io
mode which allows this. The problem is that you have setup Port D
as all outputs.
Quote: | #use fast_io(d)
set_tris_d(0x00); |
But look at the SPI interface pins that you've defined:
Quote: | #define ISD4003_SS PIN_D7
#define ISD4003_MOSI PIN_D6
#define ISD4003_MISO PIN_D5
#define ISD4003_CLK PIN_D3 |
"MISO" stands for "Master IN, Slave OUT". So that's an input pin for
the PIC, because it's the Master, and the isd4003 is the SPI slave.
But you've got it TRIS'ed as an output, so it's not going to work.
My advice is to either change the TRIS, or use standard_io mode as
CCS does in the example. Standard i/o mode is the default mode of
the compiler. You don't need to specify it. It's automatic, unless you
override it with "fast_io", etc. |
|
|
Guest
|
|
Posted: Fri Nov 25, 2005 9:49 pm |
|
|
thanks PCM, already comment the fast io mode+set_tris, but still no luck. Other suggestion? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Nov 25, 2005 11:35 pm |
|
|
Try using the CCS example file, EX_VOICE.C, instead of your program. |
|
|
Guest
|
|
Posted: Sun Nov 27, 2005 7:57 pm |
|
|
thanks for the replies PCM, already settle the problem. I change the chip to a new one and now it is working fine :-)
rgds, |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|