Welcome to the Parallax Discussion Forums, sign-up to participate.

# First Spin Podcast - For those who've NEVER programmed/worked with Props before

• Posts: 536
edited 2012-01-10 - 16:23:40
This week we finish talking about addressing different LEDs with binary numbers and masks, but continue our epic saga of registers of INA, OUTA, CTRA, FRQA, PHSA, VCFG, VSCL. Whisker and Roy attempt to discuss teaching binary, hexadecimal, and boolean OR functions to a resistant Addie. We talk about where these special registers are, how they can be accessed, SPR, and when all of these are used/how to use them.

We also start talking about the Hub and about when the hub gives a cog access to mutually-exclusive resources, and we look a bit into the number of clock cycles involved the process. This gets interesting because even though the hub moves on to different cogs, instructions can still be run in the background.

All found here:
http://www.firstspin.tv/2012/01/10/first-spin-episode-008-dira-ina-and-more-registers/

Let us know what you think and if there's anything we should change
• Posts: 206
edited 2012-01-12 - 14:02:42
Tymkrs wrote: »
Huzzah! Another Tuesday, another First Spin! ...

I am really enjoying these conversations about the props architecture. Your podcasts thus far have been very educational. Thanks to you and the boys for putting these together.
• Posts: 536
edited 2012-01-17 - 16:43:42
Most of the remainder of Chapter 1 is a detailed repeat of the parts of propeller architecture that weve gone to, so we finally move onto chapter 2! We start talking about the CON, OBJ, VAR sections going into great detail on what the Object Exchange is, and what objects are good for. We also go into the use of the equal sign:

We go into the CON Section and talk about when constants are used, how they are used, and discuss many of them in more detail: POSX, NEGX, PI, _XINFREQ, etc. Stacks are also discussed in relation to cogs and local variables and giving everyone their space!

Another Tuesday - Another First Spin!: http://www.firstspin.tv/2012/01/17/first-spin-episode-009-starting-the-language-reference/

PS - Thanks to JacGoudsmit for his corrections and thanks to RogerSyd for the continued support!
• Posts: 536
edited 2012-01-24 - 17:07:03
Hi all! This week on First Spin we continue talking through the constants in the CON section such as Float, False, True, Trunc, POSX, NEGX. In the VAR section: global variables vs local variables, stacks, byte, long, words. In the OBJ section: we discuss the Parallax Serial Terminal, opening multiple PST windows, and different ways they can be used. In the Pub/Pri section: port B secret passageways. And in the DAT block: assembly code and what a program could use with this.

http://www.firstspin.tv/2012/01/24/first-spin-episode-010-%E2%80%93-playing-with-blocks/

Let us know what you think Comments, questions, even snide remarks!
• Posts: 536
edited 2012-02-01 - 00:55:49
On First Spin this week, we finish overviewing datablocks, “Categorical Listing of Propeller Spin Language”, and we talk about COGID, COGSTOP, COGINIT, COGNEW, Lock bit commands, WAITCNT, WAITPNE, WAITPEQ. As always we cover examples of when to use them, how to use them, and why we would use them.

We then go into flow control, the use of CASE, IF, ELSEIF, ELSEIFNOT, ELSE, and the use of == vs :=. Note, when using CASE, it is possible to use specific ranges (instead of <2, >5, you could do 0-2, 5-10). We finish with how to use CASE and what its benefits are over other flow control commands.

http://www.firstspin.tv/2012/01/31/first-spin-episode-011-%e2%80%93-process-and-flow/
• Posts: 536
edited 2012-02-14 - 15:05:39
Did you guys miss us?! We had a bit of scheduling difficulty in getting the three of us together at once, but we are back again!

This week we start with horrible Spin jokes and continue looking at flow control commands. We cover the intricacies of Repeat, From, To, Step, Until, While, Next, Quit, Return, and Abort. As always, we give examples of when to use these commands, how, and why we would choose these. We also cover how these direct the “flow” of the program.

We cover how the PST and serial fit into the learning process and Whisker and Roy briefly talk about error traps. Addie also discusses her work with the Parallax RC Servo and the code involved (FRQA, CTRA).

