|
|
View previous topic :: View next topic |
Author |
Message |
freedom
Joined: 10 Jul 2011 Posts: 54
|
isd4003 driver and software spi |
Posted: Thu Jul 16, 2015 1:00 pm |
|
|
hello all
I want to use ccs supplied isd4003.c driver to record and playback.
I want to interface isd4003 chip with 16f877a through software SPI.
I use compiler version 4.124
as example
Code: | #include <16F877A.h>
#fuses HS,WDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use spi(Master, Mode=0, DI=PIN_A1, DO=PIN_A2, CLK=PIN_A4, ENABLE=PIN_A5, BITS=8, MSB_FIRST) |
though this driver have already
Code: | #ifndef ISD4003_SELECT
#define ISD4003_RAC PIN_C1
#define ISD4003_SELECT PIN_C2
#define ISD4003_CLK PIN_C3
#define ISD4003_MISO PIN_C4
#define ISD4003_MOSI PIN_C5 |
what will be the real #use spi statement to drive isd4003 ?
Code: | //this function is used to record a message on the chip
void record_message(long address) {
} |
What will be the address ? A1 , A2..... or other ?
How many message can I record ?
suppose I have Isd4002 chip with 120 second duration.
Message 1 - 10 sec duration
Message 2 - 20 sec duration
Message 3 - 5 sec duration
Message 4 - 5 sec duration
Message 5 - 30 sec duration
Message 6 - 10 sec duration
Message 7 - 40 sec duration
total : 7 message and 120 sec duration
already I have seen the example Ex_voice.c but this is slight understandable.
as I want to record voice via microphone and playback if any error occurred, so I need an example on this issue. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jul 16, 2015 4:13 pm |
|
|
Post a list of your hardware connections between the PIC and the isd4003.
Post a table, similar to the one below, except fill it in with the correct pin
numbers for your board, and also put in lines for CLK, SELECT, and RAC.
Code: |
Pic pin isd4003 pin
PIN_A1 3
PIN_A2 2
. .
. .
. .
|
Check the connections with an ohmmeter to verify them before posting. |
|
|
luckyluke
Joined: 18 Apr 2006 Posts: 45
|
|
Posted: Thu Jul 16, 2015 6:11 pm |
|
|
is it still producing?
driver use software spi so you don't have to use spi
you can connect mcu to isd4003 with any pin you want (a4?)
you have to capture addresses
for example start with address 0
first record
record_message(0);(make button to start)
//10seconds record then finish with
add=stop_message();
(make button to stop or use a delay)
add (long) is the first records last memory address add it 1 for next record
start second record with address add
record_message(add+1);
//20seconds record then finish with
add=stop_message();
.... an so other records
isd4003 is works with 3.3V be careful |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jul 16, 2015 9:17 pm |
|
|
While we're waiting for your reply,
Quote: | #include <16F877A.h>
#fuses HS,WDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use spi(Master, Mode=0, DI=PIN_A1, DO=PIN_A2, CLK=PIN_A4, ENABLE=PIN_A5, BITS=8, MSB_FIRST) |
1. There is no need for the Watchdog Timer to be enabled in a program
where you are developing a driver. Add it later to the final program
when you're done.
2. Pin A4 on the 16F877A is open-drain when used as an output pin.
It requires an external pull-up resistor, and is a poor choice as the pin
for CLK, since your spi clock should have fast, clean edges. The pullup
will give you a slow rise time on pin A4, compared to using a normal i/o pin.
3. The isd4003 requires that the LSB comes first, not the MSB. This is
shown in the isd4003 data sheet, in Section 8: Timing Diagrams. The
first bit to come in or to leave the master, is the LSB. Also, in the CCS
example file, isd4003.c, they have a line of code that outputs the lsb first:
Quote: | for(i=0;i<16;i++)
{ // shift LSB first so it latches on rising edge
output_bit(ISD4003_MOSI, shift_right(&value,2,0));
delay_us(50);
output_high(ISD4003_CLK);
delay_us(100);
output_low(ISD4003_CLK);
delay_us(50);
} |
Which brings up another question. You said here,
Quote: | I want to interface isd4003 chip with 16f877a through software SPI. |
That is exactly what the CCS isd4003.c driver file does. It uses software
SPI. Look at the code above. It's a software loop that outputs 16 bits
and toggles the SPI clock with pin i/o functions. It's using software SPI.
Quote: | what will be the real #use spi statement to drive isd4003 ? |
The CCS driver doesn't need the #use spi() statement. The driver was
written before the #use spi() library was created. It does software SPI
with C code. |
|
|
freedom
Joined: 10 Jul 2011 Posts: 54
|
|
Posted: Fri Jul 17, 2015 4:33 am |
|
|
now SPI configuration for the ISD4003.c driver
#define ISD4003_RAC PIN_D2
#define ISD4003_SELECT PIN_D3
#define ISD4003_CLK PIN_C4
#define ISD4003_MISO PIN_C5
#define ISD4003_MOSI PIN_C6
In ex_voice example text to voice/speech.
Please give me an example to record via microphone and playback via speaker using the ISD4003.c driver |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jul 17, 2015 3:41 pm |
|
|
Quote: | In ex_voice example text to voice/speech.
Please give me an example to record via microphone and playback via
speaker using the ISD4003.c driver |
I don't have a chip to test, but using ex_voice.c as a base, I came up
with this minimal test program:
Code: |
#include <16F877A.h>
#fuses HS, NOWDT, BROWNOUT, PUT, NOLVP
#use delay(clock=20M)
#use rs232(baud=9600, UART1, ERRORS)
#define RED_LED_PIN PIN_B0
#include <isd4003.c>
//==========================================
void main()
{
int16 message_address = 0;
init_isd();
output_high(RED_LED_PIN); // Turn on LED to show we are recording
record_message(message_address); // Record message at specified address
delay_ms(10000); // Record for 10 seconds
stop_message();
output_low(RED_LED_PIN); // Recording done so turn off the LED
delay_ms(2000); // Wait 2 seconds before playback
play_message(message_address); // Then playback what we just recorded
while(TRUE);
} |
|
|
|
freedom
Joined: 10 Jul 2011 Posts: 54
|
|
Posted: Sat Jul 18, 2015 4:47 am |
|
|
thanks PCM Programmer
Code: | #use rs232(baud=9600, UART1, ERRORS) |
does this statement is necessary for this example ?
Ok I am going to test it |
|
|
|
|
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
|