Wednesday, January 21, 2009

The Python Programming Language

I am finally getting around to saying a word or two about Python (www.python.org). Python deserves mention on a simple computing blog because while the language is not simplistic or limited, the syntax lends itself to expressing your computing ideas in a very natural way. Contrast this with a scripting language like Perl with its myriad special characters and non-intuitive expression.

Python is . . .

  • Object-oriented - Python is fully object oriented complete with classes, operator overloading, and multiple inheritance. Despite this, even a beginner can write useful code in minutes without getting anywhere near object-oriented programming.
  • Portable - Python compiles into portable bytecode which runs on any platform with python installed. The language itself is written in C and compiles on just about any platform including Linux, Mac, Windows, whatever...
  • Easy and fun to use - writing Python is a pleasure! You just sit down and write and out comes useful code.
How can you use Python?
  • Applications - complete toolkits exist for developing GUI applications that run on multiple platforms. These include wxPython and TKinter.
  • Prototyping - because you can write useful code in minutes, Python is great for proving concepts at the outset then porting the code to a compiled language for production.
  • Internet scripting - built in internet modules let you easily retrieve and parse HTML (web scraping), move files with FTP and communicate with email using SMTP and POP protocols. Python is the language behind entire web publishing frameworks, such as Django. Or, you can write simple CGI scripts that add interactivity to your web site.
Really the question is what can't you use Python for?

P.S. - Python includes a built-in module for another simple computing winner, SQLite!

Saturday, January 10, 2009

Building A Computer?

Building a computer these days conjures images stuffing of CPUs, memory modules, and hard drives into a motherboard and throwing the whole thing into a big black case and running Windows or Linux.

But how about really building a computer, with micro chips and a soldering iron?

In a recent SolderSmoke podcast OM N2CQR asked the audience if anybody had a spare CD4019 chip to replace a defective one in his frequency counter, so I searched through my junque box for the part, but alas no such luck. However, in the process I cataloged the ICs (so I can just look up parts in the future) and found quite a trove of IC chips including logic, memory, and several CPUs. A microcomputer or other microprocessor based device could be built with the parts on hand, I thought.

I remember fondly my days in high school when we had a H-89 to play and learn with and then later, learning about assembly language programming using 8080A "trainers" and decided it would be fun to recapture some of that magic. So here's what I have to work with:

  • Several CPUs including Z80, 8080, and V20 chips.
  • Z8 romless microcontroller
  • 6kb worth of 2114 static RAM
  • A 2764 EPROM
  • assorted 74-series and CMOS chips
  • several DAC08 D/A converters
The project guidelines are simple, whatever is built must:
  • use mainly parts on-hand. A few inexpensive parts may be purchased if needed, but no big cash outlay is allowed.
  • be useful. The unit must be capable of performing some useful work.
  • look good. It should be housed in an attractive enclosure with neatly labeled controls.
Some possible projects include:
  • A microcomputer, this is the obvious choice. Some very nice work has been done with homebuilt computers. The Magic-1 is a handmade microcomputer including homebrew CPU, not a microprocessor. Nice!
  • A music synthesizer. The DAC08 chips could be used for waveform synthesis. The Z80 in particular, has been used in several synthesizers for control and sound generation.
  • A weather data monitor and logger. A microprocessor based unit could sample wind speed, direction, air temperature and barometric pressure.
My inclination is toward using the Z80 as they are more sophisticated than the 8080A and I have two of them on hand. With only 6K of static RAM, the memory situation is a bit lean, but maybe I can pull the old DRAM chips from my PC XT. That's 640K, and Bill Gates said that should be all I need, or did he?