PDA

View Full Version : A third substantial, entertaining and useful SPIN program for the BS2 programmer



SamMishal
07-09-2009, 07:09 PM
Hi All,
In an ongoing series of programs that were written with the express purpose of introducing a BS2 (PBasic) programmer to the Propeller (SPIN), I have posted two substantial as well as useful and entertaining programs that are translations (with enhancements) of two programs that appear in the two Stamp In Class courses “What’s A Microcontroller” and “IR Remote for the Boe-Bot”.
·
The Spin equivalents of these programs and explanations of their actions were posted in two previous postings
http://forums.parallax.com/showthread.php?p=818815 (http://forums.parallax.com/showthread.php?p=818815)
http://forums.parallax.com/showthread.php?p=821283 (http://forums.parallax.com/showthread.php?p=821283)
·
In this posting I am enclosing the third program in the series. This program is not a translation. Rather it is a combination of the two above mentioned programs.
·
The program illustrates how you can utilize the abilities of the propeller and SPIN on a slightly higher level than just a replacement for the Stamp. It is also fun to use. All the information you need to use the program is given in the information section at the top of the program.
·
The program allows you to use the Propeller with the PC and an Infrared Remote controller and a Speaker to allow a user to Select RTTTL (ring tones) music files to be played from among a list of files.·The IR remote is used as a Keypad for entering choices. The PC screen is used (via Serial Terminal) to display user prompts and feedback. You can either use a Piezo speaker or the Headphones amplifier provided in the Propeller Professional Development Board or the Propeller Demo Board to hear the music.
·
Besides being fun to use the program illustrates many aspects of programming in SPIN that can be readily related to and contrasted with similar code written in PBasic as shown in the Stamp In Class courses mentioned above. In this manner the experienced BS2 programmer would have a complex and substantial SPIN program that relates directly to PBasic programs. Thus the programmer can readily learn SPIN by building on and contrasting with his/her knowledge of· PBasic and the BS2 microcontroller.
·
The program IR_Music.Spin makes use of two objects. FullDuplexSerialPlus.Spin which is a library object that can be downloaded from the propeller OBEX (object exchange library) or from the PEK (Propeller Education Kit) library. The other is an object developed by me and is BS2_Commands.Spin.
·
The Zip file attached with this posting includes IR_Music.Spin, BS2_Commands.Spin and also FullDuplexSerialPlus.Spin. The serial object is enclosed in the zip file for your convenience, but do not use it if you already have one within your development environment. If you do not then use the one provided.
·
Read the instructions at the top of IR_Music.Spin for details of how to construct the circuit and IR receiver and for how to use the programs.
·
Also in the instructions I provide suggestions for further improvements of the program that you may want to implement as a challenge and to further your skills.
·
In a future posting I shall post a new version of the program that will use the TV display abilities of the Propeller to display the user interaction on a TV instead of using the Serial Terminal. Also I will implement the ability to enter data by using a PS2 keyboard in addition to the IR remote.
·
I hope this proves to be of use .....enjoy
·
Samuel
·