BasicMicroUK - Forums

www.basicmicro.co.uk
It is currently Sun Nov 18, 2018 11:26 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Shiftin/Shiftout compatibility with BS2
PostPosted: Sat Nov 14, 2009 6:43 pm 
Offline
Master

Joined: Fri Nov 13, 2009 6:28 pm
Posts: 115
Location: Reno, Nevada
The following code works with the BS2 and I want to use the Atom/nano in the future, but cannot get the shiftin/shiftout functions to operate with the Atom. I have tried every conceivable format and time delays etc. to no avail. I can't find timing charts of the Atom commands to compare to the BS2 format. The system uses an spi interface to a Winbond ISD chip.
All the posts I have been able to find don't clarify much, and mostly suggest time delays etc. Any help would be appreciated.
I also saw one post that said the manual was wrong and the shiftout and shiftin commands default to 16 bits instead of 8. Can't confirm this.
GETADD:X=1:W=1
PAUSE 200
SEROUT 16,baud,["LEARN STARTED"]:PAUSE 200
'POWER UP ISD
LOW 8
SHIFTOUT MOSI,SCLK,LSBFIRST,[1,0]:HIGH 8:PAUSE 50
'-------------------------------------------------------------------------
'CHK_MEM
LOW 8
SHIFTOUT MOSI,SCLK,LSBFIRST,[73,0]:HIGH 8:PAUSE 100
'FORWARD TO NEXT MESSAGE
LOW 8
SHIFTOUT MOSI,SCLK,LSBFIRST,[72,0]:HIGH 8:PAUSE 100
PROLOOP3:
'POWER UP ISD
LOW 8
SHIFTOUT MOSI,SCLK,LSBFIRST,[1,0]:HIGH 8:PAUSE 100
'RD_PLAY_PTR-READS AND DISPLAYS THE START
'ADDRESS OF ALL MESSAGES ON THE CHIP
LOW 8
SHIFTOUT MOSI,SCLK,LSBFIRST,[6,0,0,0]:PAUSE 100
'DISPLAY MISO DATA
LOW 8
SHIFTIN MISO,SCLK,MSBFIRST,[MISODAT1,MISODAT2,MISODAT3,MISODAT4]
Y=MISODAT3:Z=MISODAT4
'WHEN LAST ADDRESS IS READ MISODAT3 IS RESET TO 16,(BEGINNING ADDRESS)
IF W>2 AND MISODAT3=16 THEN GOTO LRNDONE
'Displays both the decimal and hex start addresses for each message
SEROUT 16,baud,["MSG# ",DEC W,"-(Dec ",DEC Y+(Z*256),")-(Hex ",HEX Y+(Z*256),")"]
'MISODAT3 IS THE LOWBYTE AND MISODAT4 IS THE HIGHBYTE,
'SECOND 8 BITS OF THE 16 BIT ADDRESS-IE:IF RECORD START
'ADDRESS IS GREATER THAN 255 AND FIRST BYTE IS 14, THEN
'ADD 256+14.ALWAYS ADD 256 TO RECORD ADDRESS IF ADDRESS
'IS GREATER THAN 255.
HIGH 8
'WRITE DATA TO EPROM
WRITE X,Y
X=X+1
WRITE X,Z
'FORWARD TO NEXT MESSAGE
LOW 8
SHIFTOUT MOSI,SCLK,LSBFIRST,[72,0]:PAUSE 500:HIGH 8
W=W+1:X=X+1:TOT=W-1
'TOT is necessary to stop automatic playback at the last message
GOTO PROLOOP3

_________________
Harley


Top
 Profile  
 
 Post subject: Re: Shiftin/Shiftout compatibility with BS2
PostPosted: Sun Nov 15, 2009 8:19 am 
Offline
Master

Joined: Mon Aug 18, 2008 1:26 am
Posts: 799
Location: CA bay Area
Nuts. I created a large document from the new manual about using SHIFTIN and SHIFOUT. But I had to make it into a PDF first. After doing that, I discovered the recent forum server breakdown has killed file uploads. So I can do nothing to help until that matter is resolved. You are NOT being ignored. Give it a day or two.
Take care.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Shiftin/Shiftout compatibility with BS2
PostPosted: Sun Nov 15, 2009 8:36 pm 
Offline
Master

