 |
|
 |
| Parallax Forums > Public Forums > Propeller Chip > Book for absolute beginners. Propeller 101 | Forum Quick Jump
|
 |  Oldbitcollector Professional Stuntman

       Date Joined Mar 2007 Total Posts : 3370 | Posted 12/11/2008 7:51 PM (GMT -8) |   | | | |
  |  SRLM Registered Member

       Date Joined Jul 2008 Total Posts : 2720 | Posted 12/11/2008 10:29 PM (GMT -8) |   | | If you do end up publishing the book, be sure to include both pictures and circuit diagrams. | | Back to Top | | |
 |  Harprit Registered Member

       Date Joined Dec 2008 Total Posts : 62 | Posted 12/12/2008 5:48 AM (GMT -8) |   | Answer to questions Thanks for the encouragement from the Oldbitcollector I guarantee that the book will be published Yes, detailed wiring diagrams and very detailed explanations and descriptions will be in the book I am putting the programs out here to get feedback that they are suitable for the intended audience After getting the LCD program finished we will proceed to inputs and outputs. All of course in SPIN | | Back to Top | | |
 |  TonyF (spinvent.co.uk) Registered Member

       Date Joined Sep 2008 Total Posts : 14 | Posted 12/12/2008 6:05 AM (GMT -8) |   | | Hi Harpit - good luck with the book, I spotted a small typo in prog1 comments "...care called " | | Back to Top | | |
 |  ElectricAye Registered Member

       Date Joined Jul 2008 Total Posts : 972 | Posted 12/12/2008 8:06 AM (GMT -8) |   | Harprit,
If you want to stand out from the "crowd", puts lots of detailed comments in the code. I can never get enough.
good luck, Mark | | Back to Top | | |
 |  Harprit Registered Member

       Date Joined Dec 2008 Total Posts : 62 | Posted 12/12/2008 12:40 PM (GMT -8) |   | Answers to comments:
Thanks for comments, They are very important and they are appreciated very much. Typo picked up on all the lines As you can see I am heavy on commenting each and every line of code so there should be no concern on that. There is even more in the way of explanations in the text so there is much more Please keep the comments coming Every post will help the beginners Specially I need to know what you did not understand so I can fortify that. Every line needs to be understood
Harprit | | Back to Top | | |
 |  sam_sam_sam Soldering Junkie

       Date Joined May 2005 Total Posts : 1304 | Posted 12/12/2008 6:05 PM (GMT -8) |   | | Harprit
As you can see I am heavy on commenting each and every line of code so there should be no concern on that.
This was very easy for me to understand how to write SPIN
I wish there was more of this easy to understand code out there
This so very true
Every line needs to be understood
Mark
If you want to stand out from the "crowd", puts lots of detailed comments in the code. I can never get enough.
You are on the right track the best to you on this project 
Thanks for any that you may have and all of your time finding them
SamPost Edited (sam_sam_sam) : 12/13/2008 2:15:10 AM GMT | | Back to Top | | |
 |  KIH Registered Member
        Date Joined Apr 2008 Total Posts : 13 | Posted 12/12/2008 6:47 PM (GMT -8) |   | Nice Harprit, i love tutorials. :)
In program1.spin Not a big deal, but can confuse..
pin =21 {select the pin to be used for the LED} . . dira [pin]~~ {sets pin 16 to an output line} | | Back to Top | | |
 |  Harprit Registered Member

       Date Joined Dec 2008 Total Posts : 62 | Posted 12/12/2008 9:13 PM (GMT -8) |   | For all tutorial lovers there is a detailed description of a PID loop in plain English that I wrote for the current discussion going on on the PID loop. It is worth reading by all beginners. Please let me know if we need something like that in a beginners book.
Thanks for the corrections and comments to all. They have been picked up. Obtuse commenting will continue and hopefully more will write to tell what whey need so I can be as responsive as possible. No comment is trivial.
I am almost done on the LCD display. Should be on line in a day or two. Its working but I need to get the commenting up to par so all will understand a rather complicated program. I need more feedback on Program 2 so I can cover all bases before the next release.
HSS harpritsan.com | | Back to Top | | |
 |  Harprit Registered Member

       Date Joined Dec 2008 Total Posts : 62 | Posted 12/12/2008 9:54 PM (GMT -8) |   | Here is some correspondence that might answer some question you have. Question from a beginner are at the end of the lines of code.
