• Please review our updated Terms and Rules here

8051/8052 SBC

Due to the way my EEPROM is connected and mapped into the 8052 address space I need to shuffle the 8 kB blocks around after assembling the code. I use a small bash script with 'srec_cat' and 'dd' for that. The end result is a (binary) file which then gets programmed with the command line tools for the TL866.

The script is simply called 'doit.sh' :)

Currently I am fiddling with an SPI 320x240 (or 240x320) LCD on the 8052, it uses the ILI9341 controller and needed some extra pins for controlling the backlight and data/command line but since the 8052 timer input pins T0 and T1 (P3.4 and P3.5) were not used I decided to use these as outputs. Love those bidirectional port pins..
 
Last edited:
Thank you for the pointers!

Just FYI: I am a Windows user but certainly won't switch to W11. I'm busy, very slowly, switching to Linux. I started in 1983 programming using Pascal and it still is my main programming tool (FreePascal).
 
Some initial results with the ILI9341 SPI LCD, implemented some 'basic' functionality.
Text is in black&white only for speed, single pixels can be plotted in 16 bit color mode.
The extra Basic commands are CLS, LOCATE, PLOT, DISPLAY and by activating the user output function: PRINT@, LIST@ and such.

CLS takes about 3 seconds :p
(no scrolling, since the controller can only do vertical scroll in portrait mode)
2025-10-19 15.34.28.jpg2025-10-19 15.53.44.jpg2025-10-19 17.31.27.jpg2025-10-19 17.32.34.jpg2025-10-19 17.46.23.jpg2025-10-19 17.46.47.jpg
 
I have worked with several displays that used an ILI9341, but always Arduino style. It is cool that you are able to that much with a home-brew 8052 and BASIC.
 
Due to the way my EEPROM is connected and mapped into the 8052 address space I need to shuffle the 8 kB blocks around after assembling the code. I use a small bash script with 'srec_cat' and 'dd' for that. The end result is a (binary) file which then gets programmed with the command line tools for the TL866.
Isn't there any way to tell the assembler that you want the code to be assembled as if it were to end up at address X while it actually places it at address Y? If so you might not need your script. Maybe the risk of messing things up is higher though, but still.
(IIRC some assemblers tend to use * and ORG to do this).
 
Isn't there any way to tell the assembler that you want the code to be assembled as if it were to end up at address X while it actually places it at address Y? If so you might not need your script. Maybe the risk of messing things up is higher though, but still.
(IIRC some assemblers tend to use * and ORG to do this).
The assembler I use places the hex output in the exact spot where it needs to go, I have different ORG statements in the source already for code/data at 2000/4000/8000
Problem is that the EEPROM is not mapped in from 0000 (that is where the internal ROM lives). To make full use of the 32 kB EEPROM I have mapped it in at 2000/4000 and 8000/A000. That way I have 16 kB of prgram space for Basic extensions (2000-5FFF), font and other code stuff and also 16 kB of space for storing Basic programs (8000-BFFF).
Also since the 805x series have separate program and data space there is 32 kB of SRAM in data space from 0000-7FFF.

By shuffling some address pins around I managed to get the mapping this way without using GAL or CPLD just some 3-to-8 decoder and some gates. It just ended up that the four 8 kB blocks in the EEPROM are not adjacent anymore so the script handles that.

# mapping of the 8052AH EEPROM banks is as follows
# (due to the ROM enable and address line connection)
# offset in EEPROM maps to location
# 0000-1FFF => 4000-5FFF
# 2000-3FFF => 2000-3FFF
# 4000-5FFF => 8000-9FFF
# 6000-7FFF => A000-BFFF
 
Well, some assemblers can do that automatically. You tell it that the code is supposed to be run at in your case for example 2000, but to place it at memory location 0.

This was mostly used for assemblers that assembled code directly on the target system. Like you couldn't for example create the boot part of an OS while you already have an OS loaded at the fixed addresses the boot start vector, and for that sake interrupt vectors are located at.

I would think that this would be a feature of most other assemblers too, but perhaps not?
 
Thank you for the pointers!

Just FYI: I am a Windows user but certainly won't switch to W11. I'm busy, very slowly, switching to Linux. I started in 1983 programming using Pascal and it still is my main programming tool (FreePascal).
:)
I just read in the manual of the assembler I use ('asem-51' written by W.W. Heinz) that he also used FreePascal to develop the assembler. There are versions for DOS and Windows too. http://plit.de/asem-51/

