6802 Microprocessor Kit

Wichit Sirichote, kswichit@kmitl.ac.th

Build a nice and simple single board computer using Motorola 6802, the CPU from 1976!


I got my hobby time to design and build the early 1976 Microprocessor 6802 single board computer. The 6802 chip is NMOS, drawing much power compare to CMOS. The main platform is the same as 6502 kit. The 6802 has two accumulators, 16-bit Index register 16-bit stack pointer and more relative branch instructions. The 6802 chip is software compatible with 6800 microprocessor. I have also added the brownout reset chip, so the kit will properly reboot after brownout condition. This design concept makes the 6802 kit be a cheap microprocessor learning tool for young and retried people. Learning 6800 instructions is fun.
Figure 1: Motorola 6802 Microprocessor kit

A simplified block diagram of the 6802 Microprocessor kit is shown in Figure 2. Main parts are 6802 CPU, memory chips, 16kB EPROM and 32kB SRAM. EPROM stores the monitor program and SRAM stores the variables and stack memory. The memory and I/O spaces are selected by PLD decoder. The oscillator is onchip 4MHz with internal 1MHz for CPU operations. I used CMOS latch, 74HC573 as the output port and tri-state buffer, 74HC541 as the input port. The display for address and data is 6-digit 7-segment LED. Input device is hex keypad. The extra circuit, 100Hz tick generator is for experimenting with time trigger programming. The software UART is 2400 bit/s. It is used for Motorola s-record downloading.
Figure 2: 6502 Microprocessor Kit block diagram. 

Hardware descriptions: U16 is NMOS 6802 CPU. The 4MHz is generated by onchip oscillator with internal frequency 1MHz for CPU operations. The internal RAM is disabled by connecting RE (pin 36) to GND.

U1 is 32kB EPROM, 27C256. The address space for EPROM is decoded at 0xC000-0xFFFF, where the RESET, IRQ, SWI, and NMI vectors are located. U2 is 32kB static RAM, 62256. The RAM space is located at 0x0000-0x7FFF. Zero page is located at 0x0000-0x00FF. User program can be tested from address 0x0200.

U4, memory and I/O spaces decoder chip is made with GAL16V8D. It provides chip selected signals for memory and I/O chips. U6 and U17 forms the shift register used for single instruction execution. The E pulse shifts the logic high from input pin to the output at the 11st cycles. This logic high will be inverted to produce NMI signal to interrupt the CPU. User instruction will be executed once and NMI will be serviced saving the CPU registers to user registers.

U3, the 20-pin 89C2051 microcontroller chip produces 10ms tick. SW1 selects between 10ms tick or manual IRQ button.

U13, 74HC541 is 8-bit input port (PORT0). Six bits, PA0-PA5 are input signals of the row keypad. PA6 is user key for repeat function. A8 pin is RxD pin of 2400 bit/s software controlled UART. U11, 74HC573 is 8-bit output port (PORT2). The 8-bit output drives the 7-segment LED directly. No current limit resistor. U12 (PORT1) drives 6-digit common cathode pin. The brightness is controlled by PWM. PC7 shares both speaker output for beep signal and TxD pin for 2400 bit/s UART. PC6 controls single step operation.

U14, 74HC573 is 8-bit output port for 8-bit binary number display. D13 lifts the forward biasing for proper brightness. J11 is 20-pin socket for text LCD interface. U15, MAX232 converts TTL level to RS232 level.

Q2, KIA7042 is reset chip for power brownout.  
Figure 3: Hardware schematic. 

PLD equations : U4 is a PLD chip used to select the memory and I/O ports. The address and I/O space can be programmed using PLD equations. The source file of PLD equations is shown in Figure 4. The PLD compiler is ATMELWinCupl. The output file, JEDEC will be used to program the PLD chip by a PLD programmer.

Name 6802KIT ;
PartNo 16V8 ;
Date 12/1/2014 ;
Revision 01 ;
Designer Engineer ;
Company Fangkhao ;
Assembly None ;
Location ;
Device g16v8a;

/* *************** INPUT PINS *********************/
PIN 2 = E;
PIN 3 = RW;
PIN 4 = A10;
PIN 5 = A11;
PIN 6 = A12;
PIN 7 = A13;
PIN 8 = A14;
PIN 9 = A15;
PIN 1 = A0;
PIN 11 = A1;

FIELD ADDRESS = [A15..A12];

/* *************** OUTPUT PINS *********************/
PIN 12 = ROMCE;
PIN 13 = RAMCE;
PIN 14 = GPIO1;
PIN 15 = RAMWR;
PIN 16 = LCD_E;
PIN 17 = PORT0;
PIN 18 = PORT1;
PIN 19 = PORT2;

!ROMCE = RW & E & ADDRESS:[C000..FFFF];
!RAMCE = ADDRESS:[0000..7FFF];
!RAMWR = !RW & E & ADDRESS:[0000..7FFF];
!LCD_E = !A15 # A14 # A13 # !A12;
!GPIO1 = RW # !E # !A15 # A14 # A13 # A12 # A1 # A0;
PORT0 = !RW # !E # !A15 # A14 # A13 # A12 # A1 # !A0;
!PORT1 = RW # !E # !A15 # A14 # A13 # A12 # !A1 # A0;
!PORT2 = RW # !E # !A15 # A14 # A13 # A12 # !A1 # !A0;

Figure 4: PLD equations. 

10ms System Tick: U3,8051 compatible microcontroller is used to generate 10ms tick. The circuit runs with 6802 clock, E signal. The tick signal is output at P3.7. TP1 is 50% duty cycle with frequency of tick/2. D1 is for indicating tick signal. Calibrating the correct tick frequency can be done by testing the pulse frequency at TP1.
Figure 5: 10ms tick generator built with AT89C2051 microcontroller. 

