• Please review our updated Terms and Rules here

8051/8052 SBC

Really? The 256 bytes of ram? Please send the asm and hex files.
I think we're at cross-purposes. My reply to Gert was about his recently acquired Silicon Labs C8051F380 (or C8051F340) chip, which has over 4kB of built-in ram, as well as 64kB of built-in flash memory. It can run BASIC with no external components - doesn't even need a crystal - just a serial connection. It can also have external ram added, when you want to run BASIC programs that take up more than 4kB, but I've not got the external ram part working, yet.

MCS-BASIC 52 needs at least 1K of ram to run, so most of the '8051' chips (including the Atmel AT89C52 and Atmel AT89S52) need an external ram chip to allow them to run BASIC. They have enough flash memory to hold the BASIC 'ROM' but need the extra RAM.
Typically, you add a static ram chip, such as a 62256 and also an 8-bit latch like a 74LS573 to accomplish this.

A few of the contributors to this thread have several different '8051' family boards. I have a couple of the Atmel ones, as well as some STC types, and the Silicon Labs ones. The Atmel ones are great - but do need the external ram expansion to run BASIC.
 
If the microcontroller they are using is a Silicon Labs C8051F340, those have 4K bytes of on-chip XRAM, in addition to the standard 256 bytes of 8051 family architecture RAM. So it's not running with just the standard 256 bytes of RAM.
If you're talking about the video, they're using an AT89C52 like I am
 
I think we're at cross-purposes. My reply to Gert was about his recently acquired Silicon Labs C8051F380 (or C8051F340) chip, which has over 4kB of built-in ram, as well as 64kB of built-in flash memory. It can run BASIC with no external components - doesn't even need a crystal - just a serial connection. It can also have external ram added, when you want to run BASIC programs that take up more than 4kB, but I've not got the external ram part working, yet.

MCS-BASIC 52 needs at least 1K of ram to run, so most of the '8051' chips (including the Atmel AT89C52 and Atmel AT89S52) need an external ram chip to allow them to run BASIC. They have enough flash memory to hold the BASIC 'ROM' but need the extra RAM.
Typically, you add a static ram chip, such as a 62256 and also an 8-bit latch like a 74LS573 to accomplish this.

A few of the contributors to this thread have several different '8051' family boards. I have a couple of the Atmel ones, as well as some STC types, and the Silicon Labs ones. The Atmel ones are great - but do need the external ram expansion to run BASIC.
Ah.
 
Did you get the U-EC6, or similar, USB Programming/Debug adapter for the Silicon Labs chip? It's the easiest way to load a program to it.

I'm on Linux, mainly, and use the Silicon Labs 8051-efm8-utils utility named flash8051 to perform the upload. I wrote a little shell script to call the utility with the appropriate parameters, so I can just issue the command: "flash8051 myfile.hex" from anywhere to upload a hex file (I put the shell script, named flash8051, in my ~/.local/bin folder, which is on my default path
I ordered an U-EC6 programmer on Ali, but maybe the Xgecu T48 can handle it too. I will check.
 
Did you get the U-EC6, or similar, USB Programming/Debug adapter for the Silicon Labs chip? It's the easiest way to load a program to it.

I'm on Linux, mainly, and use the Silicon Labs 8051-efm8-utils utility named flash8051 to perform the upload. I wrote a little shell script to call the utility with the appropriate parameters, so I can just issue the command: "flash8051 myfile.hex" from anywhere to upload a hex file (I put the shell script, named flash8051, in my ~/.local/bin folder, which is on my default path

Code:
#!/bin/bash
usage ()
{
  echo "Usage: ./flash8051.sh filename"
  exit 0
}

if [ "$1" = "" ]; then
  usage
fi

filename=$1

if [ -z ${filename+x} ]; then
  usage
fi
/home/martin/.local/bin/siliconlabs-c8051-efm8-utils-main/c8051/flash8051 -sn EC600MCU123 -tif c2 -erasemode page -upload $filename

