MCS BASIC-52 Single Chip Computer
Single Chip Computer running BASIC-52 Ver. 1.31 along with I2C, SFR extensions. There is NO external ROM, RAM, latch, decoder, cyrstal are required. No programmer required. Direct USB port programming. DIP-40 size board.
INTRODUCTION:
I bought a Elektor magazine article "80C32/8052AH-BASIC single-board computer" kit and soldered the kit and it was working fine. The kit has on-board EPROM programmer and I was able to program a blank EPROM. At that time 32kB ROM and RAM space is more than enough memory for normal programming. The Single Board Computer requires 13V input and slow operating at 11.0592MHz.
VERSIONS OF BASIC-52
The BASIC-52 version i used was Intel's final version 1.1 There are many bugs and limitations. Once Intel published the source code into public domain, lots of people took interest and fixed the bugs and added features.
There was a BASIC-52 version 1.2 which can run on 80C31 chips with 128 bytes internal RAM and 2 timers modified by Dan Karmann. The changes were listed. But the source code was never released.
New instructions for MCS-51 BASIC by Implementing the I2C Bus was added by Hans-Jürgen Böhling
Published in Elektor 7/2000
The most famous version was modified by Hans-Jürgen Böhling and named as Ver.1.3 published in Elektor 2/2001
The BASIC-52 V1.3 and the I2C, SFR extension codes are non-overlapping. Means, we can assemble both the files separately and we can simply merge both hex files into a single HEX or BIN files before or during programming.
80C32/8052AH-BASIC single-board computer
There was a BASIC-52 version 1.2 which can run on 80C31 chips with 128 bytes internal RAM and 2 timers modified by Dan Karmann. The changes were listed. But the source code was never released.
New instructions for MCS-51 BASIC by Implementing the I2C Bus was added by Hans-Jürgen Böhling
Published in Elektor 7/2000
The most famous version was modified by Hans-Jürgen Böhling and named as Ver.1.3 published in Elektor 2/2001
The BASIC-52 V1.3 and the I2C, SFR extension codes are non-overlapping. Means, we can assemble both the files separately and we can simply merge both hex files into a single HEX or BIN files before or during programming.
80C32/8052AH-BASIC single-board computer
BOOKS and DOCUMENTATION:
I also bought a hard copy of "The Microcontroller Idea Book" - Circuits, Programs, & Applications
featuring the 8052-BASIC Microcontroller by Jan Axelson.
The original Intel MCS BASIC-52 manual available in PDF format from many online resources.
It was interesting to explore the hardware and software aspect of the BASIC-52. BASIC-52 is very simple yet powerful language.
For a long time I was thinking few things about the Single Board Computer. Can I increase the speed? Can I able to reduce the components used in the Single Board Computer? Can I reduce the board size? Can I reduce the overall cost?
After many years since the publication, many things changed.
- Most of the components available in SMD and costs less than through hole component
- Original 12T cores improved to 6T core then to 4T and now 1T is very common
- Most of the microcontrollers comes with plenty of code FLASH memory
- Most of the controllers comes with internal RAM and EEPROM for non-volatile
- Modern controllers does not require external crystal or oscillator due to internal oscillator.
- Modern controllers runs faster than the older ones in terms of maximum frequency.
- Modern controllers can be programmed directly through USB, USB-TTL or wirelessly.
- Inbuilt hardware for I2C, SPI, CAN, PWM, ADC, DAC, ETC.,
- Low Voltage and low power operation.
- smaller package and smaller footprint
Today there are many enhanced E8051 core-based microcontrollers available at very low price with more features. Most of the controllers have same kind of features. To make a choice, we have to go with availability, good documentation, easy way to program the flash without any external hardware tool.
Modern microcontrollers comes with large amount of flash memory, more than sufficient to store BASIC-52 and extensions. The controllers also comes with xRAM implemented inside the chip. This is equivalent to external RAM used by BASIC-52, but implemented inside the chip. The controllers are capable of operating at 24MHz internal oscillator and CH558 and CH559 capable of operating at 48MHz internal oscillator. This eliminates external crystal.
Bought some CH551, CH552, CH554 and CH558 chips and trying to run BASIC-52 on it. All the chips have sufficient memory for BASIC-52. CH551 having only 512 bytes of xRAM. Since BASIC-52 uses 512 bytes of external RAM for it's own purpose and stack pointers, we are left with no RAM for our own programs. But surprisingly CH551 operates in immediate command mode.
CH552 having 1kB xRAM and after BASIC-52's own usage, the user left with 510 bytes of RAM. But it is good enough to write small programs of 20 to 25 lines.
There is no difference between CH552 and CH554 from BASIC-52 aspect. Only the cost will be higher for CH554.
If we want to write big programs are if we need more space, then CH558 or CH559 are better choices.
CH558 comes with xRAM of 4kB and CH559 comes with xRAM of 6kB. Both Ch558 and CH559 operates at 48MHz. This gives a 2X speed advantage over CH552 which operates at 24MHz.
I did some comparison with Dallas High speed microcontrollers. DS89C420 is also 1T core 8051 family controller with 1kB internal xRAM. Both DS89S420 and CH552 performed exactly the same for a BASIC program.
With DS89S420 we can expand memory with external bus access and external RAM. With CH552, we can operate the controller without any external crystal or oscillator.
The source code changes required to run the BASIC-52 on CH55x chips are as follows:
We are making use of internal oscillator of the CH55x chips. So the necessary setting to enable the internal oscillator or necessary.
The default frequency in the code is 11.059200MHz. This can be changed to either 24MHz for CH552 and 48MHz for CH558 and CH559. This may be critical for timer dependant operations.
We have to point the xRAM start and end address so that BASIC-52 will make use of internal xRAM and BASIC-52 will understand the starting address and size of the RAM.
We can re-assign the Tx, Rx pins if there is a conflict or resource shortfall of the pins. We can also reassign the I2C or SPI pins as per our requirement.
Auto baud detection is disabled and fixed to 19200. But we can restore back to default code.
CODE ASSEMBLY:
I have used the microchip's C51ASM 1.2 for windows under Windows 10/11. It assembles both BASIC-52 and I2C, SFR routines without any error and issues and produces same HEX file and check sum.
FLASH PROGRAMMING:
There are many open source programmers available for both linux or windows OR the vendor provided tool WCHISPTOOL which is available from WCH website.
FLASH PROGRAMMING:
There are many open source programmers available for both linux or windows OR the vendor provided tool WCHISPTOOL which is available from WCH website.
We need to provide sufficient capacitor on V33, VCC/VDD pins. This will allow the IC to enter into bootloader mode easily. After programming we do not require any capacitors. Those V33 capacitor is useful for USB operation and unaffected by Tx, Rx or UART operation.
We can pre-program the chip before soldering the IC into the board using a external breadboard and TSSOP20 IC adapter.
LAYOUT:
Just a double sided 1.6mm thick board of size 50.80mm x 17.78mm.
Minimum trace width is 10 mil and the minimum drill size is 0.5mm
Out of all the family members of CH55x, only in CH552T TSSOP20 package, we will get the all the pins of PORT1. So only in CH552T P1.0 to P1.7 are available. CH552E, CH552G and CH552P are having less pins compared to CH552T. This is the reason CH552T based layout is done even though the internal xRAM is less compared to CH558 or CH559.
Instead of square pin header, it is useful to use the machined round pins for the pins 1 to 40. Most of the pins from 20 to 40 are dummy and blank. Still mapped and soldered for mechanical strength and reliable connection to the IC base or into the breadboard.
Firmware, Gerber & test code:
https://drive.google.com/drive/folders/1XmacvH9ZPNBv-2dNO6bP8IXeuVnr-mvR
https://github.com/mit41301/BASIC-52_CH552T_CH551G
https://github.com/mit41301/BASIC-52_CH552T

Commenti (0 commenti)