My answers are at the end of this correspondence
[code] {{The first program turns an LED ON an OFF and demonstrates the use of subroutines in an absolutely minimal way. }}
{{Define the constants we will use. We do not have to specify a clock configuration the default condition will be used }}
CON {CON defines the constants} --ok _clkmode = xtal1 + pll16x {tell the program the clock mode to use. Not necessary} -- why not necessary _xinfreq =5_000_000 {specify the frequency to use. Not necessary} -- -- why not necessary pin =21 {select the pin to be used for the LED} -- ok waitPeriod =5_000_000 {set the wait period} -- of what? 5 million what ( i know it is clocks) but it could be us,ms? blink_count =20 {number of times to blink} -- ok high =1 {define the High state} -- ok low =0 {define the Low state} -- ok {{Define the variables we will use, if any. We will not use any but one is defined as a byte it would mean that we could have a value from 0 to 255 in the variable numbr }} VAR {Defines the variable here. Not needed in this program} -- so why define one? byte numbr {Have to have at least one defined variable here} -- why? {if we use (-- a) VAR. We will not use 'numbr' anywhere} -- confusing. I am assuming that if we assign a variable 'numbr' we can't use that label for anything else. {{This is the main part of the program. Everything else is in the 3 subroutines }} PUB Start dira [pin]~~ {sets pin 16 to an output line} -- you might go over this in the book but a parsing of the dira function would be nice. what does ~~ mean repeat blink_count {specifies how may times to repeat}- ok turnOn_the_LED {these 4 subroutines care called by name alone} --ok wait {these 4 subroutines care called by name alone} --ok turnOff_the_LED {these 4 subroutines care called by name alone} -- ok wait {these 4 subroutines care called by name alone} -- ok {this blank line ends the repeat command} --why? {this blank line ends the start routine} -- why PRI turnOn_the_LED {subroutine to set the LED line high} -- what is the diff between a PRI and A PUB? why should i use one or the other? outa[pin] :=high {line that actually sets the LED high} -- same question as dira. what does := mean? {this blank line ends this subroutine} -- again why? PRI turnOff_the_LED {subroutine to set the LED line high} --see above outa[pin] :=low {line that actually sets the LED low} {this blank line ends this subroutine} PRI wait {subroutine defines the delay} -- ok waitCnt(waitperiod +cnt) {wait till counter reaches this value} -- this is a totally non intuitive line. waitCnt?(5,000,000 + cnt? ) It would be nice if you started timing with something that has a 'real world' equivalent such as ms. It is hard for a beginner (me) to visualize 5,000,000 clock cycles. It just becomes a nebular number that has no meaning other than bigger is longer. {this blank line ends this subroutine} -- ok
Thank you very much for our notes. I will of course answer each point that you have raised. You need to at least have the propeller manual on hand. It can be downloaded of free. I will explain a lot of what you are asking me. However, here goes the rest! It tells you on the top lines that the clock does not have to be defined. Then it defines it to show you how to do this if you need to do it. Both pieces of info can be useful. Yes it is in clock cycles so the delay depends on what the clock speed is. In spin you work with clock cycles. Why? That's how it is! Again you don't need a variable but if you did this is how you would define one. I am just showing you how and telling you that its not needed but this is how you do it. If you use VAR then you have to have at least one variable defined, else it is an error, so I defined one you don't need and told you so. Now you know why. You could use nmbr anywhere where you needed a variable that was between 0 and 255 because nmbr is defined as a byte and 8 bits will hold only 255 max. dira is the direction of the 'a' port which is the 32 pins that are I/O on the propeller. ~~ means it is an output ~ means it will act as an input The blank line ends the routine because that is how you end a routine in SPIN!!! PUB means any one can call this subroutine PRI means only code in this program can call this subroutine waitcnt means wait for the counter. The counter runs all the time so you wait for 'delay plus cnt'. This way it does not matter when you start waiting.
Basically all the above is in the manual so please download it and read along with me. I promise you your time will not be wasted.
HSS | | Back to Top | | |
 |  SRLM Registered Member

       Date Joined Jul 2008 Total Posts : 2720 | Posted 12/12/2008 10:27 PM (GMT -8) |   | Personally, I think a 'beginners' book should start with the basics (variables, hello world, etc.) and end with some really advanced stuff (PID control, video generation, advanced mathematics, fuzzy logic, A/D). Give enough information in the begining to create a solid foundation, and the more advanced topics to give a footing in order to get started. Also, as a beginners book, I like them when about half is code, and half is theory. Anybody can find code out there to do what they want, or near enough. But if you don't understand why it works the way that it does, then you'll end up worse off then before.
