jb-koeste Guest
|
ISD17240 |
Posted: Tue Mar 02, 2010 3:21 am |
|
|
hello everybody ;-)
I searched in different forums for using an isd17240 with an 18f4550 via spi, but I haven't found useful stuff.
I wrote a code but it doesn't work.
Code: |
#include <18F4550.h>
#use delay (clock=20000000)
#fuses HS,NOWDT, NOPROTECT, NOLVP
#use spi(Master, Mode=2, DI=pin_B0, DO=PIN_C7, CLK=PIN_B1, BITS=8, LSB_FIRST)
#define SS pin_a5
#define SPI_MODE_2 (SPI_H_TO_L)
void pu(){
spi_write(0x00);
spi_write(0x01);
}
void play(){
spi_write(0x00);
spi_write(0x40);
}
void rec(){
spi_write(0x00);
spi_write(0x41);
}
void clr_int(){
spi_write(0x04);
spi_write(0x00);
}
void stop(){
spi_write(0x00);
spi_write(0x02);
}
void main()
{
set_tris_a(0b11011111);
set_tris_b(0b11111101);
set_tris_c(0b01111111);
setup_spi(spi_master | SPI_MODE_2 | spi_clk_div_64|SPI_SS_DISABLED);
delay_ms(100);
output_high(pin_a5);
//init();
delay_ms(100);
output_low(pin_a5);
delay_ms(50);
pu();
delay_ms(10);
output_high(pin_a5);
delay_ms(50);
output_low(pin_a5);
delay_ms(50);
rec();
delay_ms(10);
output_high(pin_a5);
delay_ms(3000);
output_low(pin_a5);
delay_ms(50);
stop();
delay_ms(50);
output_high(pin_a5);
delay_ms(10);
output_low(pin_a5);
delay_ms(50);
stop();
delay_ms(50);
output_high(pin_a5);
while(true){
}
}
|
I disabled SS because I use pin_a5.
In stand alone mode the ISD17240 works.
This program should record a sample for 3 seconds and then replay it.
And sry 4 my bad english ^^.
I hope you can help me :-( ...
jb |
|