Do I have the right idea in the way I am commenting on the code commands.more to come
sam_sam_sam
Posts: 2,286
''A .pdf copy of the book is available from www.parallax.com, and also through ''the Propeller Tool software's Help menu (v1.2.6 or newer). '' ''File: LedsOnOff50PercentAgain.spin ''Leds alternate on/off 50% of ''the time with the ! operator. PUB BlinkLeds dira[4..9]~~ ' (~~) Post Set / sign-extend from bit 15 ' outa[4..9] := %100001 ' ( %100001 ) 1 = set or ON and 0 = clear or OFF ' ' ( [ ..] ) equal to the value of the symbol or ' expression to the right of ' the of the operator repeat !outa[4..9] ' ( !outa[4..9] ) invert pin direction state bits [x..y] ' ........ this is what mean " ! " by solo waitcnt(clkfreq/4 + cnt) ' wait 1/4 of a second
Comments
Looks good from here..
OBC
Personally, I would say "invert pin direction state bits [x..y]", just because it speaks to exactly what is happening.
Is this any better I changed above
OBC
Just to let you by me doing this I am being to understand this a little more and I am VERY sure that will many more question like this as I go a long
If I do calculations, often I'll stuff those in there just as notes. They help me later when I go to change something that isn't programmed to happen automatically, like "magic numbers" in that I can see what the heck I did!
And I'm not the best commenter, but getting better.
When I first start writing P-basic code when I went through
What is a Micro Controller
I did not have to comment very much of it because I understood most of the basic code command there still some commands I do not understand how to write them or understand how they work but that very few
But now going through
Propeller Education Kit Lab
With Spin this a hole another story
To me the command are very different
Some of the basic command are hard for me to understand
The reason why something it is written the way it is .
Some people decorate such blocks with special character sequences to make them stand out. Such special decorations to make it easy to spot where key things like methods and routines start in the code. Be creative if you like, but don't over do it.
Just my .02
These for now are just outline for me to learn from but at some point I do want to clean them up so that other people can use them
I have one thing to ask is there any one out there that would be willing to help clean these comment up as I go along
Because I can see that this seem to be the best way for me to learn these command and how to use them
and
I wonder how many other people on this forum feel the same way comment are welcome
Please keep in mind that I want to have the comment so that a beginner can understand them
I want beginner and experts to Please leave there comments thanks
I like to use big special character comments like this too:
'
' Setup the counters
'
mov A, B 'prepare to calculate frequency
add A, C 'add delta to base value
shl A, #2 'Multiply by 4
...etc.
Lots of ways to do it. It is good to work on how you do it, whatever that is, and just keep working to make it more consistent. That helps a lot because other people can pick up on the different formats and learn what programmers were trying to say.
And yes! You have exactly the right idea, BTW.
I want to put something for ~~ I just asking what would be relevant in this context.
Please put something for a beginner to understand thanks
So far I have not anything in Propeller Education Kit Lab text that I have read so far