http://www.firstspin.tv/2012/02/14/first-spin-episode-012-%E2%80%93-atdiy-goes-loopy/
• Posts: 402
edited 2012-02-18 - 16:54:42
@ Tymkrs,

This weekend I for the first time began listening to your poscasts. Wow, wish such had been available when I first was aware of the Prop several years back. The podcasts sure would have been helpful to a newomer to the Prop.

One complaint about the First Spin web site: for us older folks, the small type, light blue and orange text is almost unreadable (for me at least). Otherwise, excellent! I have to use a magnifying glass to read the iMac screen, especially in the daytime when the room is well illuminated.

One question. I note you have 13 episodes (000..012); how many more are planned? (Oooooh, did I hear 'forever'?)
• Posts: 536
edited 2012-02-18 - 19:40:35
http://forums.parallax.com/showthread.php?138039-Searching-for-First-Spin-thread-mentiion <-- Hey Harley! Answered some of your questions here, and did see the comment on the light blue and orange text. Fortunately it's just a barebones summary of what is discussed on the show, but if you press CTRL on your keyboard and use your mousewheel to scroll up, the text will increase in size.

It's part of a default template that we're working with and once we have a little time to dive into its guts, we'll see about making the colors a bit more eye-friendly (sadly for most, orange is my favorite color ).

Number of episodes planned - until we all become experts
• Posts: 402
edited 2012-02-19 - 09:47:34
@ Tymkrs,

Colors might be 'pretty', but legibility comes first, imho. Small letters, in faint colors might look pretty when looking at a page of text, but can it be read without eye-strain? is the question. My favorite color is blue, but not for text. Good ol' black and white has the best contrast and readability for most people.

Good to hear the episodes are planned "..until we all become experts..". That's a good plan. I can wait for all those episodes, for sure. Thanks for all your efforts o your journey.
• Posts: 536
edited 2012-02-21 - 16:04:04
Another Tuesday - Another First Spin!

On First Spin this week, we talk about Memory and the commands/variables associated with it such as Byte, Word, Long, Bytefill, Wordfill, LongFill, Bytemove, Wordmove, Longmove. We talk about when you would use this and give some examples of the benefits of being able to "copy" and "paste" data with a simple command.

We finish up with Lookup, LookupZ, Lookdown, LookdownZ, Strsize, Strcomp and touch on the ability to pick and choose certain data and even compare it against something else!

I also talk about my foray into xbee awesome:
http://www.firstspin.tv/2012/02/21/first-spin-episode-013-memories/
• Posts: 536
edited 2012-02-28 - 18:34:42
This week we continue our fabulous Spin jokes and get into Directives. We discuss strings, constants, float, round, and trunc - giving the definition, example of when to use them, and why we use them! We discuss what "at compile time" means and examine some code that uses these directives.
Interestingly, using the dat section, you can substitute chunks of memory for other chunks on the fly!

http://www.firstspin.tv/2012/02/28/first-spin-episode-014-%E2%80%93-stopping-for-directives/

Let us know what you think about the show, if you have any questions, and whether we can help clear anything up for you!
• Posts: 536
edited 2012-03-06 - 17:10:57
On First Spin we continue with our string of constant jokes! We finish up discussing the directive section by talking about file, and about using pointers with the dat section. We discuss how you can use file and I tackle whether you can code recompilation into the code. Meta.

We continue with Registers and quickly go over dira, dirb, ina, inb, outa, outb, cnt  all ones weve done before. But now we start talking about counters and go into how the counters work.

CTRA sets the mode, and depending on that mode, FRQA value will get accumulated into PHSA based on the mode. So simple modes in CTR say that each clock cycle, FRQA is added into PHSA and PHSA wraps around according to its setting.

We also talk about two counters modulating a single pin. Then Whisker and Roy talk about a number of things that Addie didnt understand (haha). But we do bring the conversation back to the work done with the Parallax RC servo and the use of counters in it. A meaty episode and worth listening if you want to know how counters work!

