In the last week I have been thinking about the user interfaces used on minicomputers of the 1960s, in particular the PDP-8, and wondering if a similar front LED and switch panel could be created cheaply as a nostalgic retro accessory shield for the Arduino.
I have added some LEDs to the 12 available digital I/O pins of the Arduino, so that I can recreate LED chaser and "vintage computer" style displays.
I've extended the SIMPL command set so that I can more easily address each LED in turn, or alternatively treat all twelve as a binary numerical display, to display address or data numbers in the range 0 to 4096.
The latest version of SIMPL can be found here on Github Gist:
https://gist.github.com/anonymous/facc9a262c0778aec7b6
Just download the Gist and compile it as an Arduino sketch. You can then start typing SIMPL commands using the serial monitor window at 115200 baud. Make sure that you have selected the "Both NL and CR" option for the serial monitor.
Output Commands
In order to gain more immediate access to the I/O, I have added some new commands:
a - sends an analog.Write value to a pin previously named with d
b - prints out the current value of the milliseconds counter, allowing loop timing to be calculated
c - prints out the current value of the microseconds counter
h - sets a digital pin high eg 6h
l - sets a digital pin low eg 13l
n - decodes a number up to 4095 and displays it on digital pins 2 to 13 eg 1234n
n can be thought of as a very simple binary display. It has a fast response time and allows the user a simple visible means of checking that a program is executing.
The n command can be useful to examine the characters stored in RAM. Here it is used to output 1000 characters to the LEDs, starting at RAM address 256. The characters are sent every 100mS and also printed to the terminal.
255!1000{y@rn100m}
255! Store 255in y as the starting RAM address
1000{ Perform the loop 1000 times
y Increment y each time around the loop
@ Move y into x
r read the contents of RAM into x
n Send the value to the LED display
100m 100mS delay to slow things down to a sensible speed
} End of the loop
Decision Making
SIMPL currently lacks the if, then, else decision making, or the switch case structure. This would be a useful addition and I am currently working on some ways of implementing it.
It might be possible to test the x value against certain constants and then execute one of the upper case routines if the test was equal.
Other SIMPL Commands
SIMPL instructions are a mix of lower case ASCII characters, symbols and punctuation marks. These are the primitives, which are interpreted in sequential order by a simple interpreter. The interpreter is an extension of Ward Cunningham's Txtzyme interpreter, which recognises the following:
a Send an analog write (PWM) value to a pin
b print out the current milliseconds count
c print out the current microseconds count
d define a digital port pin
e
f
g
h set pin high
i read an input
j skip next instruction
k access the loop counter
l set pin low
m define a delay in milliseconds
n display a number on a line of LEDs
o set an output
p print the x variable to the terminal
q query a block of RAM locations ( as character)
r read from RAM
s read an analogue input
t
u define a delay in microseconds
v
w write to RAM
x increment x
y increment y (as used in incrementing loop structures)
{} loop the code contained within the braces
@ copy y to x
! store x in y
? Dump the contents of RAM to show the existing words
+
-
*
/
<
>
Numbers can be typed in the range 0 to 65535 and are stored in the x variable and used to control the above instructions.
eg. 6d define digital port pin 6
100m define a delay of 100mS
10{....} go around a loop 10 times
20p Print 20 to the terminal
To these basic instructions I added a y variable, so that I could do simple maths. You can store a number in y by using the store symbol !
20! Stores the value of 20 into y (by transferring it from x)
To get the contents of y back, we use the fetch symbol @
20!@p Prints the value of 20 from y
We can do simple addition, subtraction, multiplication and division on x and y
20!5+p Adds 20 to 5 and prints result (x=x+y)
5!30-p Subtracts 5 from 30 and prints result (x=x-y)
16!8*p Multiplies 8 by 16 and prints result (x = x*y)
6!30/p Divides 30 by 6 and prints result (x=x/y)
Downloading the SIMPL sketch from Github Gist and programming it into a standard Arduino is the first step to discovering a new way to control physical computing devices.
---------------Getting along in the 21st Century with half the baggage you carried in the last.------------ /*************************Low cost electronic solutions for a low impact lifestyle.************************/
Sunday, June 02, 2013
Saturday, June 01, 2013
Extending SIMPL and flashing a few LEDs
I have been experimenting with SIMPL, and have added a few new commands to give it greater functionality.
I've wired Digital outputs 2 to 13 to a line of 12 LEDs, to give a very simple means of displaying numerical values. It also allows LED chaser displays to be tinkered with.
I have added a command to allow the analogWrite function to control an output pin.
Name the pin first, e.g. 6d and then the PWM value such as 127a This sets the PWM to about 50% duty cycle.
I've also been investigating how fast the commands run, so added a couple of timing commands b and c. b prints the current value of the millisecond counter millis(), so typing b before and after a list of instructions will allow you to calculate how many milliseconds it took to execute. c does the same, but uses the microseconds counter micros().
By timing 10000 cycles of a loop, I can show that SIMPL will add two 16 bit integers in about 6 microseconds.
I have added some commands for easier control of the I/O. h and l are now used to set a port pin high or low eg. typing 6h and 5l will immediately set those pins high and low.
After my experiments with LED chaser displays, I also wanted a way to immediately write an 8 bit number to 8 consecutive LEDS. So the "n" command displays a number on a row of LEDs.
Typing 255n will turn all the LEDs on Digital 2 to Digital 9.
To make incrementing loops easier, the command "x" now increments x and "y" increments y.
0!10{y@p}
This prints out the numbers from 1 to 10. 0! sets y to zero, y increments the y variable.
The q, r and w commands have been used to access the RAM.
300r will print the character stored at address 300.
SIMPL instructions are a mix of lower case ASCII characters, symbols and punctuation marks. These are the primitives, which are interpreted in sequential order by a simple interpreter. The interpreter is an extension of Ward Cunningham's Txtzyme interpreter. SIMPL now recognises the following lower case instructions:
a Send an analog write (PWM) value to a pin
b print out the current milliseconds count
c print out the current microseconds count
d define a digital port pin
e
f
g
h set pin high
i read an input
j skip next instruction
k access the loop counter
l set pin low
m define a delay in milliseconds
n display a number on a line of LEDs
o set an output
p print the x variable to the terminal
q query a block of RAM locations ( as character)
r read from RAM
s read an analogue input
t
u define a delay in microseconds
v
w write to RAM
x increment x
y increment y (as used in loop structures)
{} loop the code contained within the braces
@ copy y to x
! store x in y
? Dump the contents of RAM to show the existing words
+ Add x and y
- Subtract x and y
* Multiply x and y
/ Divide x and y
< Is y < x
> Is y > x
I've wired Digital outputs 2 to 13 to a line of 12 LEDs, to give a very simple means of displaying numerical values. It also allows LED chaser displays to be tinkered with.
I have added a command to allow the analogWrite function to control an output pin.
Name the pin first, e.g. 6d and then the PWM value such as 127a This sets the PWM to about 50% duty cycle.
I've also been investigating how fast the commands run, so added a couple of timing commands b and c. b prints the current value of the millisecond counter millis(), so typing b before and after a list of instructions will allow you to calculate how many milliseconds it took to execute. c does the same, but uses the microseconds counter micros().
By timing 10000 cycles of a loop, I can show that SIMPL will add two 16 bit integers in about 6 microseconds.
I have added some commands for easier control of the I/O. h and l are now used to set a port pin high or low eg. typing 6h and 5l will immediately set those pins high and low.
After my experiments with LED chaser displays, I also wanted a way to immediately write an 8 bit number to 8 consecutive LEDS. So the "n" command displays a number on a row of LEDs.
Typing 255n will turn all the LEDs on Digital 2 to Digital 9.
To make incrementing loops easier, the command "x" now increments x and "y" increments y.
0!10{y@p}
This prints out the numbers from 1 to 10. 0! sets y to zero, y increments the y variable.
The q, r and w commands have been used to access the RAM.
300r will print the character stored at address 300.
SIMPL instructions are a mix of lower case ASCII characters, symbols and punctuation marks. These are the primitives, which are interpreted in sequential order by a simple interpreter. The interpreter is an extension of Ward Cunningham's Txtzyme interpreter. SIMPL now recognises the following lower case instructions:
a Send an analog write (PWM) value to a pin
b print out the current milliseconds count
c print out the current microseconds count
d define a digital port pin
e
f
g
h set pin high
i read an input
j skip next instruction
k access the loop counter
l set pin low
m define a delay in milliseconds
n display a number on a line of LEDs
o set an output
p print the x variable to the terminal
q query a block of RAM locations ( as character)
r read from RAM
s read an analogue input
t
u define a delay in microseconds
v
w write to RAM
x increment x
y increment y (as used in loop structures)
{} loop the code contained within the braces
@ copy y to x
! store x in y
? Dump the contents of RAM to show the existing words
+ Add x and y
- Subtract x and y
* Multiply x and y
/ Divide x and y
< Is y < x
> Is y > x
A Little Nostalgia
In the decade that spanned the 1960s, the cost of computers fell by about two orders of magnitude, and with volume manufacture possible, they found their way into general scientific engineering and industrial use.
One area of science that particularly benefited from more widely available computing power, was that of biomedical research. Two computer designs, in particular, spurred on this advancement, the LINC of 1962, and the PDP-8 of 1965.
About 50 LINC machines were built, and a few survive today. This video shows a restored LINC in use.
http://www.youtube.com/watch?v=atJUnQN65dE
These were the first "benchtop" designs, and set the trend in design for the machines that were to be known as minicomputers. In 1965 the PDP-8 cost $18,000, still a huge amount of money, but cheap enough to be built in volume and satisfy the needs of university laboratories.
Both the LINC and the PDP-8, owed their design to the general purpose digital modules, that were manufactured by DEC from the late 1950s onwards. Each machine was a pared down 12 bit design, cost engineered for efficiency at every level, offering a machine capable of real work for a modest price.
Over the next 20 years, the PDP-8 architecture was to be revisited many times, as advancements in logic ICs and memory allowed significant cost savings to be made. The original PDP-8 was the size of a small fridge, within 10 years it was housed in a single 19" rack. The very last PDP-8 machines used a microprocessor (Intersil/Harris 6120) to implement the CPU.
By the mid 1970s, microprocessors were starting to appear, which led to the era of 8-bit microcomputers. Some of these, such as the MITS Altair 8800 paid homage to the style of the PDP-8 with a front panel of many LEDs and programming switches. The simple LED indicators allowed the user to see precisely what the registers were holding, and the switches allowed simple programs to be "toggled" directly into memory.
These machines are now approaching 50 year old , yet there are many enthusiasts who started their scientific or engineering careers programming such computers. The National Museum of Computing at Bletchley Park owns an early PDP-8, which they have restored to working order. They have made a series of short videos depicting its operation.
Here's how a short program is loaded into the machine from the front panel switches.
http://www.youtube.com/watch?v=DPioENtAHuY
Notice how much noise was present in a typical computer room. Fans, printers and teletypes produces a near constant din.
The machines were relatively slow and simple by today's comparison, capable of some 300,000 instructions per second. Nevertheless, they were capable of real work, despite their limitations in speed and memory.
In the mid 1960s, the standard user interface was a teletype printer with paper tape punch and reader. Programs would be loaded into the memory from paper tape, but often only after a simple tape loader had been manually toggled into the machine from the front panel switches.
The second of the NMOC videos shows how program on the the paper tape was loaded into memory.
http://www.youtube.com/watch?v=SOOFHFnB0D8
Application programs had to fit within the 4K memory limitation. This video shows a Chess program, and the user interaction using the ASR33 Teletype, that was supplied with every PDP-8.
http://www.youtube.com/watch?v=OyDufWHsNVE
Contemporary to the LINC and the PDP-8 was a low cost magnetic tape drive, commercialised by DEC as the DECtape. The last of the NMOC videos, shows the DECtape in use
http://www.youtube.com/watch?v=TWTpYUTbW8s
One area of science that particularly benefited from more widely available computing power, was that of biomedical research. Two computer designs, in particular, spurred on this advancement, the LINC of 1962, and the PDP-8 of 1965.
About 50 LINC machines were built, and a few survive today. This video shows a restored LINC in use.
http://www.youtube.com/watch?v=atJUnQN65dE
These were the first "benchtop" designs, and set the trend in design for the machines that were to be known as minicomputers. In 1965 the PDP-8 cost $18,000, still a huge amount of money, but cheap enough to be built in volume and satisfy the needs of university laboratories.
Both the LINC and the PDP-8, owed their design to the general purpose digital modules, that were manufactured by DEC from the late 1950s onwards. Each machine was a pared down 12 bit design, cost engineered for efficiency at every level, offering a machine capable of real work for a modest price.
Over the next 20 years, the PDP-8 architecture was to be revisited many times, as advancements in logic ICs and memory allowed significant cost savings to be made. The original PDP-8 was the size of a small fridge, within 10 years it was housed in a single 19" rack. The very last PDP-8 machines used a microprocessor (Intersil/Harris 6120) to implement the CPU.
By the mid 1970s, microprocessors were starting to appear, which led to the era of 8-bit microcomputers. Some of these, such as the MITS Altair 8800 paid homage to the style of the PDP-8 with a front panel of many LEDs and programming switches. The simple LED indicators allowed the user to see precisely what the registers were holding, and the switches allowed simple programs to be "toggled" directly into memory.
These machines are now approaching 50 year old , yet there are many enthusiasts who started their scientific or engineering careers programming such computers. The National Museum of Computing at Bletchley Park owns an early PDP-8, which they have restored to working order. They have made a series of short videos depicting its operation.
Here's how a short program is loaded into the machine from the front panel switches.
http://www.youtube.com/watch?v=DPioENtAHuY
Notice how much noise was present in a typical computer room. Fans, printers and teletypes produces a near constant din.
The machines were relatively slow and simple by today's comparison, capable of some 300,000 instructions per second. Nevertheless, they were capable of real work, despite their limitations in speed and memory.
In the mid 1960s, the standard user interface was a teletype printer with paper tape punch and reader. Programs would be loaded into the memory from paper tape, but often only after a simple tape loader had been manually toggled into the machine from the front panel switches.
The second of the NMOC videos shows how program on the the paper tape was loaded into memory.
http://www.youtube.com/watch?v=SOOFHFnB0D8
Application programs had to fit within the 4K memory limitation. This video shows a Chess program, and the user interaction using the ASR33 Teletype, that was supplied with every PDP-8.
http://www.youtube.com/watch?v=OyDufWHsNVE
Contemporary to the LINC and the PDP-8 was a low cost magnetic tape drive, commercialised by DEC as the DECtape. The last of the NMOC videos, shows the DECtape in use
http://www.youtube.com/watch?v=TWTpYUTbW8s