PDA

View Full Version : need help for APR6008 SPI interface



vu2iia
- 27th June 2009, 12:06
Hi All,

I am making VHF repeater interface for amateur radio, 2m band. I need help to control APR6008 using SPI. I have tried reading datasheet but didnot understand much, google search didnt help much. I want to be able to record and play 16 messages of 30 sec each, or 8 msg. of 1 min.

Any help would be very much appreciated.

See my exsisiting simple repeater interface http://www.vu2bbb.blogspot.com/

Thanks in advance

regards
Mahesh
vu2iia

Normnet
- 27th June 2009, 21:52
vu2iia

See PIC iPod wav player (http://www.picbasic.org/forum/showthread.php?t=10662)

Plays CD quality 44k (8 bit stereo or 16 bit mono) wav files from an SD card.
Up to 512 files or 2 GB.

Project specific parts are about $14.00 (less speaker, 5v regulator, caps, pot, etc.)

Presently in Proton but am porting to PicBasicPro.

Norm

Jerson
- 28th June 2009, 03:06
Hi Mahesh

I've not used this particular part, but have used the APR48000 and another similar one. The code is in 8051 C, but if it helps, I have attached it here.


/************************************************** *********************\
APR48000 voice record/playback IC routines
\************************************************* **********************/


/* Send a command to the APR48000
Cmd is the APR Opcode
Adr is the parameter for the opcode
Send order is Msb-Lsb
First the Cmd (Lower 6 bits), then Adr (Lower 15 bits)
PWRUP (4) (0x2)
REC (9)
PLAY (D)
FWD (3)
STOP (6)
*/
void CommandAPR(byte Cmd, uint Adr) {
byte BitCnt;

Cmd <<= 3;
Adr <<= 1;

APRcs = 0;
for (BitCnt = 0;BitCnt < 5;BitCnt++){
APRdi = Cmd & 0x80;
APRclk = 1;
Cmd = Cmd << 1;
APRclk = 0;
}

for (BitCnt = 0;BitCnt < 15;BitCnt++){
APRdi = Adr & 0x8000;
APRclk = 1;
Adr <<= 1;
APRclk = 0;
}
APRcs = 1;
}


/************************************************** *********************\
APR48000 voice record/playback IC routines
\************************************************* **********************/

vu2iia
- 29th June 2009, 14:40
Thank you norm for your reply. Its an interesting project.

Dear Jerson can I request you to help me convert the code into PBP. Trust me it will help many others like me. Hope u will find some time for it.

regards
Mahesh

Jerson
- 29th June 2009, 17:38
I think it is quite straight forward. Anyway, here goes. Unchecked, untested, use at your own risk and consequence



/************************************************** *********************\
APR48000 voice record/playback IC routines
\************************************************* **********************/


' Send a command to the APR48000
' APR_Cmd is the APR Opcode
' APR_Adr has the parameter for the opcode
' Send order is Msb-Lsb
' First the Cmd (Lower 6 bits), then Adr (Lower 15 bits)
' PWRUP (4) (0x2)
' REC (9)
' PLAY (D)
' FWD (3)
' STOP (6)

APR_cs var PORTA.0 ' define your own
APR_di var PORTA.1 ' define your own
APR_clk var PORTA.2 ' define your own

APR_Cmd var byte
APR_Adr var word
BitCnt: var byte


CommandAPR:
APR_Cmd = APR_Cmd << 3
APR_Adr = APR_Adr << 1
APR_cs = 0;

for BitCnt = 0 to 5
APR_di = APR_Cmd.7
APR_clk = 1;
APR_Cmd = APR_Cmd << 1 ' remove the bit we transferred
APR_clk = 0;
next

for BitCnt = 0 to 15
APR_di = APR_Adr.15 'unsure of this instruction
APR_clk = 1
APR_Adr <<= 1 ' remove the address bit transferred
APR_clk = 0
next

APRcs = 1;
}


/************************************************** *********************\
APR48000 voice record/playback IC routines
\************************************************* **********************/

vu2iia
- 30th June 2009, 03:19
Dar Jerson,

Thank you for helping me getting started, appreciate your time.

mahesh