ViewPort

ViewPort promised easier debugging on the Propeller - does it deliver?

What is ViewPort?

ViewPort is a software tool to help you develop on the Prop.  There are 2 core features;

  • Share variables with your PC.  You can pass variables from the Prop to ViewPort, and it can graph / chart / display the values.  You can also control variables in ViewPort — think of it as injecting values into your program as it's running.
  • Step-by-step Spin debugging.  You can pause your program execution and go through it step-by-step to see how each command is being run & what it's changing.

It also includes a few additional objects that expand the functionality of ViewPort;

  • QuickSample lets you sample values even faster — using 4 cogs it will sample at 80Mhz.
  • FuzzyLogic lets you use fuzzy logic calculations in your own program.  It also integrates with the ViewPort Fuzzy Logic view.
  • CVCapture and CVFilter are for using OpenCV, a machine vision application with the Prop and a host PC.
  • Terminal is a replacement for the standard Propeller Serial Terminal application.  It's there so you can use the terminal while using ViewPort.

Most users probably won't use the Fuzzy Logic or OpenCV objects, although they're nice to have.  The QuickSample object is very high resolution, but it was higher resolution then I need.  I usually use the Propeller Serial Terminal to spy in variable values, so I don't need it when using ViewPort, anyway.


Using the Logic Analyzer in ViewPort (full size)

How do you use it?

You'll need to modify your code slightly to take advantage of ViewPort.

  • You'll need at least one cog free.  That cog will interact with ViewPort on the PC
  • You'll need to add a few lines of code at the beginning of your program.  This will include the 'conduit' object (the object that runs in the free cog to interact with ViewPort) and the variables to pass on to ViewPort.
  • For hardware, you'll need to run the Prop @ 80MHz.

Here's my hardware test rig;


Propeller Platform USB & ProtoPlus

Download ViewPort here, you can grab a 30-day trial & install it.  A few demo programs are already built in, but to use your own programs, you'll need to add a few lines of code;

vp : "Conduit" is the object that communicates with ViewPort,
vp.share(@a,@b) starts the Conduit object and defines the variables you'll be sharing with Viewport.

Tracking & Updating Variables

Be sure to save your program in My Documents/Viewport, because that's where the Conduit object is located.  Open up your test program in ViewPort, connect your Propeller to your PC and turn it on.  Hit 'Load' on ViewPort and the program will compile and load into the Prop.  Now, switch between the top tabs (dso, lsa, all, analog, fuzzy, mixed) to see the shared variables changing values;


Watching the A & B variables change (full size)

Further, you can change the value of each variable by clicking the edit button to the right of the variable name.  The value will change in real-time, without needing to restart the program.

Each tab gives you a different view on the variables you're passing to ViewPort — some tabs are designed to look like Oscilloscopes (DSO), and another is designed to look like a logic analyzer, but they're both just showing the value a of a variable in Propeller memory.  You can design your own tabs, too — it can have inputs to change the value of variables and can display variables in different ways.

Debugging

The 2nd tab on ViewPort is 'code'.  This is an integrated lightweight code editor & full-featured debugger.  To begin debugging, open your code in ViewPort, hit 'Load' and switch to the 'code' tab.  Then hit 'start debugging';


ViewPort's Debugger (full size)

The top right code box shows your code, the bottom right box is the 'command' box, where you can tell the debugger to step through the code, pause execution, update a variable value, and otherwise control debugging.  The left-hand boxes tell you how long each PUB or PRI block take to execute (profiler), update the value of variables (watch), and show the state of the Propeller's I/O pins.

Connecting The Prop to your PC

ViewPort lets you update & monitor values from your PC, so why just use it for development?  Dashboards can be built inside of ViewPort for interacting with your Propeller programs — a sample using the existing widgets (the DSO) is in the tutorials folder;


Simulated Weather Station (full size)

Custom visualizations can also be created.

Additionally, Hanno has released the ViewPort Client kit, which enables Dynamic Data Exchange (DDE).  DDE is used to share information between Windows applications.  Hanno has provided DDE samples for Excel, dot net, Python, and C Sharp.  DDE is pretty widely supported, a video example of DDE with Excel is attached to this post.

How Much Does It Cost?

ViewPort is commercial software.  A 30 day free trial is available, but to continue using it, you'll have to pay.  The basic version is $29, the standard version is $60, and the ultimate version (which includes the capability to make your own custom visualizations and the OpenCV Objects) is $150.  Unless you know which visualizations you're going to create, I think most people are better off with the $60 version because it includes the Spin debugger.

Complaints
The code editor is lightweight, if you've got an error in your code, it won't show you where.  You're probably best off writing your code in the Propeller Tool, programming the Prop, then flipping over to ViewPort.  The DSO & LSA tools are spartan, with limited configuration options.

Nice Stuff
Minimal code changes are required.  Optional libraries like FuzzyLogic, QuickSample, and CVCapture are great value-adds.  If your program needs machine vision or high-frequency sampling, this is the best way to go.  The included demos get you started quickly.

VERDICT
Download it and try it out!  I found it well worth my $60 — it saved me several hours in troubleshooting and debugging.  For integrating a PC in your project, this is the easiest way to go.

 

https://vimeo.com/14375596