Wichit Sirichote,

Turn the 8051 microcontroller kit into a dedicated controller that uses BASIC interpreter. Reprogram the main MCU, and remap the memory space. Simple and easy use for many applications.

The 8051 kit is a learning tool using machine code programming. With a simple modification, we can adapt it to be a dedicated digital controller that uses BASIC interpreter. The controller can be used as the digital controller for making an Automatic Testing Equipment. The control process can be programmed with simple BASIC language easily. It will need only terminal for code testing. No need to compile the source code. The operation can be activated under command mode. We can access PORT1 I/O bits using BASIC command directly. The power switch or contact input can be added to the PORT1 for a given testing easily.

The 8051 kit provides keypad, interrupt keys, binary display, 7-segment display, speaker, and text LCD display. We can use them as the input/output for a given testing equipment and interface them to the BASIC program directly.

Hardware modifications: The hardware wiring needs no any modification. Only the 89S52 microcontroller and PLD chip will be needed to reprogram.

Modification steps:

1. Reprogram the main MCU with BASIC interpreter.

2. Reprogram the PLD for new memory and I/O mapping

3. Use the 32kB NVRAM for program saving.

New memory map the memory and I/O spaces for BASIC-52 controller.

0000-1FFFH : 8kB onchip Flash memory stores the BASIC interpreter

2000-4FFFH: User space for BASIC program. The MTOP is set to 4FFEH

5000-7FFFH: With NVRAM, DS1230Y, is a space for program saving with command PROG.

8000-FFFFH: I/O spaces. Under BASIC statement, we can use XBY(8100H)=0FFH to write FF to GPIO1 LED easily.

The I/O space for 8051 Kit board are:

8100H: GPIO1 LED

8000H; LCD command write

8001H: LCD data write

8002H: LCD Command read

8003H: LCD data write

8200H: PORT0, 8-bit input port

8201H: PORT1, digit drive

8202H: PORT2, segment drive

All I/O devices are mapped using external data memory. We can access them easily with XBY(address) command.

PLD equations : The new PLD equation is shown below.

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

/* *************** INPUT PINS *********************/
PIN 2 = RD;
PIN 3 = WR;
PIN 5 = A8;
PIN 6 = A9;
PIN 7 = A10;
PIN 8 = A15;
PIN 1 = A0;
PIN 11 = A1;

/* *************** OUTPUT PINS *********************/
PIN 14 = GPIO1;
PIN 16 = LCD_E;
PIN 17 = PORT0;
PIN 18 = PORT1;
PIN 19 = PORT2;

RAMCE = A15;

RAMOE = A15 # (RD & PSEN);


!GPIO1 = WR # !A15 # A10 # A9 # !A8 # A1 # A0;

!LCD_E = (RD & WR) # !A15 # A10 # A9 # A8;

PORT0 = RD # !A15 # A10 # !A9 # A8 # A1 # A0;

!PORT1 = WR # !A15 # A10 # !A9 # A8 # A1 # !A0;

!PORT2 = WR # !A15 # A10 # !A9 # A8 # !A1 # A0;

Figure 2: PLD equations for BASIC-52 CONTROLLER.

Using VT100 terminal with fixed BAUD rate 9600.

When connecting the terminal to the BASIC-52 controller board, it will send prompt.
Prompt when power on reset

We can write the BASIC program directly.

Print hello worlds program in BASIC

Simple program FOR-NEXT loop.

Looping with FOR-NEXT

Making LED running at the GPIO1 at location 8100H is very simple with XBY( ) command. To break running, press Crt-C.

Binary counting at GPIO1 LED.

We can save BASIC program in RAM to ROM easily with command PROG.

Save the program in ROM with command PROG.

We can use XFER command to transfer the saved program in ROM to RAM, so we can edit it.

Transfer program from ROM to RAM.

We can test the LCD interface with driver written in BASIC. The display will show text " BASIC52 CONTROLLER as shown in Fig 1.

LCD test program.

For faster running, BASIC52 can call assembly code using CALL command directly. The Manual explains how to use it.

The 9600 terminal can be used to load the BASIC program to the controller as well. However sending delay will be needed. The example below shows how to set transmit delay for character and line.

We can use PC's editor to edit the source code. Then download it to the board directly. Setting delay shown above was to let the interpreter to receive the BASIC program correctly.

The keypad sheet is available for modification. User may use the BASIC52 kit as a dedicated controller. The keypad sheet can then be modified easily. Click the image for vector file.

Download BASIC52, BASIC52 source, PLD file, BASIC52 Manual

BASIC program examples

Below source code can be loaded to the kit easily by setting the terminal delay, 50ms Character delay and 500ms for line delay.

GPIO1 LED running, pgm1.bas
LCD display, lcd.bas

9 September 2018, Update source code and hex file, turn display off on cold start

Kit information, please contact , PayPal and Bitcoin are welcome!


Last update, 9 September 2018

5 November 2016