CMOS Electronics Blog

MC68008 Calculator: MC6821 PIA

I ran into an issue with interfacing the HD44780. It turns out that even though the HD44780 is often called a Motorola bus peripheral, it is not actually a Motorola bus peripheral. It is actually designed for the MCS-51 series of microcontrollers. Just because it has E and R/W pins doesn't mean it is a Motorola bus peripheral. So I am going to have to use a MC6821 PIA to control the LCD. This also means I will likely have to add another PIA for the keyboard. The two PIAs are going to cause the size of the PCB to increase considerably.

I have written some code to test the PIA:

STACK = $80100            ; top of stack
PORTA = $E0000            ; MC6821 Peripheral Register A
CTRLA = $E0001            ; MC6821 Control Register A
PORTB = $E0002            ; MC6821 Peripheral Register B
CTRLB = $E0003            ; MC6821 Control Register B

    jmp piatest           ; run the PIA test

; outputs 0 to 255 to PORTA of the PIA
    move.l #STACK,a7      ; initialize stack 
    move.b #$00,CTRLA     ; select DDRA
    move.b #$FF,PORTA     ; port A is output
    move.b #$04,CTRLA     ; select PORTA
    eor.l d0,d0           ; clear d0
    move.b d0,PORTA       ; write d0 to PORTA
    add.b #1,d0           ; d0 = d0 + 1
    jmp .ledcycle         ; repeat

MC68008 Calculator Initial Design Plan

I have decided to make a calculator based around the MC68008 microprocessor.

Why the 68008?

  • It has a 8-bit data bus.
  • It can handle 32-bit numbers.
  • I already have one.


  • Must be small enough to be considered a calculator.
  • Must be able to do all scientific operations.
  • Must not be able to graph.
  • Must be able to run on batteries.
  • Must have a character screen.
  • Must have a keyboard.


  • There will be a lot of glue logic, which will increase the size.
  • Many of my chips are NMOS which have higher power consumption rates.
  • My MC6802 chip has a broken leg.
  • HD44780 has an advertised maximum speed of 2 MHz.
  • The code must be ROMable

Hardware Selected

  • CPU: MC68008
  • RAM: TC551001CP (128K x 8)
  • ROM: AM27C040 (512K x 8)
  • PIA: MC6821
  • LCD: HD44780 16x4 Character LCD