Electronic Design

  
Reprints     Printer-Friendly    Email this Article    RSS        Font Size     What's This?


[Lab Bench Online]
EiED Online>> Parallax Propeller

William Wong  |   ED Online ID #13329  |   August 21, 2006


I found the PDT a bit confusing at first. This is because of the difference between the Propeller’s architecture and other microcontrollers as well as the syntactic and semantic nature of the .spin files. Parallax also tends to use their terminology. For example, building a project is done via Run/Compile Top/Update Status. Luckily the PDT is relatively simple and easy to use.

Lets start by looking at the organization of a .spin file in more detail. It is a text file and information is section dependent. Sections include CON (constants), VAR (class variables), OBJ (objects required by this object), PUB and PRIV (public and private Spin code) and DAT (cog code). There is also the hidden documentation section to complement the inline comments.

One thing to keep in mind is that indentation counts. For example, here is a simple SPIN program that toggles an LED attached to pin 16.

       CON         Pin = 16         Delay = 3_000_000       PUB Toggle         dira[Pin]~~         repeat           !outa[Pin]           waitcnt(Delay + cnt)  

The repeat statements use should be obvious but keep in mind that the two lines beneath it are the repeat block. Pasting in code like this:

       CON       Pin = 16       Delay = 3_000_000       PUB Toggle       dira[Pin]~~       repeat       !outa[Pin]       waitcnt(Delay + cnt)   

causes some interesting problems.

Spin code is very similar to Basic. I found it easy to read once I got used to the indentation requirements.

What was a little more difficult was learning how to multitask at the Spin and cog level. Multitasking at the Spin level is done by starting up another cog running the Spin interpreter. The cog is given a reference the Spin function to execute. There is no concept of yielding with Spin or cog code. In fact, there are no interrupts. Everything is designed to be polled although it is possible for cog code to wait for a change on the IO lines.


<-- prev. page     1 2 [3] 4 5     next page -->

Reprints   Printer-Friendly  Email this Article  RSS    Font Size   What's This?


  • Network-On-Chip Tools Arrive for The Masses
  • Tackling System Design Challenges Through Early Verification
  • ESL Tools Take Center Stage As Designers Move Up
  • Parasitic Extraction Tool Targets Next-Generation Custom ICs
  • Synopsys Jumps Into ESL-Synthesis Pool
  • Verify Control Systems Before Committing To Hardware
  • You're Using How Many FPGAs?
  • Tool Up For The FPGA Blitz
    1) Build A Smart Battery Charger Using A Single-Transistor Circuit
    (187 views today)
    2) Hot Hands For Some Cool Rock: Motion Sensing Meets Audio Engineering
    (170 views today)
    3) What's All This Transimpedance Amplifier Stuff, Anyhow? (Part 1)
    (91 views today)
    4) GPS-Derived Grandmaster Clock Delivers Ultra-Precise Time And Frequency Sync
    (90 views today)
    5) Downconverting Mixers Lower Power Consumption While Improving Performance
    (71 views today)
    ALL TOP 20



    POST YOUR COMMENTS HERE
    Name:

    Email:
    Your Comments:

    Enter the text from the image below


    Please refresh the page if you have trouble reading this text.

    Search Electronic Design
         
      
     
    Web Seminar
    Sponsored By:
    Title: Read Pacing: A Performance Enhancing Feature of PCI Express Gen 2 Switch Devices
    Speakers: 
    Date: 07/01/08
    Register: 

    Electronic Design Europe Electronic Design China EEPN Power Electronics Auto Electronics Microwaves & RF
    Mobile Dev & Design Schematics Find Power Products Military Electronics EE Events Related Resources