Joined: Fri Nov 13, 2009 6:28 pm
Posts: 115
Location: Reno, Nevada
Thanks, I'll wait.

_________________
Harley


Top
 Profile  
 
 Post subject: Re: Shiftin/Shiftout compatibility with BS2
PostPosted: Sun Nov 15, 2009 11:05 pm 
Offline
Master

Joined: Fri Nov 13, 2009 6:28 pm
Posts: 115
Location: Reno, Nevada
I wanted to send the timing chart for the device but haven't been able to figure out how to send a jpeg to the forum. Will work on that if it is possible to do.

_________________
Harley


Top
 Profile  
 
 Post subject: Re: Shiftin/Shiftout compatibility with BS2
PostPosted: Mon Nov 16, 2009 12:09 am 
Offline
Master

Joined: Mon Aug 18, 2008 1:26 am
Posts: 799
Location: CA bay Area
That's just it. The server isn't allowing ANY uploads at this time. And it only accepts JPG and PDF files when it does work.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Shiftin/Shiftout compatibility with BS2
PostPosted: Mon Nov 16, 2009 12:43 am 
Offline
Master

Joined: Fri Nov 13, 2009 6:28 pm
Posts: 115
Location: Reno, Nevada
Ok. I wasn't sure exactly what you meant in your earlier reply, but that explains it. I was trying both jpeg and pdf files and now it all makes sense and I will wait until the problem is cleared to post the timing charts for the device I am using. Hopefully they will be helpful and can explain why the spi doesn't work. Thanks again!

_________________
Harley


Top
 Profile  
 
 Post subject: Re: Shiftin/Shiftout compatibility with BS2
PostPosted: Mon Nov 16, 2009 12:49 am 
Offline
Master

Joined: Mon Aug 18, 2008 1:26 am
Posts: 799
Location: CA bay Area
Can you supply the link address to the device's data sheet you are using? You can just copy and paste it here. Use the "URL" button above to make it a clickable link. That is:
- find the data sheet on the web, if possible.
- copy it
- open a reply window here
- click on the URL button
- immediately paste the link between the URL bookends
- post the message
If the data sheet can't be addressed directly, try supplying a site address that points to info we can use to figure this out.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Shiftin/Shiftout compatibility with BS2
PostPosted: Mon Nov 16, 2009 5:54 pm 
Offline
Master

Joined: Fri Nov 13, 2009 6:28 pm
Posts: 115
Location: Reno, Nevada
http://304044.dz-z.com/upload/303966/2008070203233742.pdf

This is the url to complete device design guide. The spi timing diagrams are on page 30. I have programmed a windows interface using VB2008 and have all aspects of the interface working with a BS2.

_________________
Harley


Top
 Profile  
 
 Post subject: Re: Shiftin/Shiftout compatibility with BS2
PostPosted: Wed Nov 18, 2009 1:36 am 
Offline
Master

Joined: Mon Aug 18, 2008 1:26 am
Posts: 799
Location: CA bay Area
And then we have a previous post about this same chip, complete with code:
http://forums.basicmicro.com/viewtopic.php?f=451&t=8611
Enjoy.
Happy holidays.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Shiftin/Shiftout compatibility with BS2
PostPosted: Wed Nov 18, 2009 2:51 am 
Offline
Master

Joined: Fri Nov 13, 2009 6:28 pm
Posts: 115
Location: Reno, Nevada
Don't know why, but I get the message "you are not authorized to read this forum".

_________________
Harley


Top
 Profile  
 
 Post subject: Re: Shiftin/Shiftout compatibility with BS2
PostPosted: Wed Nov 18, 2009 3:31 am 
Offline
Master

Joined: Fri Nov 13, 2009 6:28 pm
Posts: 115
Location: Reno, Nevada
I did get the commands to work with this device and in the process found out some interesting things. The Atom apparently does default to 16 bits on the commands, so if you need a byte, you should define it on each output (8). Many of the issues are time related and due to the fact I am using a Windows interface to evaluate the device, the serout commands must be slowed. I am now in the process of debugging the entire program and I think it will work well. Thanks for you help!

