A simple logic analyser project (or digital storage oscilloscope), the site thinks, will show most 8051 features. That includes ports, timers, the UART, interrupts, external RAM and data pointer. A port pin is configured as an input by writing a logic 1 to it- and this is the default state at power-on. (There is a short delay between writing the value and the corresponding voltage actually appearing on the pin). The external interrupt, Int0, is triggered by a negative edge at P3.2; the port value is captured, stored into external memory and the data pointer advanced until the memory is filled. It is very easy to modify the program so the last 8,192 samples prior to some event are recorded, which will more likely be useful for faultfinding.
The data is then moved to the computer by the serial link at 57,600 bps, after you press the P3.3 push button. Why should you have to do this? Sampling may take place a long way from the computer, and therefore a long serial cable is unnecessary. Alternatively, you could wait for the PC to send a serial message, before transmission of data commences. Here are all the programs for this project.
The PC will abort reception on getting a Control-Z character (26 decimal), and there are two ways around this: You either transmit data as two hex digits, which doubles the time, or replace number 26 by a 6 byte sequence which is unlikely to appear naturally. This has worked so far, and if occasionally the computer does not close the serially received file, the DOS console window is closed, and the file seems to be in place afterwards.
For some projects, the design time can be a few minutes, with a microcontroller (unlike procuring a PCB). The result is cheaper than a commercial device, and the microcontroller flash can be reprogrammed for many projects. Alternatively, a one-time programmable device may be obtained at a lower cost. However, the maximum speed is disappointing at about 100,000 samples per second for the 11 MHz crystal. The memory available will be filled very soon at that rate.
Some people say they are using the 89S8252 at 24 MHz, though reliable operation may only be available for a short time, and not under general conditions. In any case, the DS89C420 provides 33 Mips- and then some. Some care is needed though, since the devices are backwards compatible with the 8051 (obviously excluding the timing of commands), but not entirely between themselves. If you are concerned your code should be immediately portable to another 8051 variant, you must not exploit the special features of later chips.
The memory should really have been driven by two 8-bit counters, like the 74LS393, and then a (much simpler) microcontroller is only needed for control and communications with the PC. Actually, if your code can cope with the different versions of parallel ports available, you don't need a microcontroller at all. The site will get back to this project.
If you are in for debugging delights, the test programs included in the file to download should help: Port test provides audible frequencies of 14 kHz at P0.0 and P1.0 and P2.0 and P3.0, 7 kHz at P0.1 and so on, assuming an 11 MHz crystal. You can listen to them on a high impedance earphone, in series with a 470 Ohm safety resistor. ( As P0 is open collector, a 4.7k resistor connected to power will also be needed for this one). A test of the serial flash programming interface is therefore provided by this program, as well as some confidence the 89S8252 is functional. If it fails, you will want to check that power is supplied to the chip, the crystal is properly connected, and the serial interface. It is not necessary to fit the latch and memory for this test.
A memory test is implemented (for A8 to A14) by producing audible frequencies of 220 Hz at P1.0, 110 Hz at P1.1 and so on, as the memory is filled with an incremental pattern. For A0 to A7 the frequencies are 2.5 kHz at P1.0, 1.25 kHz at P1.1 and so forth. If you miss one of the tones, the corresponding address line is suspected, while both tones missing probably point to the datapath around the latch or memory. For example, at my first try I did not get the 2.5 kHz tone, revealing a cold joint at A0.
The last test is for the user (not flash programming) serial port: The personal computer is set at 57,600 bps, eight data bits and no parity, while the DSR and CTS sensitivity must be defeated (see the capture.bat file). A text file is sent from the PC, which is longer than 8,192 bytes, and you get just those bytes back after you press the P3.3 pushbutton.
You will need microflash.exe for serially reprogramming the flash memory. (It is rather discomforting that there is no obvious verification message, but the board certainly seems to be doing what it is told). While the package includes Tasm, the table driven assembler, it seems to be shareware. On the other hand, here is a freeware 8051 compiler (alternate ftp site). You can go a long way simply by cutting and pasting other programmers' code, but if you are developing anything substantial, you will find a free 8051 simulator useful. (It also needs 8051.dll). If you want to know more about the 89S8252, you will need a datasheet. Some of the material (like timers and the UART) is omitted, being virtually unchanged from the 8051 datasheet.
External links were checked at the time of writing, but the site assumes no responsibility for them in the future.