Working with serial devices...
Zachariah
Posts: 6
Well hello forums people. Not to sounds as if I am sucking up but I would like to thank all the people that post on these forums. I have been using them to answer my question on many of my projects.
Okay down to business. I just got a SOMO-14D chip.
http://microcontrollershop.com/product_info.php?products_id=4360
there is already a post about this chip on these forums.
http://forums.parallax.com/showthread.php?122204-Help-with-a-sound-effect-device&highlight=SOMO-14D
This has really got me working in the right direction on getting my Basic Stamp Board to interact and operate the SOMO-14D chip.
However, I seem to be only able to get the first audio file to play over and over. Despite what code I put it.
I am trying to dumb down the code so that I can just get it to do what I want.
What I am having problems with is when I send the command for "Play/Pause" (HEX FFFE) the first file plays. However, when I send any hex code from 0012 - FFFE the first song will play. Then if I send hex code 0000 - 0010 nothing will happen and if I send hex code 0011 the second song plays.
Thank you for your time!
Okay down to business. I just got a SOMO-14D chip.
http://microcontrollershop.com/product_info.php?products_id=4360
there is already a post about this chip on these forums.
http://forums.parallax.com/showthread.php?122204-Help-with-a-sound-effect-device&highlight=SOMO-14D
This has really got me working in the right direction on getting my Basic Stamp Board to interact and operate the SOMO-14D chip.
However, I seem to be only able to get the first audio file to play over and over. Despite what code I put it.
'{$STAMP BS2} 'Stamp directive '{$PBASIC 2.5} 'PBASIC directive '----------{SOHO 14D Audio Module Commands}----------------- 'Play/Pause FFFEh 'Stop FFFFh 'Volume FFF0h-FF7h (In terms of volume) 'Songs 0000h,0001h,0002h,0003h,0004h 'PIN 1 NEXT 'PIN 2 NC 'PIN 3 CLK 'PIN 4 DATA 'PIN 5 BUSY 'PIN 6 PLAY/STOP 'PIN 7 PREVIOUS 'PIN 8 VCC 'PIN 9 GND 'PIN 10 RESET 'PIN 11 SPK+ 'PIN 12 SPK- 'PIN 13 NC 'PIN 14 AUDIO DEBUG CR, "Program Running" '----------{I/O}-------------------------------------------- Data1 PIN 1 Clock PIN 2 '----------{Initialization}--------------------------------- Main: DEBUG CR, "Initialization" HIGH Clock LOW Data1 SHIFTOUT Data1, Clock, MSBFIRST , [16\$FFF2] 'Set Volume to 3 of 7 GOSUB StartMusic PAUSE 5000 StartMusic: DEBUG CR, "Playing First Song" SHIFTOUT Data1, Clock, MSBFIRST , [16\$FFFE] 'Play PAUSE 1000 DEBUG CR, "Playing Second Song" SHIFTOUT Data1, Clock, MSBFIRST , [16\$0001] 'Play Second Song PAUSE 1000 RETURN
I am trying to dumb down the code so that I can just get it to do what I want.
What I am having problems with is when I send the command for "Play/Pause" (HEX FFFE) the first file plays. However, when I send any hex code from 0012 - FFFE the first song will play. Then if I send hex code 0000 - 0010 nothing will happen and if I send hex code 0011 the second song plays.
Thank you for your time!
bs2
2K
Comments
should be
[$FFFE\16]
not
[16\$FFFE]
Jeff T.
Syntax: SHIFTOUT Dpin, Cpin, Mode, [OutputData {\Bits} {,OutputData {\Bits}...}]
So like you have said. However, in my trouble shooting I figured out that if I put it how the help said to if would not play anything. Then when I wrote it with the bits declared first it would play... sometimes.
So, yes, I agree with you.
Thank you for your help!
Jeff T.
I tried your corrections and sorry to say there is no change. In the datasheet is says that if you the Play/Pause signal is sent to the chip it will automatically start playing the first audio file or continue playing the file that was paused.
Publison,
This is my first time posting on this website and I did not know what the polling was for. I first though people could rate how well I am answering peoples questions that are trying to help me. I see now that I may have been mistaken.
And welcome to the forums!
Jeff T.
From the SOMO manual:
When communication is required, the CLK is
brought LOW for a period of 2ms (START bit wait
time). Each individual data bit (starting with the
MSB bit15) is then clocked in sequentially. The
data is latched on every rising edge of the clock.
When the last data bit (bit0) is clocked in the CLK
signal must be held high for a period of 2ms (STOP
bit wait time) before the next command data is
sent. The clock HIGH and LOW periods are 100us
minimum.
Refer to “Section 7. Timing Diagrams“ for more
detailed timing and waveform information.
That's some slow data!
The CLOCK timing from SHIFTOUT (BS2) is 14us HI and 46us LO (60us total).
I think this will have to be bit-banged, PULSOUT will be a good option.
If this does not happen there is a hardware,wiring or SD problem.
Jeff T.
I did that when I first got the chip to test that it worked and test that the Vcc off of the Basic Stamp board 5v down to 3.5v. I removed everything and tested it again and it works just fine. When I momentarily ground the pin 6 (play/pause) the first audio file plays. The first audio file plays every time I momentarily ground pin 6. Then when I momentarily ground pin 1 (Next) the next file plays. I have three audio files and if I continue momentarily ground pin 1 it will just keep cycling threw them. Then if I remove power and reapply power, then momentarily ground pin 1 it starts from the second audio file.
So the chip works and I checked power again also and everything is good with that... I think.
Next I am going to look into using the PULSOUT. I will start reading up but the first question that I will have, before I have start reading up on PULSOUT. If I control the Clock with PULSOUT will I have to use that for the Data also? I mean control every bit that is sent, so as to slow everything down?
Next I am going to look into using the PULSOUT. I will start reading up but the first question that I will have, before I have start reading up on PULSOUT. If I control the Clock with PULSOUT will I have to use that for the Data also? I mean control every bit that is sent, so as to slow everything down?
Yes, totally.
Those are some slow-*** times (and they're MIN). The 2ms LO isn't part of the SHIFTOUT regime, neither those 100us_HI,/100us_LO clocks. SHIFTOUT speed is >> that. The data rate approximates 4800bps, but that clock held LO part... Carumba!
You present the data bit, and there's a minimum hold-up time for that, then you bring your clock HI, hold it, then send it back LO, and mind your end of data 2msec, too.
** Post Edit **
Been thinking about this.
I think it'll work out better using LOW pin, DELAY val and HIGH pin, DELAY val instead of PULSOUT.
Also as a side not, for some reason I am getting this slight "feed back" or clicking sounds when the microcontroller is sending data to the audio chip. I did not mention it before because I did not want to cruder my programming question with the electrical issues. I assume it is just one of the inputs on the audio chip getting bleed off from the data lines since I am using a resistor to ground to lower the voltage of the output. After I figure that out also I will post a schismatic and photos for all to enjoy.
HAPPY HOLIDAYS!
SHIFTOUT worked for the rest.
(Funny.)
So, you're happening; good deal.