WhippleWay Software - The Front Panel Project

Beginners usually take the “magic box” approach to microprocessors.  Ignoring its inner workings, they start by learning a high-level language that gives them access to the microprocessor's basic capabilities.  As more experience is gained, performance issues or the need to more fully manipulate hardware calls for greater insight into the computer's hardware and software capabilities.  To this end, the Front Panel Project offers a series of experiments that explore microprocessors and programming at a more rudimentary level, starting with machine language, transitioning through assembly language, and finally arriving at a high-level language, AVR Tiny BASIC.  In the beginning, experimenters use an Intel 8080 emulator with an Altair 8800 inspired front panel complete with switches and flashing lights.  Eventually, the focus turns to a modern microprocessor, the ATmega328, and its built-in peripherals on a SparkFun Redboard.   By exploring the microprocessor from the inside out, the range of hardware and software solutions is greatly expanded.

Programming Language Levels


Intel 8080 Microprocessor MITS Altair 8800 ATMEL ATmega328 Microprocessor SparkFun RedBoard
Intel 8080 Microprocessor Altair 8800 ATmega328 Sparkfun Redboard
Below is a sampling of programming languages.  In each case, assume a LED is connected to pin 13 of the SparkFun Redboard and turned on by the program line(s) shown.
10 DIR(13,1)
20 POUT(13,1)
Tiny BASIC is a high level language that resembles standard English.  The programmer assigns line numbers (like "10" in the example) according to the order of statement execution.  The DIR statement configures pin 13 (first parameter = pin number) for outputting (second parameter = "1" for output or "0" for input).  Similarly the POUT statement sets pin 13 to "1" a high ("1" outputs a high or "0" outputs a low) turning on the LED.  One advantage of BASIC for beginners is that it permits most statements to be executed directly from the keyboard so that the statement's effect is immediately known.  This encourages experimentation and simplifies testing.  It should be noted that standard BASICs would probably not have a statement like this.  It was added to open source AVR Tiny BASIC in Experiment 12 as a custom statement.
void setup() {
   pinMode(13, OUTPUT);
void loop() {
   digitalWrite(13, HIGH);   // turn the LED on (HIGH is the
   voltage level)
C++ is a high-level language that allows greater access to the microprocessor hardware, but retains a good human language interface.  The code seen here is actually an Arduino "Sketch" that uses C++ functions to link user code to a compiler that prepares the actual code to be executed on the Redboard's ATmega328.
.equ ddrb = 4
.equ portb = 5
; Set Up Digital I/O
SBI ddrb,5 ;set pin 13 (direction register port b bit 5) LED as output 
; Main Program
SBI portb,5 ;turn on LED on pin 13 (port b bit 5)
Assembly language as seen here is a low-level programming language that implements a symbolic representation of the microprocessor's machine codes and other constants needed to create a machine level program.  The first SBI (Set Bit I/O Register) instruction sets the data direction for I/O register PORT B bit 5 (pin 13 on the SparkFun Redboard).  A second SBI sets the port and bit to high turning on the LED.
9a2d      1001101000100101   ddrb = 4  bit = 5
9a21      1001101000101101   portb = 5 bit = 5
SBI code byte = 10011010AAAAABBB
where AAAAA = port#  BBB= bit#
To the left is actual machine language code that turns on the LED.  The two 16-bit instructions begin with the SBI (Set Bit I/O Register) instruction code "10011010" followed by the register number "00100" and "00101" (decimal 4 and 5 respectively) and end with the bit number "101" (decimal 5).  The first instruction sets the direction of port bit 5 to output (port B data direction is controlled by I/O register 4).  The second instruction sets the port bit to high (port B data is read or written to I/O register 5). The machine code is the same as that generated by the assembly language program lines above, but lacks the helpful mnemonics and labels.  Keep in mind that machine code executing in the microprocessor is actually what turns the LED on.  Assembly language's precise control of the microprocessor and its resources offers great potential for maximizing program performance and efficiency. 

The Front Panel Project contents are listed below.  Take the items in order or skip around.  Experiments 1 to 4 use machine coding with the Front Panel 8080 emulator.  In Experiments 5 to 7, programming is done in assembly language and testing with the Front Panel 8080 emulator.  Experiments 8 to 12 utilize ATMEL Studio 7 integrated development platform with testing on the SparkFun Redboard.  In Experiment 12, open source AVR Tiny BASIC is customized to access ATmega328's peripherals on the SparkFun Redboard.

For More Information or to report problems, contact: Dick Whipple at dickwhipple@whippleway.com