_________________
Harley


Top
 Profile  
 
 Post subject: Re: Shiftin/Shiftout compatibility with BS2
PostPosted: Wed Nov 18, 2009 9:08 am 
Offline
Master

Joined: Mon Aug 18, 2008 1:26 am
Posts: 799
Location: CA bay Area
Mmm, you timed out and had to log back in?
Good, it works for you now. Be a prince and leave a post about your final project in the "Projects" forum. This provides invaluable insight for other people working with the same part later. Pleeease?!
Happy holidays.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Shiftin/Shiftout compatibility with BS2
PostPosted: Wed Nov 18, 2009 6:50 pm 
Offline
Master

Joined: Fri Nov 13, 2009 6:28 pm
Posts: 115
Location: Reno, Nevada
Tried to access that url again and still get the same message "you are not authorised to read this forum". I don't get it yet. I am logged in etc. Must be something I am doing wrong? I will info on the "projects" forum. The project is an evaluation system for the ISD series chipcorders. Do you stay up all nite? Thanks for your help!!

_________________
Harley


Top
 Profile  
 
 Post subject: Re: Shiftin/Shiftout compatibility with BS2
PostPosted: Thu Nov 19, 2009 1:32 am 
Offline
Master

Joined: Mon Aug 18, 2008 1:26 am
Posts: 799
Location: CA bay Area
Ah, yes, it is in a "retired" section, which only moderators can reach. I quote it here for your study.
Quote:
I am now using the Winbond ISD1700 voice recorder chip in a small project, and I thought I would give a few hints and some code.
The 1700 series is sold by Nuvoton now <http://www.nuvoton.com/hq/enu>.
They have a series of chips from 30 to 240 seconds, more time can be had by slowing down the sampling rate (depending on sound quality needed) so you could get 483 seconds from the ISD17240 using the slowest rate.
Each memory location is a fraction of a second chunk depending on sampling time.
For my project I am using the ISD1760 (last two numbers is the second best recording time),
You will need the Data sheet but not the one on the Nuvoton site but the 82 page one I found on <http://www.vla.com.br/news/I1700%20Design%20Guide%20Rev%201.1.pdf>
Also the Address settings sheet at <http://www.nuvoton-usa.com/products/isd_products/chipcorder/applicationbriefs/AN-CC1005_a.pdf> off the Nuvoton site.
Recording time and quality can be set by a resistor on the Rosc pin (20) Page 7 of the data sheet.
You use Shiftin and Shiftout 4 wire with a ready test from the int/Rdy pin. ( this is optional you can just use pause times to allow the chip to play but it is sometimes not exact) .
I would buy the Cob1700 demo board to test.< http://www.nuvoton-usa.com/products/isd ... OB1700.pdf> it has everything but a speaker and is only $2 more or so. (note you cannot use the microphone on the cob board in spi mode without surgery, use the anain input with a small < 1watt amp).
Below is some code to play the chip after recording.
CPU = 16F628
MHZ = 4
CONFIG 16244
;THIS PROGRAM ERASES AND PROGRAMS 10 .125 SECOND SECTIONS, TEN TIMES AND THEN PLAYS THEM BACK USING THE ISD1760 VOICE CHIP.
;A6= LED LAMP, B3= STATUS FROM ISD1760 (RDY/INT), B4= DATA OUT OF ISD1700 (MISO), B5= DATA IN TO (MOSI) ON ISD1760)
;B6= CLOCK FOR ISD1760 (SCLK) LOW OUT ON DONE, B7= ISD1760 CHIP ENABLE (SS) LOW TO ENABLE
;CONNECT SPEAKER, MICROPHONE OR AUDIO, LED, AND THE FIVE CONTROL LINES TO THIS CHIP TO THE CHIP, SPEAK WHEN YOU SEE THE LED LIGHT UP.
;I START AT 20 THIS PUTS YOU ABOVE THE 15 SOUND EFFECTS RESERVED SECTIONS AT THE BEGINNING.