http://www.firstspin.tv/2012/03/06/first-spin-episode-015-%E2%80%93-more-directives-and-counters/
• Posts: 536
edited 2012-03-13 - 17:15:24
This week on First Spin, we finish out the Registers by talking about VCFG, VSCL, PAR, and SPR with some examples of when these would be used. We then go into Constants - all of which have been previously covered - TRUE, FALSE, POSX, NEGX, and PI. And then we discuss Result and how it's magically there even when not stated.

And before going into Unary Operators, we discuss Addie's work on the Xbees and interfacing them with the Propeller. She talks about how she gets an xbee to control an rc servo and how to control her heart led project. Lots of learning experiences!

http://www.firstspin.tv/2012/03/13/first-spin-episode-016-wrapping-up-registers-and-constants/
• Posts: 536
edited 2012-03-20 - 11:04:30
This week on First Spin we remind everyone about the Parallax Expo (woohoo!) and then start on Unary Operators! Addie gets a bit confused by the subtle difference between pre and post increments/decrements - but our resident experts are patient and explain wonderfully! We also hash out sign-extensions!
We go through:
• - : Subtract
• - -X : Pre-decrement
• X- - : Post-decrement
• ++X : Pre-increment
• X++ : Post-increment
• ^^ : Square root
• || : Absolute Value
• ~ / ~~ : Sign Extension
(--) Example discussed:
• a := X- - + 10 X = 2
• a := X + 10 and X = X - 1
• a := 2 + 10 and X = 2 - 1
• a := 12 X = 1
VERSUS
• a := - -X + 10 X = 2
• a := (X-1) + 10 and X = 2-1
• a := 1 + 10 and X = 1
• a := 11 X = 1
(++) Example discussed:
• a := X++ + 10 X = 2
• a := 12 X = 3
VERSUS
• a:= ++X + 10 X=2
• a := 13 X = 3
Sign Extension Discussion:
• If you set dira/ina to ~ this sets all bits in a 32 long to 0 (though 32 depends on the context).
• For example, Outa[4..5]~ will only set bits 4 and 5 to 0
~~ = -1 so if you set dira/ina to ~~, this turns all of the bits ON in a 32 bit long
With 1, the first bit of the 32 bit is ON. With -1, all bits are ON.
If you put it (~ or ~~) in front of a variable (X) it sign-extends. So if you have a 8-bit value, positive or negative, then you use sign extension to sign extend it into a full 32 bit value.
So if you had just a BYTE (0-7) as a variable (vs WORD (8-16) or LONGs(17-32)). This lets you take a variable from a BYTE or WORD and ensures that the signed value (positive or negative) of the number is properly copied over to a LONG.

http://www.firstspin.tv/2012/03/20/first-spin-episode-017-unary-operators-part-1/
• Posts: 536
edited 2012-03-27 - 18:55:47
This week we talk again about the Parallax Expo and we continue with Unary Operators! We continue with:

?: Random number (forward/reverse) - we discuss how it works and how someone could try to get as random a number as possible.

|<: Decode Value - Given a number from 0-31 it will give you the resultant value that is that bit turned on in the long. So if you give it 31, the 31st bit will be turned on and everything else not. Ex. Pin := |< 3 will set bit 3 of Pin ON and all other bits are off.

>|: Encode Long - This will give you the highest bit that is turned on in the long you are looking at and adds 1 to that value. Example below:

a := |< 16......will give you a long into a where bit number 16 is turned on and everything else is off
b := >| a........b will equal 17. (It will be a binary number valued at 17)
!: BITWISE NOT - Whatever value you give it, it takes the bits in that value and switches them to the opposite. All of the 0's become 1's and the 1's become 0's. We get into binary nuttiness with this:

!1 == -2
> A 1 in binary = all 0's and bottom bit is 1. This turns all into 1's and then the bottom one is 0. This makes it equal -2 (whaaaaat?!). Cue the crazily confusing (but eventually elucidating) discussion on binary signage.

Assuming a 4-bit number: We start at 0, we count up, when we get to 7, that's 0111. After 7, when we add 1 to it, instead of becoming 8, it wraps around and becomes 1000 which is -8. The top bit equals the sign and the max number. The rest of the bits determine how far away we are from the maximum negative number.