I can share my modified .asm and .hex files for MCS_BASIC V1.31, if you want them. These work fine using the chip's built-in ram, but I'm still having problems getting the external ram I built onto a 'shield' board working reliably.
Check here. https://github.com/Kreeblah/XGecu_Software/blob/master/SupportLists/T48_List.txt
 
Then welcome to the club!

The big advantage of the 8052 and derivatives: you can start small, just one IC can get you going! And then start expanding: extra RAM, EEPROM, SPI, I2C, etc. Regarding the AT89C52: I bought this Shotech board and it came with a STC89C58. It 1260 bytes of RAM instead of the 512 of an 8052 and 16 KB of FlashRAM instead of the original 8 KB of ROM. @gertk already showed us how to use extra ROM as an external disk. BASIC just fits inside the original 8 KB. Extra ROM means one can incorporate extra commands and other goodies inside the BASIC. Just an idea....
Ok, so here's what I'm gonna do. I'm going to buy a 5 pack of c52s, then I'm going to build that breadboard solution and buy a devkit board like yours, and whichever works I will use. The board you used or whatever it is, is a backup just incase I cant use the breadboard thing. I'm very happy to finally have the knowledge to homebrew something as I've always wanted to homebrew but feared I didn't have enough knowledge on the topic.
 
I got BASIC-52 running on the Silicon Labs C8051F340 chip. So far, just using internal RAM (4kB). Next I plan to add 64 kB of external RAM, and then modify the built-in EEPROM programming routines to use the chip's self-programmable flash memory (it has 64 kB of that). Looks promising.

Did you have to hook in some startup code to initialize some of the SFRs that are specific to the C8051F340?

For example, to clear the PCA0MD WDTE bit, which is set on reset?
 
Would this base setup I took from the video work?
This YT movie is real so I don't see why it would not.

Hey, I got a question. Would this board work? https://www.ebay.com/itm/273083929407
Again why not. But I bought this one. Cheaper and more possibilities and it works, see message #150! But a warning for both boards: they won't work with BASIC-52 due to the lack of RAM when using a standard 8052. But for starters, great.

I find it a bit complicated for a 13 year old to wire up roms and rams and ...
13 Years old? That would have been 1972 for me. Definitely no computers then, maybe those ping-pong screens. My first computer experience: 1978, PDP11 (I think), BASIC on a Diablo teletype writer. 1985: my first own computer, a C64. Then it went fast.
 
This YT movie is real so I don't see why it would not.


Again why not. But I bought this one. Cheaper and more possibilities and it works, see message #150! But a warning for both boards: they won't work with BASIC-52 due to the lack of RAM when using a standard 8052. But for starters, great.


13 Years old? That would have been 1972 for me. Definitely no computers then, maybe those ping-pong screens. My first computer experience: 1978, PDP11 (I think), BASIC on a Diablo teletype writer. 1985: my first own computer, a C64. Then it went fast.
I own a 64! As of right now I'm 13, I've liked this hobby since I was 6, I used to sit at our TV and watch 8-Bit guy, I always asked my father for a Macintosh haha! As of now I own 12 computers (4 are laptops) I always get 1-2 each year. Little fun fact about myself.
 
Last edited:
Did you have to hook in some startup code to initialize some of the SFRs that are specific to the C8051F340?

For example, to clear the PCA0MD WDTE bit, which is set on reset?
Yes - my startup code disables the watchdog, enables the crossbar to switch the emi (external memory interface), switches the processor up to 25 MHz clock, and configures the UART. It sets the pseudo-variable XTAL to 25MHz to match. The other main change you need to make throughout the code is to alter the register used to set the high byte of the xdata memory address: the accesses to xdata using the "movx a, @dptr" don't need modification, but in all the cases where the "movx a,@r0" (or r1) are used, the original code sets the high part of the address using P2, but the C8051F340 (and 380) must use the EMI0CN sfr instead of P2.

The C8051F3xx chips also make use of P1_6 and P1_7 to drive the /RD and /WR pins of the external memory interface - so the BASIC routines that use those pins for EPROM programming and such can't be used. It shouldn't matter because the chip has 64kB of self-programmable flash memory, so there's no need for external EPROMs anyway. My plan is to alter the BASIC CBY() expression to allow writing as well as reading, so that a BASIC program can write code and data to some unprotected regions of flash memory.

