SX FAQ and other things
Rsadeika
Posts: 3,837
Since it was mentioned in another thread, I would like to bring it up here.
The idea by Guenther, about having a list for some of the programs that have been written is great. As more short programs get developed within these posts, they may just never get used, because·an incorrect search will not bring it up. Sometimes even some snippets could be very usefull, a consideration for that could be discussed.
The FAQ, a short line in the begging of the document, "The following·is applicable·for SX/B", or something like it might be appropriate (keeping in mind that their is another language comming online). When I started to look at the document it seemed to me that everything was going to be for the assembler, begginers get discouraged very easily.
I guess this is a chance for people to add their own comments and desires, I got my two cents in.
The idea by Guenther, about having a list for some of the programs that have been written is great. As more short programs get developed within these posts, they may just never get used, because·an incorrect search will not bring it up. Sometimes even some snippets could be very usefull, a consideration for that could be discussed.
The FAQ, a short line in the begging of the document, "The following·is applicable·for SX/B", or something like it might be appropriate (keeping in mind that their is another language comming online). When I started to look at the document it seemed to me that everything was going to be for the assembler, begginers get discouraged very easily.
I guess this is a chance for people to add their own comments and desires, I got my two cents in.
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
The users, who in my case are PAID to do their job, will not use them. You can refer them to the specific page (web based docs in my case), and they will see and use the very clear (by their admission) documentation. Then three days latter, in stead of going the page that you had them put on their favorites list, and is indeed on their favorites menu, they will call again, asking for help on the same thing.
Maybe they just like talking to me that much, but I don't think that's the case. We're not all movie stars...
People are lazy, and more significantly, even if it is easier to look something up, they generally prefer the interaction with other people, even people they may not like.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John R.
8 + 8 = 10
(grin) Jon, I guess I was hoping for a nice neat collection of your excellent little programs that provide instruction on how to do something. Sort of like an online version of Gilliland type topics only using your programs and headers like "Adding 16 bit numbers with an SX"
It seems that to find something, one has to slog through several back and forth discussions to find one message with a very concise program. Jon, you write some gems and I was hoping for an "Anthological Wisdom of Jon Williams" (grin).
John R. ... yes, I know the feeling. I'm finishing up a semester of teaching both Visual Basic.Net and Java. No matter how I write the tutorial and specifications, students seem to misintrepret my meaning. So, thank you .... I'll have to dive in both feet with this new search engine and see if I can improve my retrieval skills.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
I'm adding more projects each day... but still, with a big list of them somebody will say, "Gosh, why doesn't the help file have any examples" -- even though there is a section called "Example Projects."· Oi....
That said, I'm working on a book very cheekily titled, "The Tao of SX/B" -- it will be my take on good SX/B programming.· I'm maniacally anal-retentive about what I consider good programming practice and as my posted examples don't seem to be doing the trick (yet), perhaps a book will help.· To that end I've attached "The Elements of SX/B Programming" to this post; perhaps it will help somebody craft cleaner code.
And thank you for the "gems" comment.· I work very hard to craft clean, reliable, easy-to-understand code, and it's nice (I'm human too, despite rumors to the contrary) to be acknowledged.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
I just looked at your "attach" file, looks good. I would like to bring up one thing for you to maybe think about. Since this is an "Elements ... ", you may want to start out with a better explanation of the programming tenplate first.
I noticed that in the help file, under example projects, programming template, you show a version of a proper template. In the IDE, when you request a new SX/B file you are presented with a template that uses a paging concept. This could be a little confusing.
As for the template itself, maybe a brief·expansion of some of the absolutely necessary items that have to belong in an SX/B program. For example, in the device settings, what really has to be there. Crystal selection; with the SX tech kit you receive a couple of crystals, are these some parts that fell of the board, and now it is up to you to figure out where they go. INTERRUPT, when should that selection be made, or does it always have to be in there, ..., etc.
Since this is a mixed crowd (assemblers, PBASIC, SX/B,·and beginners), you may want to keep in mind that every viewer will have to be satisfied. This is not meant to be a critique, but just an observation as to what might be a point of interest for some people. Just something to consider.
On the template...·YOU·have·the ability to make the template anything you like -- that ability has always been there (change the TEMPLATE.SXB file in the Templates folder).
Finally, in my opinion anyone making the decision to move to the SX -- even with SX/B -- means that they're willing to work a little harder.· And because that's my opinion, I'm going to keep my feedback at a higher level than I would for the BASIC Stamp customer.· Will that irritate those that want to post "Will this work?" threads.· Yes.· Do I care?· What do you think? · All joking aside, I think that those of us at Parallax, and the many friends we have who also program the SX, that we will bend over backward to help any person who shows the smallest amount of initiative in solving their own problem.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
It may be worth mentioning here that you can substitute in your own template for the default one in SX/B by simply creating one and saving it to
C:\Program Files\Parallax Inc\SX-Key 3.1\Templates\Template.sxb
Then you can take the best of programming practices and incorporate them into your own template.
Jon,
It would be nice if the compiler allowed us to store multiple templates in that directory and not have it complain about it. For example, File New would show the list of templates with an *.sxt extension and you could select the appropriate template .... ah, wishful thinking.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
I can only speak conceptually, as my first SX kit order is "in process".
I could see having a few templates for different types of applications. For example, one my have some code for getting inputs from push buttons, and setting outputs for LEDs (or relays, or whatever). Another might be set up for serial in from one device, and serial out to a Servo or Motor controller. Yet another might be set up for working a PINKy.
This could all also be done by having "template" programs saved (as programs), and then open them and do a "save as".
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John R.
8 + 8 = 10
You're missing the point of the templates. What you are describing is more like library sub-routines. If you want that, then set up your own set of "include" files that handle just what you're suggesting. That way, all you need to do is add:
whnever you want to add your code for accessing buttons. Personally, I doubt that the work involved in setting something like this up would ever really pay off unless you always use the same I/O line in the same way on every project.
The point of the template feature is to allow the user to have a standard file that comes up whenever they start a new project that can be used for any project they work on. This means the won't have to type in all the device directives, etc that are common to all projects. If you write a program to access buttons, then it's either a program or a code example, but it's not a template.
Thanks, PeterM
With sincere respect, our feelings on template(s) and what they can/should be used for are different. I don't think either is "the" definition, and neither is "wrong". They are just different. Your looking from a viewpoint of what they "are", and how _you_ use them. I'm looking at what they "could" be, as _I_ could see using them. Nothing wrong with either viewpoint. Ultimately, Jon and the Parallax team will determine what they "should" be, and what way(s) they can or can't be used.
From my point of view, I wouldn't want to limit myself to just one template for a word processor. I have different ways I want things set up for different types of documents. I realize this is comparing apples and pork chops.
While the "include" files can bring in sub rountines, etc., they may not always have things set up for clean interaction between different sets of "gadgets" that are being interfaced.
I could also see one template for experimentation, testing and debugging a single device as part of a learning curve, with lots of variables and debug statements, and another "less robust" used for integrated development.
As I pointed out, templates are not the only way to do this, just one option that may make sense for some users, but certainly not all.
Then again, I haven't done any work with an SX yet, and may find I'm full of doodoo.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John R.
8 + 8 = 10
You can do this now: simply create the template files you desire then open them when you need them (and then use Save As before you compile [noparse][[/noparse]something you also have to do with a new file now]) -- it's no more steps that would be required if we were to enable the use of multiple templates from File | New. From my point of view, I'd rather spend our energy on the language than make the IDE super fancy. Like you say, there's no right or wrong; but as a Parallax employee part of my responsibility is assisting in the management of resources so we get the best return from them. In my opinion, multiple templates in the IDE gets us nothing (or darned next to it).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
I totally agree on the effort/benefit ratio. There are a number of ways to skin this cat. I wasn't trying to be argumentative, just explaining one possible concept.
I beleive we (Jon and I) were are on the same page, In my original posting I said:
This could all also be done by having "template" programs saved (as programs), and then open them and do a "save as".
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John R.
8 + 8 = 10
Post Edited (John R.) : 12/1/2005 9:43:47 PM GMT
Let me respectfully explain it this way - I am the programmer who has been maintaining and upgrading the SxKey IDE for the last 4 years, and I wrote the template support to provide exactly the functionality it has. Ergo, while you may feel that there are multiple definitions of templates, within the context of the SxKey IDE the definition I gave is currently "the" definition. The definition of a template in the SxKey IDE is a piece of boilerplate code that applies to all programs. It is not a program that has a specfic functionality. A program with specific functionality is no longer considered a template - it's a program for a specific task. If it helps clarify the intent of templates in the IDE, imagine that the word "generic" is applied in front of "template".
Thanks, PeterM
The SX/B "folder" allows only one SX/B file otherwise the compiler complains.·I was just hoping for the ability to put more files in that folder and·by saving it with an *.sxt extension, prevent accidental overwriting of the "standard" files that I use (I'm trying to avoid the apparently sacrosanct "template" word.) so my poor brain does not have to remember all of the settings (DEVICE, chip, LCD geometry, variable usage, etc).
I play around with SX18's, 28's and 52's.· Some projects are primarily designed for LCD's others are just data gathering devices.· None are noteworthy ... I just like to tinker.· I separate my major groupings of code into:
con definitions
var definitions
sub definitions
actual subroutine code
Thus my LCD routines are contained in·the following files:
LCD-con.sxt
LCD-var.sxt
LCD-sub.sxt
LCD.sxt (the subroutine code that I put at the end of the file)
I've developed·routines (or they are in process) for:
LCD
RS-485
RS-232
I2C
Weather Instruments
Generic Output (so that all you have to do is select the output device)
Cursor (Parallax and PHAnderson use different commands to do the same thing)
etc.
As I am humbly addressing Jon W. and PeterM (for those of you that don't know them, they are the "gods" of the SX chip), I submit that I am probably segregating my LOAD files incorrectly.
An LCD 4 bit demo that I submitted a while ago is attached if any of you are interested in seeing what I am talking about.· Please note that there are a couple of typo's in there and I have since updated that set of "standard" files.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
You are absolutely right. (grin) I had presented it orginally as wishful thinking and you had asked why I hadn't meant it to become this big of a concern.
The low cost is the very reason that I choose the SX over other chips (including the Basic Stamp) for my curriculum development project. I visualize students toasting chips right and left in the classroom and it is much easier to replace a $2-5 SX than a $40-100 module.
Keep up the good work. The fact that this forum is so large and moderated by Parallax employees shows the company's high level of committment.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
to protect your "standard" files from getting oberwritten by mistake, you might set the read-only attibute for those files, and you will be in good shape .
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G
Good idea. That would take the same amount of effort.
It's interesting that the SX compiler complains if there is ANY other file in the folder except template.sxb or template.src ... I wonder why it was designed that way???
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
RoboGeek
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There are·3 kinds of people in the world,
the dreamers, the do-ers, and the "Oh, what's this button do"-ers.
Formerly bugg.
www.parallax.com
www.goldmine-elec.com
www.expresspcb.com
www.startrek.com
·
To keep it simple, and prevent support problems for me from folks trying to use the templates feature to do things it was never designed to do. If the concept behind templates changes in the future, then the IDE will be changed to reflect it.
hanks, PeterM