The top bit is a 1 which means it's a negative number. If you have a 4 bit value: 0001, and do !0001, that would equal 1110. Assuming the top bit represents the sign of the value (+ or -). So the top "1" makes it negative in value. Take the rest of the bits, figure out what that equals, and then subtract that from the maximum (of the side the sign is (in a 4bit number that's either 7 for the positive side or -8 for the negative side).

Example. !0001 == 1110. The range is -8 to 7. 1 represents - and 110 = 6. So then -8 + 6 = -2.

Example. !001 == 110. The range is -4 to 3. 1 represents - and 10 = 2. So then -4 + 2 = -2.

So then any number that is all 1's except for the last bit which is 0 will always equal -2.

http://www.firstspin.tv/2012/03/27/first-spin-episode-018-unary-operators-part-2/
• Posts: 536
edited 2012-04-03 - 18:36:25
This week on First Spin, we finish up the Unary Operators by covering NOT, @, @@, and in doing so tackle the idea of boolean values with Addie. We also go over the small details involved in @ and @@ addressing.

We also start on the binary operators with =, :=, the distinction between := and ==, +, +=, and the subtleties involved!

http://www.firstspin.tv/2012/04/03/first-spin-episode-019-%E2%80%93-finishing-up-unary-operators/
• Posts: 536
edited 2012-04-11 - 20:20:29
Woo! Since we've been on the road, I didn't quite have time to post that we put up First Spin yesterday - so apologies for that. But here's this week's FIrst Spin and see you all soon Friday!
This week we continue talking about MANY binary operators and the assignment of results. We cover, analyze, and give examples for the following binary operators: +=, -=, *=, **=, /=, //=, #>, #>=, <#, <#=, ~>, ~>=, <<=, >>=, <-=, ->=, and ><=. Some show notes below!Arithmetic Shift Right:
• 1010 ~> 1101
• 0101 ~> 0010
• Bitwise Shift Left/Right – Add in a 0 depending on direction shifted, whereas arithmetic shift right adds in the signed bit of the value. So if the binary number’s signed bit is 1, it will add in a 1 and if a binary number’s signed bit is 0, it will add in a 0 (like the example above).
Bitwise Rotate Left:
• 1110 <-= 1101
Bitwise Rotate Right:
• 1110 ->= 0111
Bitwise Reverse:
• 1110 ><= 0111
http://www.firstspin.tv/2012/04/05/first-spin-episode-020/
• Posts: 53
edited 2012-04-12 - 04:16:45
Hi Tymkrs

I've just listened to the first couple of episodes and they're great.
You have asked some of the questions I have as a beginner and it's nice to now have an answer.

I'll keep listening and hope that some of it sinks in
• Posts: 536
edited 2012-04-18 - 03:15:47
Awesome Nurbit - glad you like it!!! There's lots of repetition since it takes me a little to learn this too, but if you have any questions, post them here or on FirstSpin.tv and I can help ya answer it (or at least Roy and Whisker can hehe)
This week on First Spin, we continue talking about MORE binary operators and go through: &=, |=, ^=, AND=, OR=, ===, <>=, <=, >=, =<=, and =>=

AND: 0 and 0 is 0. 1 and 1 is 1. 0 and 1 or 1 and 0 are 0.

OR: 0 and 0 is 0. 1 and 1 is 1. 0 and 1 or 1 and 0 are 1.

XOR: 0 and 0 is 0. 1 and 1 is 0. 0 and 1 or 1 and 0 are 1.

X===Y >>> If X = Y, TRUE, if not then FALSE is placed into X.

If X<>=Y >>> If X<>Y, TRUE, if not then FALSE goes into X.

http://www.firstspin.tv/2012/04/05/first-spin-episode-021/
• Posts: 536
edited 2012-04-24 - 15:26:52
This week on First Spin, we go through all of the Syntax Symbols! This includes %, %%< \$, ", _, #, ., .., :, |, \, (), [], {}, {{}}, ', ''.

