Play a WAV sound using a PIC?

Status
Not open for further replies.

No it doesn't, D2A's are very uncommon on PIC's - but you can easily make an R2R D2A with a few resistors.

You should also be aware that a table can't normally cross a page boundary (256 bytes) due to the 8 bit address counter. There are ways to overcome this though!.
 
Nigel Goodwin said:
No it doesn't, D2A's are very uncommon on PIC's - but you can easily make an R2R D2A with a few resistors.

Thats ok. I found a schematic for one that i like it's just if the PIC had one build in that would save on pcb space and component count. I think the R2R option will be it then.

Nigel Goodwin said:
You should also be aware that a table can't normally cross a page boundary (256 bytes) due to the 8 bit address counter. There are ways to overcome this though!.

Please explain in detail (and in newbie style) because i dont understand what u mean (
 

A PIC table looks like this:
Code:
HEX_Table  	ADDWF   PCL       , f
            	RETLW   0x30
            	RETLW   0x31
            	RETLW   0x32
            	RETLW   0x33
            	RETLW   0x34
            	RETLW   0x35
            	RETLW   0x36
            	RETLW   0x37
            	RETLW   0x38
            	RETLW   0x39
            	RETLW   0x41
            	RETLW   0x42
            	RETLW   0x43
            	RETLW   0x44
            	RETLW   0x45
            	RETLW   0x46

It's basically a computed 'goto', but with 'retlw' instead of a 'goto'. The routine is entered with the required index value in the W register (W is only 8 bit, so that limits it to 256 bytes). This value is then added to the PCL register (program counter), and the program continues from that address - in this case a 'retlw' which returns to where it was called with the required value in W.

Now PCL is only an 8 bit register as well, the extra bits to cover the full memory range are stored elsewhere, so if the table crosses a 256 byte boundary the addition to PCL will send the program off somewhere else - which is likely to be VERY!!!! BAD.

For this reason tables are often stored at the beginning of memory, to make sure the table all fits in the first 256 bytes of memory.

In your case you will need 28 tables for your 7K file, and have to set the paging bits correctly for each one.
 

Using the PCLATH register, which stores the rest of the bits for the program counter. Application note AN556 explains it - but the MicroChip site seems to be off line at the moment.
 
Well, it depends...
First, you have to find an eeprom you like, and fits your budget / requirements... Then you need to desingn software to read/write to that eeprom...

if you take, for example, the eeprom i suggested and look at its datasheet
https://www.electro-tech-online.com/custompdfs/2004/05/doc3446-1.pdf
then you see its extremely easy...

jou just put the 14-bit address you want to read on pins A0 - A14 and give a pulse on the WE line and the data comes out of pins IO1 - IO7 as a complete byte, ready to be sent to the DAC...

if you use a set of 4094 shift registers then you can drive the 14 address lines with only 3 lines of your pic, in wich case even a small pic will do...
(4094 cost next to nothing)
 
Exo said:
jou just put the 14-bit address you want to read on pins A0 - A14 and give a pulse on the WE line and the data comes out of pins IO1 - IO7 as a complete byte, ready to be sent to the DAC...

Doesnt the WE pin make it WRITE to that address not read?
 

I have considered those, but they use a simple push button to make it record and i need to do it with precision. Also they do not seem to be able to continously loop the sound.
 
replace the pushbutton with an I/O line from your uC, you can repeat as many times as you like just tell the chip to play the sound again.

I juat ordered a speakjet chip should arive any minute now, have a look at these things they are text to speech and have built in sound effects as well, I think you can make your own sound with it too.

**broken link removed**

Ron
 
RonH said:
replace the pushbutton with an I/O line from your uC, you can repeat as many times as you like just tell the chip to play the sound again.

How do i get it to tell the µC that the sound has ended so that it can trigger it again? I read on the **broken link removed** that the RECLED pin pulses low at the end of playback. Perhaps my µC could retrigger playback when this is detected?
 
if you're only playing one sound over and over then time it. it will always end at the same time.

Ron
 
I had the same damn problem planning my project! Manually recording a WinBond chip has got to suck, if a bunch of segments are involved it's even worse.

I noticed the WinBond memory was accessible by the microcontroller, and could be configured as sound or nonvolatile RAM data.

I wondered if WinBond memory could be configured as data, programmed digitally, then reconfigured as sound. If so, I don't know the format or segment allocation tables. Maybe we could clone a reference chip without knowing the format?
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…