Ship me one, and I'll do it.
Ship me one, and I'll do it.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Me too!
Or... You can try it yourself
Most of this code was written for me by Jerson and I reconfigured to "fit my needs". The following will give you an idea on how to make the ISD1700 series jump and also telling them how high to jump AND how loud...
BrenonCode:SCLK var portc.0 MOSI var portc.1 MISO var portc.2 SS var portc.3 ' This array contains data to be sent to the ISD ' and on return it contains data reveived from ISD ISD_Data var byte[8] SR0 var ISD_Data[0] SR1 var ISD_Data[1] isCmdErr var SR0.0 isINT var SR0.4 isReady var SR1.0 Reg var byte Cnt var byte bSPI var byte ' the byte being transferred on SPI ADCON1 = %00000111 'Sets all A/D conversion to Digital input/output. TRISA = %111111 ' All A Ports input TRISC = %00000100 ' MISO is input TRISB = %00000000 SS = 1 SCLK = 1 MOSI = 0 ' Initialize the ISD ' ------------------------------------------------------------------------------------ gosub PowerUp pause 10 gosub WR_APC2 ' In my application, this sets the volume and config bits. 'You can use it as well if you desire. pause 10 gosub ClrInt 'This is the Set_Play command SetPlay: isCmdErr = 1 while isCmdErr ss = 0 bSPI = $80 gosub SPI ISD_Data[0]=bSPI bSPI = $00 gosub SPI ISD_Data[1]=bSPI bSPI = $10 ' Start Address low byte. (First packet of memory after effects)(Use your begin low address here) gosub SPI ISD_Data[2]=bSPI bSPI = $00 ' Start Address high byte (Use your begin high address here) gosub SPI ISD_Data[3]=bSPI bSPI = $00 ' end address low byte (Use your end address here) gosub SPI ISD_Data[4]=bSPI bSPI = $00 ' end address mid byte(Use your end address here) gosub SPI ISD_Data[5]=bSPI bSPI = $00 ' end address high byte / Note end address is 24 bits long. (Use your end address here) gosub SPI ISD_Data[6]=bSPI bSPI = $00 gosub SPI ISD_Data[7]=bSPI ss = 1 wend return PowerUp: isCmdErr = 1 while isCmdErr SS=0 bSPI=$01 gosub SPI ISD_Data[0] = bSPI bSPI=$00 gosub SPI ISD_Data[1] = bSPI SS=1 wend return 'This is the command I use to set the volume as stated above. I have the factory defaults tagged in brackets for reference... WR_APC2: isCmdErr = 1 while isCmdErr ss = 0 bSPI = $65 gosub SPI ISD_Data[0]=bSPI bSPI = %01000011 gosub SPI ISD_Data[1]=bSPI 'Factory default 'high byte 'low byte bSPI = %00000100 '(0100) (01000000) gosub SPI ISD_Data[2]=bSPI ss=1 wend return ' transact a byte with SPI interface ' You should come here after setting SS=0 for this to work SPI: for Cnt=0 to 7 MOSI=bSPI.0 ' shift MOSI from LSB SCLK = 0 ' clock the MOSI data if MISO then ' read the MOSI data @ bsf status,c else @ bcf status,c endif @ rrf _bSPI ' shift MISO into MSB SCLK = 1 next return ' clear Interrupt and EOM bits ClrInt: isCmdErr = 1 while isCmdErr SS=0 bSPI=$04 gosub SPI ISD_Data[0] = bSPI bSPI=$00 gosub SPI ISD_Data[1] = bSPI SS=1 wend return ' read status of Chip ReadStatus: SS=0 bSPI=$05 gosub SPI ISD_Data[0]=bSPI bSPI=$00 gosub SPI ISD_Data[1] = bSPI bSPI=$00 gosub SPI ISD_Data[2] = bSPI SS=1 return
Last edited by ScaleRobotics; - 26th October 2010 at 23:13. Reason: added code tags
I haven't tested the code yet (but thanks VERY much for posting it!!).
But I noticed one thing...
You have SR0 and SR1 as the first 2 bytes returned. The datasheet shows that the first TWO bytes returned are SR0 for every SPI command (as SR0 is 2 bytes long). So SR1 should actually be the THIRD byte returned?
SR0 var ISD_Data[0]
SR0b var ISD_Data[1] 'or whatever you want to name it
SR1 var ISD_Data[2]
Or am I missing something? I don't think this would cause a problem in your examples as you are not checking the isReady bit.
Good point... Your right, I'm not checking the ready bit, I'm simply playing a sound file at a given time (on a scanning light) and if the time approaches again before it finishes playing, the chip automatically "ignores" the next command sent UNTIL it is ready for a new command (on the next return of the light...)
But for future reference and expandability of my product, I will experiment a little on the SR0 / SR1 and correct so my code can see a ready bit in the future...
Thanks for pointing that out!
Brenon
I'm working on a modified version of the code, and hope to test it this weekend. I'll be driving the ISD1700 with a PIC16F684 and will post the final (working) code here. So far I am just checking all the commands against the datasheets.
I do have a couple observations.
The SetPlay command should only send SEVEN bytes. The END address is contained within TWO bytes (12 bits). That THIRD address byte (last byte sent) should be set to "0x00" as it is not supported in existing hardware. Same case for SetRecord.
I finally figured out your use of "While CmdError." Had me stumped for a while, then it clicked. That's pretty clever. Though it looks like in some cases it will be better to check the "RDY" status (depending on which command you are sending).
Also I did not realize that you can shift data into a byte using "status, c" carry bit in assembly. That is a very cool trick, indeed! Pretty much all of the other SPI examples I've found for PicBasic just used the Shiftout command which does not allow reading the Status bits.
For anyone interested, the original ISD1700 development kit made by Windbond (which cost me $270 from Digikey last year) does NOT support batch recording of sounds. You have to set the Start and End address manually and record one sound at a time. Very tedious and not usable other than basic function tests. However... there is a NEW ISD1700 development kit made by Nuvoton and it DOES support batch programming of wav files. So it can function as a decent production programmer. Unfortunately it's going to cost me another $270 - ouch. I called tech support at Nuvoton and they confirmed the new software is NOT compatible with the original Winbond development hardware.
You should also be aware that the Quadravox QV400D programmer never added support for the ISD1700 series. I still use it for programming ISD2560 chips, but they are starting to get expensive and much harder to find.
so someone would have to make himself friend with Winbond and suggest them an universal Gang device programmer
Not sure this worth it, look at current storage device pricing and add a higher level Microcontroller to it... NO way you're going to be over the Price of any single Winbond IC... not to mention you can update any part of your firmware and sound using a simple bootloading process.
Roman Black sounds almost the same as most Winbond solution and it's free, MP3 codec ICs are cheap, DsPIC are also cheaper... food for thought.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Requires porting of basic code but take a look at PIC iPod wav player.Not sure this worth it, look at current storage device pricing and add a higher level Microcontroller to it... NO way you're going to be over the Price of any single Winbond IC... not to mention you can update any part of your firmware and sound using a simple bootloading process.
Mono CD quality (16bit 44k) for the price of an SD card and holder,
a PIC18F4520, a few resistors for an R2 ladder, an audio amp and a speaker.
Or stereo 8bit 44k if preferred.
Up to 2 Gig's or 512 wav files.
Norm
Jerson done a FANTASTIC job while not having any hardware to test with!!These ISD chips are difficult to work with at a glance anyways...
I done more changing to the code I'm using by adding the 3rd byte to the status register and "singling out" the 2nd bit to check the status of the PLAY mode. With this bit, I can control the amplifier, which sound to play and when and so on...
More than adequate for the application I have![]()
Thanks everyone (including Jerson) for the code for these ISD devices. However we only have half of the issue resolved.
According to the code only "set_play" was included. How you gonna play something if it is not recorded?
What i am getting at is... in my original post.....
Show me a simple code to Record 5 messages using set_rec and play any of them back using Set_play... i.e. for the ISD17120
Thanks again.
There are 10 kinds of people. Those that know binary and those that do not.
Trying to understand how these devices work, I could not found a way to play e.g. the third message out of 10. How is the messages indexed? I mean if you record 10 messages, how can you know the position of each and how to play them?
Are these devices confussing or am I too dumb to get it? Doh...
Ioannis
I found the problem ..
TRISC = %00000000
Now all is ok !
Bookmarks