We mostly know all of this already, but this is a great review for when you'll see these symbols and when they'll be used!

http://www.firstspin.tv/2012/04/24/first-spin-episode-022/
• Posts: 536
edited 2012-05-01 - 16:44:58
This week on First Spin, we talk about the Parallax Expo and cover a lot of the cool projects that were seen in the booths. We had an amazing time talking to all of the different makers and watching the different projects. Thanks to Parallax for an awesome Expo! We will be sure to make it out to the next one!

Addie has been working on working with different peripherals and sensors sold by Parallax and recently, she's been working on the GPS module, altimeter module, and gyroscope module. Whisker, Roy and Addie discuss the different approaches to these types of sensors and Addie discusses working with the gyroscope module. There's also an Addie style explanation of I2C!

http://www.firstspin.tv/2012/05/01/first-spin-episode-023-parallax-expo-and-gyro/
• Posts: 536
edited 2012-05-12 - 01:04:23
Oof da! Sorry for not posting this week's first spin!! (it was posted on Tuesday, but I must've been scatterbrained )
This week on First Spin, we talk about the modules and the code/objects involved again! We go specifically into accelerometers, what they do, what they are, and some of the subtleties involved in the data gained from them. We discuss the basics of how to interface accelerometers with gyroscopes or compass modules, and talk about the feasibility of basic projects to learn how to use these together. We discuss different methods of figuring out how to measure wind speed by counting the number of rotations or overgineering it, Addie style. We talk about what a mems device is and then go into what First Spin will cover in the next few weeks. We also look at the altimeter module’s code. Less manual, more specific modules!!

http://www.firstspin.tv/2012/05/08/first-spin-episode-024/

Roy just let me know
• Posts: 536
edited 2012-05-15 - 15:51:16
This week on First Spin we decide to talk about the Ping))) Ultrasonic Distance Sensor and we talk about the basics of what it does and hash out how the Ping Sensor actually works (because you know, Addie has to know those details):

It takes a little for Addie to understand it. We discuss good electronic habits and the subtleties needed to get the Ping Sensor to do its job.

The following blog post is the text explanation of what is discussed!
http://tymkrs.tumblr.com/post/23127813862/how-the-ping-distance-sensor-actually-works

And here's where you can find the episode:
http://www.firstspin.tv/2012/05/15/first-spin-episode-025-ping%E2%84%A2/
• Parallax Engineering Posts: 14,406
edited 2012-05-16 - 14:02:13
I received a question via e-mail in regards to the most recent first spin regarding the function of the PING))) sensor. I just wanted to clarify the point made and the question.

The question is, "When the PING))) times out, is the return value unique and meaning it is past the range of the sensor?" This was based on the statement in the podcast that when a timeout occurs, the PING))) brings the signal pin low and that this value/range is, "Well beyond its maximum distance for measuring". To clarify when the PING))) times out, it is at the maximum range it can operate. So the value is considered the maximum range value, not well past that value. The timeout occurs at 18.5mS.

In trying to find the point of confusion I also sensed there was some confusion as to the operation of the PING))) and the result of not bringing the signal pin low. Again, for clarification:

To use the PING))) your microcontroller must trigger the signal pin by bringing it high for at least 2uS (typically 5uS). Once the signal pin goes low there is a holdoff time of 750uS to allow for the microcontroller to prepare to have its I/O pin become an input and detect the rise of the signal pin, which happens when the ultrasonic burst has been transmitted. Here's where things can vary depending on the MCU...the question was why can't you just make the pin an input? Well you can. An internal 10K pull-down resistor on the PING))) will return the signal pin back to its low state when not driven high. The potential problem is that a microcontroller fast enough to get the pin to an input and read it may in fact see a high before the pin is pulled low. However this depends on the microconroller and the code. As stated, there is a holdoff time and if the MCU takes more than a few uS to be ready the pin will go low on its own.

