FAQ

Home Up Custom PCB Boards Getting Started Tips Timing Pulse Generation Object Exchange FAQ Programming Examples

 

(Under Construction)

 

 

bullet

How can I access the individual bits in a variable with SPIN?

bullet
One easy way is to copy the variable to frqa, frqb, phsa, or phsb (assuming you aren't using counters in this cog).  Then you can just use, e.g., frqa[4] for bit #4, to access bits.
bullet
Also, read this thread  
bullet

How can I control servo's with the Prop?

bullet
Check out the servo32 object in Object Exchange.
bullet

Do we have access to the source code of the Spin interpreter stored in ROM?

bullet
 The Spin interpreter is actually scrambled in ROM and is automatically descrambled when loaded.  Chip posted the source code in this thread after Hippy answered his challenge to decode it.
bullet

Can I protect my code from being copied?

bullet
There are no easy ways to protect code stored in eeprom.  This topic is discussed extensively in this forum thread.
bullet

Can I use cognew in SPIN to run a routine from another object in a new cog?

bullet
No, cognew can only be used within the same object.
bullet

What is the purpose of the Assembly "RES" command?

bullet
RES reserves and names registers without consuming HUB RAM (unlike "long" declares).
bullet

Why doesn't my Assembly code with "RES" work?

bullet
RES statements must be at the end of your assembly code!  Otherwise, variable registers declared afterward won't work right. 
bullet

How can I search the forum? (The forums search tool doesn't work!)

bullet
Go here:   http://search.parallax.com and include the phrase +"f=25" to get just propeller stuff.
bullet

How many pins are free if I'm using VGA, mouse, and keyboard?

bullet
16 free out of 32 available.  8 used for VGA, 2 used for mouse, 2 for keyboard, 2 for USB/serial programming, 2 for I2C access to EEPROM
bullet

Why doesn't my Demo board work when I disconnect the USB?

bullet
There's an issue with the FTDI USB interface and pins 30&31.  If you have pins 30/31 set to output and the USB disconnected, the FTDI chip with reset the Prop.  The solution is to not set pins 30, 31 to output mode (as done with BS2_Functions).
bullet

What's the relative speed difference between Assembly and Spin?

bullet
Assembly is between 80 and 200 times faster.  200 is for tight DJNZ loops...
bullet

What's the relative code size difference between Assembly and Spin?

bullet
Spin is actually very compact and code sizes for equivalent tasks are on the same order.
bullet

How do I get the VGA demos to work well with a very old monitor?

bullet
Try setting the "pixel rate" to 25 MHz instead of 35 MHz.  Try reducing number of vertical pixels to 383 instead of 384.
bullet

How does an assembly program get into a cog when the COGNEW command given?

bullet
The COGINIT instruction triggers the cog to load itself with the assembly code data. 
bullet

What's a good way to add an led to a pin regardless of whether it is input or output?

bullet
I like Oz's circuit here.  Instead of going to a switch, you can have it go to your own input or output signal lead.
bullet

Why doesn't my FTDI USB to serial interface  (e.g., Prop Plug) work?  The Propeller Tool can't find my board!

bullet
Try the Troubleshooting guide here.  (on the USB driver download page).
bullet
Try not going through a hub.  Make sure board has good power.  Make sure Prop Plug isn't upside down (this got me :)
bullet

Why do the Propeller Demo and Proto boards use 5 MHz crystals while the Hydra uses a 10 MHz crystal?

bullet
Both crystals generate a 80 MHz maximum clock using the PLL.  Demo and Proto do this at PLLx16 and Hydra does this with PLLx8, or 16 and 8 times the crystal frequency, respectively.
bullet
The Hydra system was developed by a 3rd party (Andre') and he made his own decisions. \
bullet
Another compatibility issue is that the Hydra uses 4 pins for both keyboard and mouse while Proto, Demo boards only use 2 pins, so the drivers are different.
bullet

How can I generate random numbers?

bullet
There's a big discussion and Chip Gracey has posted code to generate "real" random numbers here in this forum thread.  Also, I generate psuedorandom numbers in my BlackJack game!
bullet

How can I connect the Propeller to the Internet?

bullet
Easiest way appears to use the ENC28J60 Ethernet controller chip.  An object exists in the Object Exchange to interface with this chip.
bullet
Also, 3rd parties, such as uController.com,  are selling boards with this chip.
bullet
Parallax also sells a more advanced board, PINK (Parallax Internet Netburner Kit), with serial interface.
bullet

What range of colors can I produce on TV or VGA?

bullet
Check out my VGA Colors and TV Colors pages.
bullet

What's the maximum clock frequency?

bullet
The rated clock speed is 80 MHz.  The rated maximum external crystal frequency is 10 MHz when using the PLL (phase-locked loop). 
bullet
80 MHz is achieved on the proto and demo boards using an external 5 MHz crystal and the PLL in 16x mode.  It can also be done with a 10 MHz crystal and the PLL in 8x mode as with the Hydra.
bullet
Testing has shown that 100 MHz can be achieved using an external 100 MHz crystal and not using the PLL.  One could also use a 6.25 MHz crystal and the PLL in 16x mode, but this is a non-standard frequency.  However, you could run at 96 MHz with a standard 6 MHz crystal.
bullet
The  maximum speed is a function of temperature and is currently being tested and will be published in the "final" datasheet.     
bullet
Note:  Care must be taken when selecting a crystal as the propeller only uses the fundamental frequency of crystals, but they are often labeled with their second or third harmonics.  This is not an issue for powered oscillators, however, because they have internal circuitry to give the labeled output.
bullet

What limits the maximum clock frequency?

bullet
The clock frequency is limited by the rise/fall time of the logic.  The rise/fall times are functions of temperature and applied voltage, so the chip is faster when cold and with higher voltage.  The new datasheet (v.1.0) shows this relationship.
bullet

How big does the stack for Cognew have to be?

bullet
The spin interpreter requires some stack space for passing parameters and return addresses during function calls.
bullet
There is no universal number.  It depends on how deep you call functions and how many parameters you pass to functions.  Recursion makes the calculation especially difficult. 
bullet
Very simple programs can get away with 9 longs as in the manual's example.  Medium programs (without recursion and limited nested function calls) can probably get away with ~50 longs.  For larger, more complex programs, you will probably have to carefully monitor stack usage.
bullet
If you overflow the stack your other variables and program and RAM will be overwritten.  There is code posted in the forum that writes specific data to the stack space and monitors it for changes to see how much is being used.
bullet
From Jeff Martin:  There’s also an object called “Stack” that comes with the Propeller Tool, and is also available on the Propeller Object Exchange, to help determine an object’s stack usage.
bullet

Where is the stack space for the main SPIN program?

bullet
The compiler hard-codes the end of the program as where stack space begins.  So, you have to be sure to leave some room there.  You can use the directive "_STACK" to force the compiler to leave room or give an error message. 
bullet

How does the compiler store variables in the "VAR" section and how are they aligned?

bullet
Variables in the VAR section are reorganized with longs first, then words, and last bytes.  The longs are long aligned.  Words are all word aligned.
bullet
This is critical for passing arguments to an assembly routine using Cognew.  Personally, I think it is better to pass an address in the DAT section to avoid alignment/reorganization problems.