The source code was written in assembly code. TxD pin is available for user experiment with commands receiving from 6802. The sample below is fixed frequency 100Hz or 10ms tick.
; 10ms systemTick TIMER CHIP FOR 6502 KIT         
$mod52
         dseg at 30h
TICK: DS 1
       cseg at 0
       jmp main
         
       org 00bh
timer0_vector:
       JMP timer0_SERVICE
           
       org 100h
;-----initialize data-----------------------------
main: mov r7,#0
       djnz r7,$ 
       mov sp,#60h ; set stack pointer to 60h
       MOV P1,#0FFH
       MOV TICK,#0
 mov tmod,#1 ; set timer mode 1
       setb et0 ; enable timer0 interrupt
       setb ea ; enable all interrupt
       setb tr0 ; run timer0
       SJMP $
; RELOAD 0FCBFH FOR 10ms INTERRUPT
TIMER0_SERVICE: 
           
   PUSH ACC
   ORL TH0,#0FCH ; reload initial value 
   ORL TL0,#0BFH ; 
   
   CLR P3.7 ; produce interrupt trigger to IRQ
   NOP      ; 
   SETB P3.7 ; 
    CPL P1.6 ; CHECK TICK FREQUENCY 
    INC TICK
    MOV A,TICK
    CJNE A,#100,SKIP
       
       MOV TICK,#0
       Clr P1.7
       MOV R7,#30
       DJNZ R7,$
       SETB P1.7
SKIP:  POP ACC
       RETI
Figure 5: Source code listing of 10ms tick generator. 

Hardware Features:

-CPU: Motorola 6802, NMOS 8-bit Microprocessor @1MHz clock
-Memory: 32kB RAM, 16kB EPROM
-Memory and I/O Decoder chip: Programmable Logic Device GAL16V8D
-Display: high brightness 6-digit 7-segment LED
-Keyboard: 36 keys
-RS232 port: software controlled UART 2400 bit/s 8n1
-Debugging LED: 8-bit GPIO1 LED at location $8000
-Tick: 10ms tick produced by 89C2051 for time trigger experiment
-Text LCD interface: direct CPU bus interface text LCD
-Brownout reset: KIA7042 reset chip for power brownout reset
-Expansion header: 40-pin header

Software descriptions: Monitor program was written with 6802 instructions. The source code was translated to hex code using TASM assembler. Main body is forever loop keyboard and 7-segment display scanning. When key pressed the associated functions will be serviced.

The monitor program features are,

-Simple hex code entering
-Insert and Delete byte
-Single step running
-User registers: ACCA, ACCB, IX, SP, and Condition code registers for storing CPU status after -program execution
-Page zero memory display
-Easy offset byte calculation for Relative addressing mode
-Copy block of memory
-Motorola s-record or Intel hex file downloading
-Memory dump
-Beep ON/OFF
-Demo programs

The monitor program will be updated and available for testing at the download links.

Keyboard layout: Making key layout sticker is simply done by printing the SVG file to sticker paper.
Figure 6: Keyboard layout. 

Figure 7: With Big letter LCD. 

PARTS LIST

Semiconductors

U1 27C256, 32kB EPROM
U2 HM62256B, 32kB SRAM
U3 AT89C2051, 2kB Microcontroller
U4 GAL16V8D, PLD
U6 74HC164, shift register
U7 74LS14, hex inverter
U8 LM7805, voltage reguator
U10,U9 LTC-4727JR, common cathode LED
U11,U12,U14 74HC573, 8-bit Latch
U13 74HC541, tri-state buffer
U15 MAX232A, RS232 level converter
U16 6802 Motorola 8-bit Microprocessor
U17 CD4076B, D-FF
D2 TVS5V_SOD123
D3 1N4007, rectifier diode
D4 TONE, LED
D13 1N5236A, zener diode
Q1 BC327, PNP transistor
Q2 KIA7045, reset chip

Resistors (all resistors are 1/8W +/-5%)

R1 680
R2,R3,R5 1k
R8,R4 4.7k
R13,R6 10k
R11,R7 10k RESISTOR SIP 9
R9 330
R12,R10 10

Capacitors

C1 22uF electrolytic
C2,C13,C14,C15,C16,C17 10uF electrolytic
C3 10uF 16V electrolytic
C4 1000uF25V electrolytic
C5,C6,C7,C8,C9 0.1uF disc ceramic
C10,C11 0.1uF disc ceramic
C12 10uF 10V electrolytic
C19,C18 100nF disc ceramic

Additional parts

JJP1 HEADER 20X2
JR1 CONN RECT 16 text LCD connector
J1 DC Input
J2 CON3 3-pin header
LS1 SPEAKER
SW1 ESP switch
SW2 IRQ
SW3 RESET
SW4 user
S1,S2,S3,S4,S5,S6,S7,S8, S9,S10,S11,S12,S13,S14,Tact switch
S15,S16,S17,S18,S19,S20,
S21,S22,S23,S24,S25,S26,
S27,S28,S29,S30,S31,S32,
S33
TP1,TP2,TP3 TEST POINT
TP4 +5V
TP5 GND
VB1 SUB-D 9, Male (cross cable)
Y1 4MHz Xtal
PCB double side plate through hole
LED cover Clear RED color acrylic plastic
Keyboard sticker printable SVG file

 

Kit information, please contact Wichit Sirichote

Download Schematic,Monitor source code and HEX file(27C256) , PLD files, AT89C2051 HEX file, Keypad SVG file

November 3, 2015 Rev 1.0 Programming Book for 6802 Kit
October 1, 2015 Rev.1.0 6802 Kit User's Manual


<

18 January, 2016