Anyway, some topics that I would like to see addressed in published Propeller books:
Objects vs. Cogs Inter-cog/Inter-object communication Spin vs. Assembly and interpretation of each Propeller Standard Library (most common objects in the obex, and their methods with parameters and the like.) Step by step of interfacing with a chip (look at data sheet, find communication protocol, write code to fit) Image analysis Using Assembly for the Spin developer (not a assembly tutorial, rather a cut and paste type thing...)
Just some of my thoughts. | | Back to Top | | |
 |  Harprit Registered Member

       Date Joined Dec 2008 Total Posts : 62 | Posted 12/13/2008 3:11 AM (GMT -8) |   | Well, everything is in the Propeller manual so I see my goal as explaining it to the beginner. I will try to cover line 1 and 2 of your list approximately and that will take a good 300 pages I cannot possibly cover assembly for the beginner. It is not a beginner thing What you are asking for is an encyclopedia going from what is a variable? to fuzzy logic, image analysis!! and just about everything else. Lets keep it realistic and on the beginners table. What you are asking for wont be in a beginners book Even so you expressed some challenging idea and I will try to provide some of what you have suggested in the beginners format we are using I assumed that if you want to play with the Propeller and 8 32 bit processors, you know what a variable is By the time I get done you will have the confidence to program in SPIN and know how to interact with the COGS, that is the beginning, the rest is where you want to take it. Did you read the stuff on the PID loop and what use did you think it was to my efforts? Should this be in the book?
Thanks for posting, every bit helps me Harprit | | Back to Top | | |
  |  Harprit Registered Member

       Date Joined Dec 2008 Total Posts : 62 | Posted 12/13/2008 10:00 AM (GMT -8) |   | Just hang on Pi Guy All those things will be covered, in an orderly manner If you have specific part numbers in mind please let me have them so I can get them ordered Also let us make a list of things that need interfacing so they get discussed Thanks for taking the time to post. I need all the feedback and feed forward that I can get
HSS | | Back to Top | | |
 |  SRLM Registered Member

       Date Joined Jul 2008 Total Posts : 2720 | Posted 12/13/2008 11:08 AM (GMT -8) |   | I didn't mean to cover assembly and how to program it. Rather, I meant that it would be helpful (appendix maybe?) to have a section that helps you interpret assembly programs. For example, there are lots of objects in the obex that use assembly subroutines, and I don't need to modify them. I just need to know how to call them from spin, and get back to spin when it's done. I don't need to modify it or rewrite it, just use it out of context.
