A Change to Frequency Synthesizer Demo Ver 1.1
W8VK
Posts: 30
Hello All!
I guess I'm not any good at changing spin code in programs at all, as i can't see a method to make a change to the FrequencySynth.spin code that would allow the orginal Con of frequency and Pin to load, and continously repeat the frequency, but give an option in a subroutine to be asked for a new Input for frequency that would run in the repeated loop but again ask for a new change in frequency!
Does this also require a change to the Synth.spin to incorporate such a reoccurring input?
Thanks for reading my post!
Rich W8VK
I guess I'm not any good at changing spin code in programs at all, as i can't see a method to make a change to the FrequencySynth.spin code that would allow the orginal Con of frequency and Pin to load, and continously repeat the frequency, but give an option in a subroutine to be asked for a new Input for frequency that would run in the repeated loop but again ask for a new change in frequency!
Does this also require a change to the Synth.spin to incorporate such a reoccurring input?
Thanks for reading my post!
Rich W8VK
Comments
For example you could run a loop which reads a frequency value from a serial object. Once you press Enter this frequency value is passed to the Synth object and then the loop waits for new input.
But I'm not versed enough in spin programming to add this component! I've dealt with basic and going to subroutines, but i'm lost here! Thanks for your reply!
Rich W8VK
Thank you very much for this idea and I will "play with coding" and see how far i get on this and then share it here with you!
Rich W8VK
synth_prompt.zip
-rogersyd
That worked out very well! I attached 2 files! One is for my comm port Prop, and I guess you have the USB version! I will now play
with a Visual Basic Express 2010 Version to take the place of the Serial Port Program! Many thanks for the help and i'm sure others
will want to play too!
Rich W8VK
Thanks for replying and i'll check it out and get back with a post to you!
Rich W8VK
The attached (2) spin files are corrections to authoring of this project! Thanks!
Rich W8VK
I'm getting back with you Rogersyd to let you know I was able to run your program fine!
I set the speed faster for me and perfer the other program because of less return info to the
Serial terminal and amount of response time!
Great job in codeing and appreciate the excellent help and your codeing method provided!
Well done and Thanks!
Rich W8VK
It was fun writing it. I learned a bit about the synth object in the process. While looking in to this I found very well written tutorial and example code recently posted by Nick over at Gadget Gangster:
http://forums.parallax.com/showthread.php?129413-New-Tutorial-Make-a-Propeller-Synthesizer
His code use SIDSynth instead, and adds TV output and keyboard input (the approach i prefer over PC/Terminal). For my purposes I will modify the interface a bit to replace the piano key interface with a more flexible direct frequency input mechanism of some sort. I have always been fascinated with brain wave synchronization technologies like those developed by Robert Monroe and hope to build a device that essentially amounts to a portable synth tailed to generating those types of tones.
Good luck on your project!
I will do that soon and have another 2 versions with 2 synthesizers running at the same time!
I didn't really know how to approach the Modifications! Will Update soon!
Rich W8VK
I have made the following changes to this program in the attached files! I am wanting to create a menu system that will let me make several types of frequency entries and keep them going and have the choice to move to the menu to do other things!
Also i think i'd like to have some kind of Pub Ini setup to set all the Frequencies to a particular start point! Please review the changes and let me know what you think so far!
Any and all ideas, suggestions, and examples of menus are very much welcome! Thank you all for your help and intrust in this project!
Attached are the Comm Port and USB (new) Programs!
Rich_W8VK
I have included 4 Files on the FrequencySynth.spin that has been modified in D to enter two frequencies continously!
Part C has a change to enter frequency1 and frequency2 together, or individually and the method to do that is Questionable as to being even possible! Only Frequency1 will run in this.
Part A is frequency1 code that works by itself ok! Part B is Frequency2 code that works by itself! Part A and Part B are made into Part C to see if a method is possible to devolope to selsect input to both frequency 1 and frequency 2, or just frequency 1 by itself, or frequency 2 by itself?
Does anybody think this is possible to do? Can anybody suggest working exampls of spin files, or references that might be a key to a working method to make Part C a workable program? Thanks for reading this post!
Rich W8VK
I did get this to work ok! But I have an earlier version that does the same boring thing basically! I think i'm seeing the limitations in spin language as compaired to what i made as an actual menu with subroutines with the Basic Stamp 2. I believe at this point it's probably time for me to investigate the PBasic for the Propeller as it can do subroutines where this language is so difficult to write in and i haven't seen anything for the propeller like this. I have written in the orginal Basic 3.22 and the Stamp Basic along with Visual Basic and Visual Studio which are easy to me. Spin language either isn't developed far enough yet or isn't based that way. Thanks for the effort!
I wanted to be able to select only one at a time and then be able to change that choice to another choice with both still running. I believe that takes a Menu system with subroutines. I don't know much about PBasic yet but it's propably much like the BS2 Basic which i have written menu programs with subroutines in the BS2. But i don't see subroutines and actual menu stuff in spin language.
The two things i saw accomplished here in spin language were entry into A and B rotating continously for frequency updates, or just entries into A continously updating A.. But i need to be able to do much more for a good design for a frequency synthesizer. And i think other people want to play but its too limited at this time. Who knows, maybe i'll have to deal with a different microprocessor. But i think that programming really looked difficult in a different processors too. Thats why hobbiest arent playing with those processors. You about need a 4 year computer sience degree to play with them. Thanks again!
Rich W8VK
If the main loop is supposed to handle other input then this has to be added. ATM it only deals with setting channels A and/or B.
Thanks for replying! maybe i don't have the program constructed correctly from the code you posted in #18 posting. I tried doing the code in two programs which i don't think they are operating for me the way you intended! I will try to attach 2 ways i wrote this up and tried running them. Please explain total operation of program and if the codeing is correct! Appreciate you hanging arround and applying your expertise! Thanks!
Rich W8VK
I'm not entirely sure why you added those methods. As they are effectively the same (ignoring outa behaviour as there was no dira setup in the original code) I merged them into a single method, VFO(chn).
The main loop does the following (posting #18):
- flush the input buffer
- prompt for command (setting VFO A or VFO , press "a" or "b"
- in a local repeat loop get the command character, uppercase it and repeat if we didn't get "A" or "B"
- call VFO setup/update with either "A" or "B" (channel)
- get next command character
If you have more commands in the future steps 3 and 4 could become either a method call with a case statement or you could embed the case statement in the main loop and call the relevant command handlers from there. For example: I'm still puzzled about your menu comments in the source, e.g. which menu would you escape to? Are you saying that VFO control is a sub menu which is initially selected from an as yet unspecified main menu? Maybe we should get this program flow sorted first. Having what looks like 2 methods/functions doesn't justify any complexityattached on this reply will be the program ill correct to try and get it to operate your way! please look at the file attachment and see what needs corrected! Thanks for all! Your a great person to be working with!
Rich W8VK
As for its intended function see posting #22 (numeric list).
Here is the 2 versions i got working for the USB and Comm Port. Very nice indeed!
The only thing not interfaced into the programming is the CON PinR = 20 that is high when a is selected, and low when b is selected!
But it does a nice job switching from a and b entries! Cool Beans!
I have had family things keeping me away for a time but maybe will settle down here now! Way to go!
Rich_W8VK
The PinR works this way! If you type a and Hit the enter key then backspace to update VFO A Frequency, PinR 20 goes high and stays high until you type b and hit the enter key for b and backspace to set in a new frequency entry for b which PinR then stays low until you would type a and hit the return key again which sets PinR high again!
Rich W8VK
That works perfect for the vfo switch! I have taken the program to 2 versions. One for use as a Receiver VFO and The second for use as a Transmitter VFO. Also included is the USB Port Versions!
They work great! Nice programming job following my thoughts! Check out the Pin changes between the versions! Please continue to the next posting! Thanks!
I think these 4 programs are ready for archive! Don't you?
Rich W8VK
The last part of this project is to combine Posting #29 Programs. To try and take the PinA, PinB, and PinR from the first version and combine with the second version PinC, PinD, and PinT for the posted file i've started on this reply. See the 2 attached files i've started.
In the past, I could only run 2 synthesizers! Don't know why 4 wouldn't run as an entry in order to the 3rd and 4th shut down the first 2. Please take a look at the attached 2 files. Is this possible to do? Thanks!
Rich W8VK