Archive for February, 2002


Monday, February 11th, 2002

This is a timer I built using a gutted alarm clock and a 2051. I developed the hardware using a DS5000 based emulater and the 89s8252 based programmer that I built last fall.


The emulator

The programmer

Testing with actual chip

The carcas

The finished product buried on the messy bench


/*---------------------------------------------------------------------timer.c** This is the code for a soldering iron timer. 
* C 2002 Donald Delmar Davis (** The hardware is built around the 20 pin atmel 89C2051. 
* (* This program was compiled using sdcc (** P1 is connected to the lower half of a 3.5 digit multiplexed clock display.* P3.0 is connected to the transister driving a relay.* P3.4-3.7 are connected to a BCD switch.* 
* P3.3 is connected to an off switch. (currently unimplimented).** The reset switch causes the machine to read the BCD switch. The timer 
* then counts down from 10 times the switch value plus 5 minutes. 
** Most of the work is done by the timer interupt which not only counts* time but also multiplexes the display. 
*----------------------------------------------------------------------------*/#include #define RELAY P3_0static unsigned int pulses;static unsigned char seconds,ones,tens;code unsigned char tens_b[] = {0x58,0x00,0x38,0x30,0x60,0x70,0x78,0x00,0x78,0x70};code unsigned char tens_a[] = {0xf0,0xb0,0xe0,0xf0,0xb0,0xd0,0xd0,0xf0,0xf0,0xf0};code unsigned char ones_b[] = {0x07,0x06,0x05,0x07,0x06,0x03,0x03,0x07,0x07,0x07};code unsigned char ones_a[] = {0x8b,0x80,0x8e,0x86,0x85,0x87,0x8f,0x80,0x8f,0x87};/*---------------------------------------------------pulse_count * Count "pulses" from timer1 also multiple the display. * timer1 is set up to count 9600 ticks per second. * * * This could probably be optimized to create cleaner assembly. * does the job just fine. 
 */void pulse_count (void) interrupt 3 {pulses++;if (pulses==9600) {  if (++seconds == 60) {        if (ones==0){          ones=9;          if (tens==0) {            RELAY=0;	    P1=0;           /* could power down here */ 
	    while (1) ;          } else {          tens--;          }        } else {        ones--;        }   seconds=0;   }   pulses=0;}if (pulses&0x0001) {  P1=tens_a[tens]|ones_a[ones];} else {  P1=tens_b[tens]|ones_b[ones];}}main(){TMOD &= 0x0f;        /* clear timer 1 control bits     */TMOD |= 0x20;        /* set timer 1 to mode 2          */ 
TL1 = -3; TH1 = -3;  /* 9600bps with 11.059MHz crystal */TR1 = 1;P1=0x11;ones=0;tens=0;seconds=0;pulses=0 ;P3 = 0xff;RELAY=1;tens=(((~P3&0x80)>>1)|(~P3&0x38))>>3;ones=5;ET1=1;     /* enable timer 1 interupt */EA=1;      /* enable interupts        */ 
while (1){; }}

Bootstrap 89×051 programmer

Monday, February 11th, 2002

Bootstrap 89×051 programmer

This is a result of many searches through the web to put together a 4051 programmer. Most of the programmers required a preprogrammed 4051. Many of them used the reference circuit provided by atmel to supply the 0/5/12 programming voltage. This circuit used a 317 and a series of odd resister values which I had to fabricate using several less odd ones. •• I found a c based programmer which served as an algorythm. Unfortunately the source code was written for a commercial compiler. •••

So what the world needs now is another 89X051 programmer ••••This programmer uses an $7 Atmel AT89S8252 or AT89S53 which is programmed in circuit using Vona’s ’89prog’ and a 50cent Paralell Cable adapter. Asside from the Atmel which you can get from jdr microdevices or from digikey you can pretty much get everything else at radio shack. You could also probably use another in circuit programmer. I just figured this one out first. To make the programming more straight forward most of the pins required for programming are connected straight across (P1.0-7,P3.2-5) I may try to make a board which will work both as an adapter/emulator. The programming voltage circuit which uses common resistors values and general purpose transisters is from the burn project. It is written in the publically avaliable Small Device C Compiler.

  • Code
  • schematic

  • (I hate all of those 4051 programmers that require a preprogrammed 4051. They Suck!)
    •• (So does atmels 0/5/12 Programming Voltage circuit with its weird resistor values. It sucks too)
    ••• (which of course sucks).
    •••• (like I need a hole in my head).

8051 Projects (circa mid 2002)

Monday, February 11th, 2002

The 8051 has come along way since I was a student. Windowed eproms etc, I would go into it but eventually I would sound like one of those old IMSI 8080 owners talking about loading their bootstraps one bit at a time.
I have been working with the ds5000 and the atmel flash based family. A noticable issue with the 8051 is the lack of a decent public domain c compiler. For this reason I have shifted from the AVR with an eye on the motorolas.

4051 programmer This is my first 89s8252 project
Soldering Iron Timer This is the first thing I did with my development environment