This assembler is even used 'on' Mars!
 
I built this one from the VIntagechips site. It uses a variety of programmable MCS-51 clones, a 74HC573 to demux the address and data lines and 32k SRAM.

The most useful thing I learned is that MSC-51 BASIC uses the <space> character to automatically set the baud rate when you power it up.
 
I must admit I never looked at the source to figure that out, I just programmed the binary into the AT89C55 that I had lying around from another project. It did throw me for a while though because if you start with any other key it just echoes rubbish. It seems to work with anything between 300 and 115200.
 
My 89C52's arrived, one came up with pin faults & a device ID error, the other programmed ok, good job I ordered 2 :)
I'll be joining in the fun as soon as I find my perfboard stash...
 
I ordered two of those DIY kits and they arrived yesterday. First one built already,
Did not bother with all the LEDs on PORT1, just installed the ones for Rx/Tx/Power, I also did not mount the weird USB A plug (not socket!) The barrel jack will do fine.

The ZIF socket is not the greatest thing to solder in, be sure to keep it in the closed position or even better: insert an IC before soldering so the contacts open properly when the lever is released.
Mounted the two 20 pins male headers on the solder side so the whole board can be plugged into a carrier board with RAM and (EEP/FLASH)ROM
Note there are also tweo female headers supplied alas two different lenghts, why? I don't know.
Unfortunately the distance between the headers is not on a 2.54 mm raster so it spreads its legs a little.

Now thinking of how to build this out. Do I put in 64kB SRAM (I have a few of those skinny cache RAM's of that capacity) and a large bankswitched Flash or EEPROM
I do want to try and put in a large EEPROM or Flash ROM with the upper 16 or 32kB of program space being selectable and the lower 32 kB appearing fixed at 2000h-7FFFh
The /EA pin of the 8052 socket is connected to Vcc with a wide PCB track so it is not easily modified for having the embedded ROM disabled. Would have been nice if they put in a jumper selection.

Choices choices ...
 
Wait, are PCB mount USB A plugs a thing?
That's kind of cool as an USB A extension cord would be a more "generic" thing than the plethora of USB A <-> USB B/mini/micro/<proprietary Apple connector> wires that you tend to have in your box of things you'll likely never use but aren't able to part with.
The technically correct connector for something that needs to be somewhat sturdy would otherwise be the almost square USB B.
 
The USB plug can be used as power supply. I left my off in the first place because I thought it was an error. Just use a male-female cable to power it, with for example, your PC or laptop.
 
I'd intended hardwiring this on stripboard as I didnt realise there was a PCB available - I got the .BRD file from Nick's link above
and Mark1960 from the VRRRF forum kindly converted the .BRD to gerbers for JLC. I'll have a few spares if anyone in the UK wasnts one.
 

Attachments

I'd intended hardwiring this on stripboard as I didnt realise there was a PCB available - I got the .BRD file from Nick's link above
and Mark1960 from the VRRRF forum kindly converted the .BRD to gerbers for JLC. I'll have a few spares if anyone in the UK wasnts one.
I sent the BRD file to PCBway and they did the Gerber conversion for me at no charge. IIRC I just had to specify it was a 2-layer board. There's also a Z8 BASIC project on that site that uses the Z8681 (to run Z8671BASIC) in case anyone wants to compare with MCS-52.
 
While writing my assembler I ran into the so called "Symbolic addresses". For example, TCON = 88h and TMOD = 89h. But then I found an assembler that supported IT0 and IE0 as well, for the same addresses.

My question: what are the official ones and which ones are supported in general as well?

Thank you in advance!
 
While writing my assembler I ran into the so called "Symbolic addresses". For example, TCON = 88h and TMOD = 89h. But then I found an assembler that supported IT0 and IE0 as well, for the same addresses.

My question: what are the official ones and which ones are supported in general as well?

Thank you in advance!
There is a difference between bit and byte addressable registers and bits. They have overlapping values.
Here is a link which I think explains it as best as possible:


And then you have 128 bytes of internal RAM which are only indirect addressable because they have the same addresses as the SFR's :cool:
 
Back
Top