Once the signal pin is driven high by the PING))) the time it remains high represents twice the flight time (round trip) to the object, so one half of that is used to calculate the distance. It might also help to know that the signal pin has a series 500 ohm resistor to protect the I/O pin in the event of a programming error that might cause the PING))) and the MCU to be driving the signal pin at the same time. I hope this helps clarify some points on PING))) operation.
• Posts: 536
edited 2012-05-22 - 21:13:03
Thanks for the clarifications Chris, a lot of good and specific information there. Worth putting an addendum into the blog at some point - thanks!

http://www.firstspin.tv/2012/05/22/first-spin-episode-026-ping-code/

This week on First Spin we finish up looking at the Ping))) Ultrasonic Distance Sensor and we talk about how the OBJECT code correlates to how the sensor works. We hash out the different PUB sections and all of the individual commands – when to use them, how to use them, etc. We also hash through the conversion of units and how to avoid the use of floating point math.The following blogposts can be helpful for understanding each step:
• Posts: 536
edited 2012-05-29 - 18:47:51
This week on First Spin we talk about the steps needed to install Brad’s BST on the Mac that will allow Addie to work on Spin and the Propeller from the new studio! We discuss access of serial terminals and explain how to get it working on Brad’s BST. Module wise, we went over the 5-position switch from Parallax – hardware and software – and discussed the Kickstart code that can be found here: http://learn.parallax.com/KickStart/27801
If you have any questions, let us know!

http://www.firstspin.tv/2012/05/29/first-spin-episode-027-spinning-apples/
• Posts: 215
edited 2012-05-30 - 07:27:36
Hey, haven't posted here about the podcast, but figured it was about time I did.
You guys are great. I have to thank you for going through chapter 1 with such thoroughness. I'd of course read the manual from end to end, but having the pictures explained sure made things a lot more clear. I'd listened to the first few podcasts, then forgot about them for a while, so I missed the announcement about the expo, which really bites, since it was only about 3 hours from here, and we really wanted to go (Well, ok, I really wanted to go, and the wife and kids would have come along just for the fun of it), but by the time I discovered it on the parallax site, it was already a week gone *cry*. But, seriously, with the show, I like the way you folks are handling things, it gives me more details than I can get from reading manuals/documentation alone.
Keep the episodes coming, and I'll try to keep listening (in a timely manner this time so I don't miss anything like the expo again)
• Posts: 536
edited 2012-06-05 - 16:19:46
Hey Softcon - thanks super much for the feedback !! It was good for us to go through the Propeller Manual especially since most of it intimidated /me/ when I first opened it (hence only getting to the preface before the show haha). Since we've changed our focus a little bit (ie the sensors/peripherals), let us know if we're touching the details you think need to be touched, or if we need to go more indepth! And that being said:

This week on First Spin we talk about RC servos! We discuss what an rc servo is, when you'd use it, the hardware involved, and the pulse width modulation involved in getting an rc servo to work. We discuss two different ways of coding, one from Parallax's RC Servo page and the other from Parallax's Kickstarts page. One uses counters and the other uses the servo OBJ found in PropTool and on the Object Exchange - so we go through how to use these and how they work. Further information on rc servos and the code analysis referenced can be found:
Episode: http://www.firstspin.tv/2012/06/05/first-spin-episode-028-servos-are-easy/
• Posts: 536
edited 2012-06-12 - 18:42:59
This week on First Spin we firstly apologize for the sound quality! 10 minutes before we were about to start recording, our audio mixer decided to completely die on us. We even opened it up and hacked around on it to see if there were any capacitors we could replace. And about 2 minutes from finishing our episode, the recording software just quit without leaving us a temp file. This happened TWICE. So this particular recording is the third iteration! We are working towards getting our set up back up and running - thank you for your patience!

But it is a fantastic episode where we discuss the GPS module that Parallax provides! We talk about the satellite system that helps to ensure GPS working, the GPS module hardware, and analyze the Kickstart Code initially. Since we want more information, we also analyzed how to make your main function modular and how to get more information by reading through the OBJ. We talk about the difference between Vcc, Vdd, Vss. We also talk about Ascii tables and pre-programmed serial terminal "commands" and provide some good reminder tips on serial terminals. And we finish up with touching on the new polar heart rate module available at Parallax! A very good, though hard-earned episode .