As for the more advanced topics, I meant (maybe didn't get this through) that it would be nice to have overviews or at least a pointer in the right direction. It doesn't need to be blow by blow code analysis, just what to expect when working with such techniques. I recently read a book (The Robotics Primer by Maja J. Mataric) that was very small (about 200 pages) and it covered all the main points of robotics, from hardware to software. I particularly liked the software sections where she explained in clear detail each of the different types of popular code methods. Something like that but in Spin and Propeller oriented would be great.
Advanced techniques belong in a beginners book. Why? For the simple reason of giving the reader perspective, and a footing to grow. It's a rough world out there when you don't know what to look for, and I like having a book give me a general principle that I can then look up. Such coverage does not need to be exhaustive. Indeed, it should be simple and short in order to not turn the reader away in the first place. | | Back to Top | | |
 |  Harprit Registered Member

       Date Joined Dec 2008 Total Posts : 62 | Posted 12/13/2008 11:51 AM (GMT -8) |   | SRLM
Well said and I will keep your suggestions in mind towards the end of the book Yes, very good indeed and thank you for posting
Harprit | | Back to Top | | |
 |  sam_sam_sam Soldering Junkie

       Date Joined May 2005 Total Posts : 1304 | Posted 12/13/2008 12:51 PM (GMT -8) |   | Harprit
From what I have read so far I like it a lot
It is easy to understand
I would add a few thing
I think that when you have a good understanding of how to use and write code for
VAR, CON, PINS for Inputs and Outputs and the like
Being able to write IF and THEN Statements
Being able to write DO , LOOPS / ( LOOP UNTIL , DO WHILE and the like or that is (=) to that)
And how to use and write code for a Ping Sensor , Motor Controller Time Chips
A better understanding of how the Video Code Routines and what each part dose
A better understanding of how the Key Board and Mouse Routines and what each part dose
Most of what user would want to use in there project Just the Basic no real fancy stuff is need until you are ready for harder stuff
I hope all of the make sense
This just my two cents for what it worth
Thanks for any that you may have and all of your time finding them
Sam | | Back to Top | | |
  |  Harprit Registered Member

       Date Joined Dec 2008 Total Posts : 62 | Posted 12/13/2008 1:02 PM (GMT -8) |   | Hang on Sam,
All that you want is coming, just like you want it. Here I post the programs the rest I am busy writing in the book It may surprise you that I did not know a thing about SPIN till a couple of weeks ago. Yes its true and I am pulling may hair out too! Manual very hard for dummies like me! So I am learning it along with you. Slowly slowly we will catchy monkey. What you said make a million dollars worth of sense. Keep it coming. Send me feed back on every program every time.
So now you know why I need your feedback so bad, I am ignorant. Help me.
Harprit | | Back to Top | | |
 |  sam_sam_sam Soldering Junkie

       Date Joined May 2005 Total Posts : 1304 | Posted 12/13/2008 1:11 PM (GMT -8) |   | |
Harprit
I am NOT TRYING TO RUSH you by no means AT ALL
All GOOD WORK TAKE TIME
I understand that VERY WELL
These GUYS are (   meaning ME ) going to have a lot of FUN Soon
They may be able to learn how to write SPIN SOON
YES WE DO some thing very easy to do and to understand not to the point of explaining what PID means
I think you explain what a PID dose very well as far as it pertain to using and writing a simple Routine as an Example
For all tutorial lovers there is a detailed description of a PID loop in plain English that I wrote for the current discussion going on on the PID loop. It is worth reading by all beginners. Please let me know if we need something like that in a beginners book.
Thank YOU for Your Hard Work for beginners
Thanks for any that you may have and all of your time finding them
SamPost Edited (sam_sam_sam) : 12/13/2008 9:45:59 PM GMT | | Back to Top | | |
  |  Harprit Registered Member

       Date Joined Dec 2008 Total Posts : 62 | Posted 12/13/2008 7:13 PM (GMT -8) |   | WMC
Well I'm working on it but I need your help. Read what I have posted and tell me what you understand and don't understand Its important that you participate
Harprit | | Back to Top | | |
  | 93 posts in this thread. Viewing Page : 1 2 3 4 | | Forum Information | Currently it is Saturday, November 21, 2009 11:40 AM (GMT -8) There are a total of 393,861 posts in 55,536 threads. In the last 3 days there were 84 new threads and 711 reply posts. View Active Threads
| | Who's Online | This forum has 17693 registered members. Please welcome our newest member, Fosco. 68 Guest(s), 16 Registered Member(s) are currently online. Details heater, Siri, Jay Kickliter, Mike Green, Jim Fouch, JRetSapDoog, Dogg, dMajo, hover1, ErNa, Harley, Sapieha, Electronegativity, Tubular, Toby Seckshund, MicroDirk |
Forum powered by dotNetBB v2.42EC SP2.02 dotNetBB © 2000-2009 |
|
|