Category: 8051

  • Introducing my latest rathole: PiTerm1986

    This is a snapshot of the current readme: Updates and current progress are on its github page: https://github.com/feurig/PiTerm1986

    GOAL: Convert 80s style user interface ( 8031 based ADP Product: chicklet keyboard and 2×20 lcd ) to pi zero based terminal using i2c based io expanders.

    Looking under the keyboard membrane and tracing the connectors we can get the following key map under a 4×12 array (16 pins).

       0123456789 10  11
       --------------------
    0) *# ZXCVBNM/    <STOP>
    1) -LASDFGHJK<N/C><ENTER>
    2) 0912345678<BS> <START>
    3) POQWERTYUI<CAN><DIAL>
    *#ZXCVBNM/STOP
    LASDFGHJKN/CENTER
    0912345678<—-START
    POQWERTYUICANCELDIAL

    Keyboard

    For this we look at the AW9523 GPIO expander with 16 pins of io.

    LCD/VFD

    Since the LCD is a 5v circuit requiring either 8 or 12 pins we look at the Microchip MCP23017 on the Adafruit GPIO Expander Bonnet which we can wire either using both ports or one port in nibble mode.

    Via : https://protostack.com.au/2010/03/character-lcd-displays-part-1/

    Attaching Both Boards to the Raspberry pi.

    root@somepi1:/home/feurig# i2cdetect -y 1
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    50: -- -- -- -- -- -- -- -- 58 -- -- -- -- -- -- -- 
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    70: -- -- -- -- -- -- -- --                         

    Assembly and layout.

    After putting the board in the box I realized that the grey paint was conductive and that I almost let the smoke out of the pi zero. (you could smell it). So I went out and found a piece of plastic from a previous project. 

    And then I was like OH SHIT I have Noritake 2×24 VFD thats a close fit..

    So there’s a circuitpython library for an mcp23017 connected to an lcd. Wiring it up according to the above schematic lets us write away

    root@somepi1:/home/feurig# pip3 install adafruit-circuitpython-charlcd
    ...
    root@somepi1:/home/feurig# python3
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import board
    >>> import busio
    >>> import adafruit_character_lcd.character_lcd_rgb_i2c as character_lcd
    >>> lcd_columns = 24
    >>> lcd_rows = 2
    >>> i2c = busio.I2C(board.SCL, board.SDA)
    >>> lcd = character_lcd.Character_LCD_RGB_I2C(i2c, lcd_columns, lcd_rows)
    >>> lcd.message = "Hello\nPiTerm1986"
    >>> lcd.clear()
    >>> lcd.message = "PiTerm 1986 v0.0\nOk >"
    >>> 

    I am not thrilled about the way its wired but whatever.

    References

  • Timer

    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.

    Schematic


    The emulator

    The programmer

    Testing with actual chip

    The carcas

    The finished product buried on the messy bench

    code

    /*---------------------------------------------------------------------timer.c** This is the code for a soldering iron timer. 
    * 
    * C 2002 Donald Delmar Davis (delmar@digithink.com).** The hardware is built around the 20 pin atmel 89C2051. 
    * (http://www.atmel.com/atmel/products/prod71.htm)* This program was compiled using sdcc (sdcc.sourceforge.com)** 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

    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)

    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