COMMADDRESS VAR WORD ;THE ISD1700 COMMAND SPI COMMANDS
VOICE VAR WORD ;THE VOICE SECTION NUMBER
VOICEDONE VAR BIT ;BUTTON VARIABLE FOR RDY/INT TEST

STARTOUTA ;THE ERASE AND RECORD SECTION
CLEAR ;CLEAR ALL VARIABLES
COMMADDRESS = 0X01: GOSUB CONTROLA ;COMMAND TO TURN ISD1760 CHIP ON.
LOW B7 ;ENABLE CHIP (SS)
SHIFTOUT B5,B6,LSBPRE,[0X65,%0000100001001000] ;CONFIGURE CHIPS ANALOG PATH (PAGE 17)
HIGH B7 ;DISABLE CHIP AND LATCH DATA (SS)
PAUSE 10 ;BUFFER
FOR VOICE = 20 TO 110 STEP 10 ;RECORDS 10 - 1.25 SECOND SECTIONS (AT THE 8KHZ. RATE)
COMMADDRESS = 0X82: GOSUB CONTROLB ;ERASE SECTION ON ISD1760
COMMADDRESS = 0X04 : GOSUB CONTROLA ;CLEAR RDY/INT PIN ON ISD1760
HIGH A6 ;TURN ON READY TO RECORD LED.
COMMADDRESS = 0X81: GOSUB CONTROLB ;RECORDS SECTION ON ISD1760
LOW A6 ;TURN OFF READY TO RECORD LED.
COMMADDRESS = 0X04 : GOSUB CONTROLA ;CLEAR RDY/INT PIN ON ISD1760
NEXT ;NEXT VOICE
PLAYSECTION ;THE PLAY SECTION
FOR VOICE = 20 TO 110 STEP 10 ;RECORDS 10 - 1.25 SECOND SECTIONS (AT THE 8KHZ. RATE)
COMMADDRESS = 0X80: GOSUB CONTROLB ;PLAYS THE VOICE SECTION ON THE ISD1760 CHIP.
COMMADDRESS = 0X04 : GOSUB CONTROLA ;CLEAR RDY/INT PIN ON ISD1760
NEXT ;NEXT VOICE
GOTO PLAYSECTION ;KEEPS PLAYING ON AND ON AND ON.

CONTROLA ;16 BIT ADDRESS SECTION
HIGH B6: HIGH B7: LOW B5 ;RECOMMENDED START STATE OF PINS ON ISD1700
PAUSE 10 ;BUFFER
LOW B7 ;ENABLE CHIP (SS, PIN 7)
SHIFTOUT B5,B6,LSBPRE,[COMMADDRESS] ;TURN ISD1700 CHIP ON, OFF OR CLEAR RDY/INT PIN
HIGH B7 ;DISABLE CHIP AND LATCH DATA (SS, PIN 7)
RETURN
CONTROLB ;48 BIT SECTION
HIGH B6: HIGH B7: LOW B5 ;RECOMMENDED START STATE OF PINS ON ISD1700
LOW B7 ;ENABLE CHIP (SS, PIN 7)
SHIFTOUT B5,B6,LSBPRE,[COMMADDRESS,VOICE,VOICE+10] ; ERASE,RECORD OR PLAY VOICE
HIGH B7 ;DISABLE CHIP AND LATCH DATA (SS, PIN 7)
INTLOOP ;RDY/INT LOOP TEST LOW ON READY.
Button B3,1,0,0,VOICEDONE,1,INTLOOP ;CHECK (RDY/INT PIN 27) ON 1700 FOR READY, IF NOT LOOP BACK
;NOTE YOU COULD USE (PAUSE 1100) INSTED OF CHECKING FOR END OF MESSAGE ON RDY/INT PIN
PAUSE 100 ;GIVES YOU A LITTLE SPACE BETWEEN LED ON AND OFF
RETURN

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Shiftin/Shiftout compatibility with BS2
PostPosted: Sat Apr 23, 2011 4:40 am 
Offline
Citizen

Joined: Sat Apr 23, 2011 3:29 am
Posts: 9
i have found that when trying to shiftin data you need to force the mosi line low and add a 1 sec pause in the code. right before you shift it in then bring the mosi line back high after you are done. i hope this helps ya out.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO