Help with PE labs I/O and Timing Basics Lab...
RonP
Posts: 384
Hello All
Need a little help understanding something.
Page 60. Variable Example
The two global variables in the program are replaced with local variables, by removing the VAR block and adding a pipe to the method block followed by the two variables. I noticed that the LED s do the same thing but not quite exactly the same sequence. Could this be due to the local variable being long and the byte variable being short? The book explains by adding the variable to the method block it is automatically a long variable. But it doesn't explain the different behavior of the LED s. Could someone please explain it. I would like to understand this a little more before moving on in the Labs.
Thanks in advance new to the Propeller just got a few days ago. Previous experience "What's a Micro-controller" and "Boe-Bot"
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Im not that bright and i can prove it.
Post Edited (RonP) : 4/30/2010 1:48:10 AM GMT
Need a little help understanding something.
Page 60. Variable Example
The two global variables in the program are replaced with local variables, by removing the VAR block and adding a pipe to the method block followed by the two variables. I noticed that the LED s do the same thing but not quite exactly the same sequence. Could this be due to the local variable being long and the byte variable being short? The book explains by adding the variable to the method block it is automatically a long variable. But it doesn't explain the different behavior of the LED s. Could someone please explain it. I would like to understand this a little more before moving on in the Labs.
Thanks in advance new to the Propeller just got a few days ago. Previous experience "What's a Micro-controller" and "Boe-Bot"
'' File: ButtonShiftSpeed.spin '' LED pattern is shifted left to right at variable speeds controlled by pushbuttons. '' VAR '' Byte pattern, divide PUB ShiftLedsLeft | pattern, divide dira[noparse][[/noparse]9..4] ~~ divide := 5 repeat if pattern == 0 pattern :=11000000 if ina[noparse][[/noparse]22] divide ++ divide <#= 254 elseif ina[noparse][[/noparse]21] divide -- divide #>=1 waitcnt(clkfreq/divide + cnt) outa[noparse][[/noparse]9..4] := pattern pattern >>= 1
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Im not that bright and i can prove it.
Post Edited (RonP) : 4/30/2010 1:48:10 AM GMT
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
OS-X: because making Unix user-friendly was easier than debugging Windows
links:
My band's website
Our album on the iTunes Music Store
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Im not that bright and i can prove it.
Ah, I see. 11000000 decimal is %00000000_10100111_11011000_11000000 binary. So for a byte you happen to get the same pattern (%11000000), a long gives you everything else as well.
Post Edited (kuroneko) : 4/30/2010 3:24:39 AM GMT
Thanks for the help kuroneko and SSteve.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Im not that bright and i can prove it.