I've got BASIC working great using the chip's internal 4kB of RAM - there is a post of mine up-thread with a YouTube video showing it running the colour version of the Mandelbrot really fast. But for the external memory, the address and data lines, plus the /RD and /WR lines all seem to work okay (viewed on a scope) but BASIC still can't access that ram beyond 4K, yet. I'm still trying to find the bug in my code, or maybe my hardware.
 
Alrighty, I've ordered the board usb to ttl cable and 5 AT89C52s and 3 AT89S52s just incase.
 
Making some more progress with the SPI LCD, I got the init bugs out
:)

Added a different font (8x16 pixels) so it is better readable.

IMG20260111224010.jpg

Not sure if I want to keep the display in portrait or in landscape mode: only in portrait I can use hardware vertical scrolling.
 
Making some more progress with the SPI LCD, I got the init bugs out
:)

Added a different font (8x16 pixels) so it is better readable.

View attachment 1314468

Not sure if I want to keep the display in portrait or in landscape mode: only in portrait I can use hardware vertical scrolling.
Did you add some form of video output to your 8051 SBC? I can't wait until my board and chip come. I'm going to write some sort of an interpreter for it to boot into until I get more RAM. I really do hope this board will work.
 
Last edited:
Did you add some form of video output to your 8051 SBC? I can't wait until my board and chip come. I'm going to write some sort of an interpreter for it to boot into until I get more RAM. I really do hope this board will work.
The display is a 4 inch SPI lcd with 320x480 resolution and capable of 18/24 bit color. While it is possible to do 'bit-bang' SPI I found out is quite slow. So I made up a hardware SPI interface which speeds this up quite a bit. I als have added a large Eeprom for storage and extending the Basic commands. Feel free flip a few pages back here
:)
 
... Feel free flip a few pages back here
Would you mind to create a paper about your experiences? One of the reasons I'm creating this 8052 page is that all that information is spread out over various messages and pages. I want to concentrate all on one site/page to make it more accessible for everyone. FYI: all information on my site is freeware, including schematics and software.

FYI: at the moment I'm busy creating schematics and the board of this Aliexpress PCB.
 
As promised here are the schematics and the board of 8051 board I bought at Aliexpress (and what I call SBC-Aliexpress). The schematic is quite the same as the original, at least, I think. The used USB connector is not exactly the same as the original one: it misses the two points to solder the connector to the PCB. Anyway, if I would want to make PCBs from this design, I would use the slave USB connectors as found in printers and a lot of other USB devices. And those I have my library are with these soldering points.
The board is much less like the original. Main reason: my design hasn't ground planes (yet). I have a description somewhere how to do it but, let's face it, I'm lazy :) Most lines run like the original ones but because I already built my boards, I have no idea how the ones under the Textool socket are running. So if somebody has a kit laying around or will order one, do me a favour and and make a photo of both sides of the PCB please.
 
As promised here are the schematics and the board of 8051 board I bought at Aliexpress (and what I call SBC-Aliexpress). The schematic is quite the same as the original, at least, I think. The used USB connector is not exactly the same as the original one: it misses the two points to solder the connector to the PCB. Anyway, if I would want to make PCBs from this design, I would use the slave USB connectors as found in printers and a lot of other USB devices. And those I have my library are with these soldering points.
The board is much less like the original. Main reason: my design hasn't ground planes (yet). I have a description somewhere how to do it but, let's face it, I'm lazy :) Most lines run like the original ones but because I already built my boards, I have no idea how the ones under the Textool socket are running. So if somebody has a kit laying around or will order one, do me a favour and and make a photo of both sides of the PCB please.
I saw this in computer class in school lol. Although the link wasn't up, the hyperlink was there. I was researching some more Atmel c52 stuff before class started. Excited to homebrew something.
 
One day, I will homebrew a 8086 computer, when I get enough knowledge. using this tutorial for that whenevr i do that
 
Last edited:
Back
Top