Volatco - Powerful Multicompute

The future of multiprogramming

The most advanced computer in the world today.

Volatco Tutorials

Make an LED blink from a Volatco GPIO signal at a periodic rate.

What You Will Need

  • A Volatco board with power and programming access
  • One mini-red LED with forward voltage Vp = 2.0 V
  • One 550 ohm current-limiting resistor
  • Jumper wires
  • Plugboard or breadboard to create the circuit
  • A volatco-serial connection to the board
Mini-red LED used in this tutorial
In most through-hole LEDs like this one, the longer lead is the anode and the shorter lead is the cathode.

Parts Note

This tutorial uses a 550 ohm resistor and a 3mm red LED with Vp = 2.0 V. Volatco GPIO logic-level is 1.8 V. A 2.0 V LED, the minature one for our demo, is recommended as other LEDs have not been tested, but can be made to work. If the LED you chose does not blink even though your program is running, the LED’s Vp is too great yielding insufficient current at the lead.

Before You Start

  • Set J5 to development mode by connecting pins 1 and 2.
  • Use J4 for manual reset when needed.
  • Use the VOL01 USB/Power module connected to VOL00 in the same stacked arrangement shown on the main page.
  • Connect both USB-C connectors through a USB hub, so you can access the board via either the IDE A or polyForth B.
  • If you want to prevent SPI flash from auto-booting while experimenting, install J6 jumper and set J5 jumpers to development mode.

Prepare the Volatco

Prepare the board in this order:

  1. Connect the Volatco stack, VOL00 plus VOL01, to the PC.
  2. Start the arrayForth 3 VOLATCO program.
  3. Type AFORTH
  4. Type 1662 LOAD
  5. Type HOST LOAD TALK
  6. Type SERIAL LOAD PLUG
  7. Hit the space bar to set autobaud.

You should then see:

pF/G144.03b1 12/21/18
hi

Then continue:

  1. Type 20 DRIVE HI to do the polyFORTH 9 LOAD
  2. Type AFORTH and wait for the variables to be defined.
  3. Type 1585 LIST to inspect the LED demo block.

If block 1585 already exists, its run definition uses 2000 as the milliseconds per half cycle of the square wave. Edit that value if you want a different blink rate. If block 1585 does not already exist on your system, type the LED demo code into the terminal manually, then save or run it before continuing. If you make a mistake while editing, reset the Volatco, repeat the startup sequence, inspect block 1585, and fix what you changed. If you do not use FLUSH, your edits are usually not written to mass storage.

Wiring the LED

Use GPIO 715.17

  1. Locate the header position that exposes signal 715.17
  2. Connect 715.17 to the 550 ohm resistor.
  3. Connect the resistor to the LED anode.
  4. Connect the LED cathode to one of the ground pins immediately adjacent to 715.17 on J10
  5. Place the LED and resistor on the breadboard in the same arrangement shown in the demo video.

If you prefer to sink current instead of source it, reverse the LED-resistor order and adjust your program logic accordingly. 715.17 is a general-purpose GPIO shared with nearby analog nodes, so keep tests simple and avoid attaching additional circuitry to that signal at the same time.

Program Code

LED blink in polyForth:

1585
 0 ( 715.17 Blink test)   STREAMER LOAD
 1 ASM[ # 715 NODE ERS # 0 org
 2
 3 : ms ( n)  for  999. for  415. for  unext  next next ;
 4 : run   2000. ( ms per half of square wave)
 5   dup begin  drop  x30000. !b  dup ms  x20000. !b  dup ms
 6     @b xA800. and until  warm ;   >BIN ]ASM
 7
 8 0 ARRAY MYP  207 ORGN 210 TO 710 TO 715 TO -1 ,
 9
10 207 STREAM[   ' MYP COURSE
11     FRAME[   715 +NODE  0 64 715 /PART
12        IO /B  715 ITS run /P   ]FRAME  ]STREAM
13   !SNORK
14
15  ok

If block 1585 is already present, use 1585 LIST to confirm it matches this program. If it is not present, type this code into the terminal, then save or run it before continuing by using FLUSH

Example Workflow

  1. Power the board in development mode.
  2. Prepare the stack and start arrayForth.
  3. Inspect block 1585 with 1585 LIST
  4. If the block exists, optionally edit the run definition.
  5. If the block does not exist, type the LED demo code into the terminal manually, then save or run it.
  6. If the block exists, type 1585 LOAD.
  7. Confirm that the program starts node 715
  8. Observe 715.17 changing state at the programmed rate.
  9. Confirm that the LED blinks steadily.

Running the Program

If block 1585 is present, start the program from arrayForth with:

1585 LOAD

This loads the code in block 1585 and starts it running. Each time you enter 1585 LOAD, node 715 is reprogrammed so you can edit run and load again.

The useful part of this exercise is changing the blink period and loading it again.

In block 1585, line 4 contains:

: run   2000. ( ms per half of square wave)

The value 2000. is the delay in milliseconds for each half cycle of the square wave. Lower values make the LED blink faster. Higher values make it blink slower.

Example:

  • Find 2000. and replace it with 500. for a faster blink.
  • One way to do that in the editor is:
F 2000.
R 500.
  • Load the program again with 1585 LOAD
  • Watch the LED and confirm that the blink period changed.

If you do not use FLUSH, the edited value is not written to mass storage; therefore, the experiment is not expressly saved to memory. You can also type Q while viewing the block shadow for the short note that describes what the code is doing.

Further Reading

To learn more about interactive Forth programming, Leo Brodie’s Starting Forth remains a standard-bearer for beginners and professionals.

  • Read Starting Forth online at Forth, Inc.
  • Download the Starting Forth PDF

A Successful Validation

  • The LED blink code is available either in block 1585 or as code entered manually at the terminal.
  • arrayForth 3 VOLATCO, serial services, and arrayForth are all loaded successfully.
  • Typing 1585 LOAD in arrayForth starts the program when block 1585 is present, or the manually entered code runs correctly.
  • 715.17 changes state at the programmed interval.
  • The LED blinks repeatedly without manual intervention.
  • Editing block 1585 and re-LOADing it interrupts the blink program, replaces it in node 715 memory, and starts the node running at the new cycle period.

Demo Video

Volatco GPIO blinking a LED at a rate of 2000ms.

Troubleshooting

If the LED does not blink:

  • Verify LED polarity.
  • Verify the 550 ohm resistor is in series with the LED.
  • Confirm you are really connected to 715.17
  • Confirm the board is in development mode.
  • Confirm the arrayForth 3 VOLATCO program was started.
  • Confirm HOST LOAD TALK was run.
  • Confirm SERIAL LOAD PLUG was run.
  • Reset the Volatco and press the space bar again to autobaud.
  • Confirm AFORTH was run before using block 1585
  • If block 1585 exists by 1585 LIST, run 1585 LOAD again.
  • If block 1585 does not exist, verify the polyForth code was entered correctly and saved using FLUSH
  • Verify the blink interval in run.
  • Reset with J4 and reload the program.