Rich Testardi

Introducing StickOS BASIC for Tower System and MCF51CN128...

Discussion created by Rich Testardi on Mar 1, 2010
Latest reply on May 20, 2012 by Stephen Scutt

Hi all,

 

My compilers are about to expire next week, so I figured I better get this done now...

 

I just ported StickOS to the Tower System and the MCF51CN128.  (StickOS also runs on the MCF5225x and about a dozen other MCUs -- see http://www.cpustick.com/mcus.htm)

 

StickOS is an MCU-resident interactive embedded system programming environment intended for hobby and education use, including an easy-to-use editor, transparent line-by-line compiler, interactive debugger, profiler, and flash filesystem, where external MCU pins can be mapped to special "pin variables" for manipulation or examination, and internal MCU peripherals are managed by BASIC control statements and BASIC interrupt handlers.

 

In literally minutes, using nothing but a terminal emulator, you can be interactively using most of the components and capabilities of the MCF51CN128, including:

 

  • digital I/O pins
  • analog input pins
  • analog output (PWM) pins
  • frequency output pins
  • servo output pins
  • UART I/O pins
  • interval timers
  • non-volatile storage

Just as a trivial example, to read the accelerometer axes and print the millivolt values from the ADC is as simple as:

 

> list
  10 dim x as pin pte2 for analog input
  20 dim y as pin pte1 for analog input
  30 dim z as pin pte0 for analog input
  40 while 1 do
  50   print "x =", x, "; y =", y, "; z =", z
  60   sleep 1 s
  70 endwhile
end
> run
x = 1491 ; y = 1577 ; z = 2533
x = 1506 ; y = 1586 ; z = 2536
x = 1487 ; y = 1582 ; z = 2539
x = 1514 ; y = 1583 ; z = 2545

<Ctrl-C>
STOP at line 60!
>

 

You can also use StickOS "absolute register variables" to manipulate all of the MCU registers interactively, right from the command prompt.  For example, to display the mod and cnt values for the RTC, you can do:

 

> dim rtccnt as byte at address 0xffff82c1
> dim rtcmod as byte at address 0xffff82c2
> print rtcmod
7
> print rtccnt
1

 

You can even update the mod value (causing the LED blink to slow down) with:


> let rtcmod=15
>

 

Unfortunately, I did not have enough time to get the Ethernet interface working on the MCF51CN128 like it works on the MCF52233...  I'm not actually sure that the part has enough flash for that, but the bottom line was I ran out of time (I only had a day to do the port).

 

StickOS also supports 2.4GHz wireless zigflea communications between MCUs when they are attached to an MC1320x transceiver via SPI.  Unfortunately, the Ethernet Phy on the Tower Serial card conflicts with those pins, and can't be jumper disabled, so you have to hold the Phy in reset using TP6.

 

Anyway, if you want an infinite amount of information on StickOS, including binary downloads, it is on the web at: http://www.cpustick.com/index.htm

 

There is also a skeleton source code project on the Downloads page from which you can both rebuild StickOS as well as easily port finished BASIC programs to C, taking advantage of all of the pin/peripheral functionality embedded in StickOS.  You can of course also see how StickOS manipulates all of the pins/peripherals, as example code.

 

"Our hope is to enable casual users to again become creators of technology, rather than simply consumers of it."

 

-- Rich

rich@testardi.com

Outcomes