Basic stamp II and SPI ( Serial Peripheral Interface)
Robert Mani
Posts: 7
Hello,
I want to be able to communicate with an ISD device ( sound recording and playing) part no ISD4003-05 fromWinbond electronics ·using basic stamp II.
One can only control this chip using a micorrocessor and puch buttons is not possible. From an exmapel application I found that there rae four connections between basic stamp II and ISD 4003. They are SSbar ( slave select),MISO ( master input, Slave output), MOSI ( Master output , slave input) and Clock. One can use 4 I/O pins of Basic stamp II to issue commands , read commands, send the clock signal and select devices.·I know about SHIFTIN and SHIFTOUT from Basic stamp manual and in the·ISD 4003 manual commands for recording and replay are given. For example for recording here is the sequence of commands
1- Send Power up command 00100(xxxxxxxxxxx) [noparse][[/noparse]Opcode<5 bit> plys Address <11 bits>
2-Wait T PUD ( power updelay ) for this model is 31 msec
3- Send Power up command
4-Wait 2 x T PUD ( power up delay ) , PS: I amnot sure why the power upcommand should be issued twice
5- Send SETREC· commandwith address 00 , 10100 ( A10-A0) , Initiates a Record operation from address < A10-A0>
6- SEnd REC command , 10110·<xxxxxxxxxxx>, records from current address until overflow is reached
Now here comes the question. I have not done extensive programming with Basic stamp and am not sure how I can combine SHIFTIN, SHIFTOUT commands for what is required to control this device.
I write an example program that I thought of , so if anybody can make a suggestion·or correction, it will be great
SSBar· PIN0
MOSI· PIN1
MISO··PIN2
CLK··· PIN3
POWERUP·· CON··· 00100
SETREC····· CON··· 10100
REC··········· CON··· 10110
Main
SHIFTOUT SSbar, CLK, 00100
pause 31
SHIFTOUT SSbar, CLk,00100
pause 62
SHIFTOUT SSBar, CLK, 10100<00>
SHIFTOUT SSbar , CLK, 10110
End
This is the best that I could come up with, Any suggestion to correct this basic stamp program will be great. Is it necessay to define a variable called "counter" and use that in a loop and assign each of the commands to this counter?·( e.g, Counter· VAR byte)or something like that,...
···
I want to be able to communicate with an ISD device ( sound recording and playing) part no ISD4003-05 fromWinbond electronics ·using basic stamp II.
One can only control this chip using a micorrocessor and puch buttons is not possible. From an exmapel application I found that there rae four connections between basic stamp II and ISD 4003. They are SSbar ( slave select),MISO ( master input, Slave output), MOSI ( Master output , slave input) and Clock. One can use 4 I/O pins of Basic stamp II to issue commands , read commands, send the clock signal and select devices.·I know about SHIFTIN and SHIFTOUT from Basic stamp manual and in the·ISD 4003 manual commands for recording and replay are given. For example for recording here is the sequence of commands
1- Send Power up command 00100(xxxxxxxxxxx) [noparse][[/noparse]Opcode<5 bit> plys Address <11 bits>
2-Wait T PUD ( power updelay ) for this model is 31 msec
3- Send Power up command
4-Wait 2 x T PUD ( power up delay ) , PS: I amnot sure why the power upcommand should be issued twice
5- Send SETREC· commandwith address 00 , 10100 ( A10-A0) , Initiates a Record operation from address < A10-A0>
6- SEnd REC command , 10110·<xxxxxxxxxxx>, records from current address until overflow is reached
Now here comes the question. I have not done extensive programming with Basic stamp and am not sure how I can combine SHIFTIN, SHIFTOUT commands for what is required to control this device.
I write an example program that I thought of , so if anybody can make a suggestion·or correction, it will be great
SSBar· PIN0
MOSI· PIN1
MISO··PIN2
CLK··· PIN3
POWERUP·· CON··· 00100
SETREC····· CON··· 10100
REC··········· CON··· 10110
Main
SHIFTOUT SSbar, CLK, 00100
pause 31
SHIFTOUT SSbar, CLk,00100
pause 62
SHIFTOUT SSBar, CLK, 10100<00>
SHIFTOUT SSbar , CLK, 10110
End
This is the best that I could come up with, Any suggestion to correct this basic stamp program will be great. Is it necessay to define a variable called "counter" and use that in a loop and assign each of the commands to this counter?·( e.g, Counter· VAR byte)or something like that,...
···
Comments
support of Winbond confirmed that one can use basic Stamp II as a repalcement. I can provide a sketch of that connection if needed.
Please read the manual or help file on the SHIFTOUT command. You appear to want to send binary data, but that’s not what you’re sending in the examples you have. You’re sending the decimal equivalent or in the first SHIFTOUT for example, you’re sending a value of one hundred (100) rather than four (4).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering