Using the SoundPAL with a Propeller chip
Macore
Posts: 41
Is it possible to use the SoundPAL with a Propeller chip? Will the SoundPAL run at 3.3V?
How can I do Serial I/O to the control pin without raising the output pin high?
For use with the Basic Stamp it says use SEROUT in an Open Collector mode.... What is this and how do I do that with
the propeller?
Thanks,
David
Sorry if this should go to the Propeller chip forum, I couldn't decide which was more appropriate so I put it here...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Often the joy is not so much in the having, its in the building...
How can I do Serial I/O to the control pin without raising the output pin high?
For use with the Basic Stamp it says use SEROUT in an Open Collector mode.... What is this and how do I do that with
the propeller?
Thanks,
David
Sorry if this should go to the Propeller chip forum, I couldn't decide which was more appropriate so I put it here...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Often the joy is not so much in the having, its in the building...
Comments
Yes!
Will the SoundPAL run at 3.3V?
Yes, but it will be louder at 5V, and it's okay to power it from 5V when used with the Prop.
How can I do Serial I/O to the control pin without raising the output pin high? For use with the Basic Stamp it says use SEROUT in an Open Collector mode.... What is this and how do I do that with the propeller?
The SoudPAL has a built-in pullup that pulls the input high when it's not being driven low. You emulate open collector mode by keying DIRA with your data, rather than OUTA.
________________
Attached is a SoundPAL demo program for the Prop, along with an object that you can use in your own programming.
-Phil
Thanks Phil, I was wracking my brains on that open collector thing, glad the answer is so simple!
-David
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Often the joy is not so much in the having, its in the building...
1) If using the SoundPAL with 5volt supply and the propeller chip should I not have a series resistor between the control pins?
Code extracted from your object:
PUB sendbyte(txbyte) | time
txbyte := (txbyte | $300) << 2 'Set up character with start and stop bits.
time := cnt 'Set initial time.
repeat 11 'Send 11 bits total.
waitcnt(time += BaudClock) 'Wait for next bit time.
dira[noparse][[/noparse]IOPin] := ((txbyte >>= 1) & 1 == 0)'Send next bit via dira.
2) I see that the sendbyte routine takes the byte to be sent adds 2 bits and rotates it as below:
bbbbbbbb => 11bbbbbbbb00 for a total of 12 bits being changed by the code.
Yet with a repeat 11 as used above only the first 11 bits will be sent and the last bit will be left rotated into the LSB but not sent from txbyte? Am I reading this code right? Why is this?
Also, what purpose do the 2 zero bits placed on the front of txbyte serve?
Finally, are you complimenting the bit sent because of using DIRA and not OUTA? (and just curious why == instead of NOT or !)?
I noticed from looking at a basic "serial" object for the propeller that its sendbyte routine is the same except it uses only $100 on the byte set-up and a repeat loop of 10. It does not compliment the bit sent to OUTA either. I see the similarity but seems there is the same problem with the LSB not being sent.
Serial communication protocol is not one of my strong suits, so I appreciate any answers you can give to help me understand whats going on here better...
Thanks very much,
-David
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Often the joy is not so much in the having, its in the building...
Actually it is the LSB that is "thrown away" by the first >>= as it goes through the repeat 11 and in fact the last bit added onto txbyte with the | $300 is sent. So the two bits placed in front of txbyte, one is thrown away and the other is the "start" bit? Why is this bit not a 1?
Now doubly uncertain about the == 0 though. According to the manual I would get 0 == 0 is true and 1 == 0 is false, false is 0 and true is -1... In other languages true is just non-zero usually a 1. Is the -1 in spin truly -1? wouldn't that be $ff then sent to DIRA?
Thanks for your answers, I am new to spin and trying to adjust my 30+ years of C and Assembler to its nuances.
-David
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Often the joy is not so much in the having, its in the building...
No series resistor is necessary. The SoundPAL will never drive its I/O pin high, and its pullup is too wimpy to cause any trouble.
2) Is the -1 in spin truly -1? wouldn't that be $ff then sent to DIRA?
Yes, true really is -1 == $ffff_ffff. However, since dira in that assignment is subscripted, only the pin indicated by the subscript is affected.
-Phil
So I think that answers all my questions, LOL... Only one final thing: I notice the "simple" serial object used to talk to the Parallax LCD display used ony one stop bit where you used two for the SoundPAL. The data sheet for the SoundPAL only mentioned it was 8 data bits and no parity... So, how did you know to use two? I see a lot of sensors use a serial protocol to talk with is one bit more typical with these devices than two? How can one tell which it is if the data sheet does not specify?
Thanks again for your time, please correct me accordingly if I have incorrectly stated anything in the posts above as I have struggled to work this out in my head.
-David
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Often the joy is not so much in the having, its in the building...
-Phil