To reward the latest e-newsletter of my MCS-48 programmer defend, I idea it’d be attention-grabbing to make one thing priceless in response to at least one in every of these. Done in 1976, the MCS-48 is 44 years ancient on the time of penning this text, giving us an different to endeavor again into the a long way-off previous of embedded pattern, peeling away the a colossal need of layers of hardware and map we generally drift atop of on the likes of Arduino and Raspberry Pi.
Not just like the nearly equally worn MCS-51 which refuses to die, exchange decided to recede MCS-48 in the previous. When taking a gape on the principle points, it looks seemingly that the efforts of the MCS-48 mission went into the MCS-51, on the opposite hand the two possess neither instruction feature, or pin compatibility. As such, MCS-48 doesn’t possess any contemporary descendants or tooling. With this form of diminutive instruction feature and no info stack, writing 3GL compilers for it could in point of fact maybe presumably were keen, and resulting code would were very wasteful of its diminutive resources.
The marketplace for assembly language handiest microcontrollers shrunk by the 1990s, by which point MCS-51 had taken its space, providing a full instruction feature agreeable of supporting higher level language compilers. I used to be advised by a buddy that despite a movement in direction of C pattern, some engineers persevered to pour over reams of MCS-48/51 assembly listings printed on green-bar properly into the 1990s.
For a microcontroller with handiest GPIOs a single timer, 1K of program house and 64 bytes of info reminiscence (32 looking on how you count it), it is generally pretty of a stretch to keep in mind one thing priceless to form with it. This twin temperature sensor doesn’t need the rest extra, and it’s one thing I will be succesful to also appropriate about maintain the idea of programming in its assembler language, as there would possibly be not any varied need.
Software program pattern
As I hinted to earlier, there would possibly be not any C compiler for MCS-48, making writing map for these devices keen. It is a long way acknowledged on Wikipedia that a PL/M compiler used to be readily obtainable for these on the opposite hand I used to be unable bag it or any varied point out. To add to the bother, there’s no hardware multiply, divide or subtract both. There isn’t even an instruction for evaluating two numbers. All of this has to be pieced alongside with former good judgment directions. As I labored my map by the implementation, I saved telling myself it could in point of fact maybe presumably bag more straightforward. It didn’t.
Even being geared up with a soft good judgment analyser, the exercise of latest PCs, editors and a truly simple to exercise programmer, writing the map for this used to be nonetheless very keen. It took me almost three weeks to forestall it, whereas an 8051 version (C/Keil implementation) of this linked mission I executed 7 years earlier used to be executed in under two days.
I cheated pretty by the exercise of a recent fanatic-constructed assembler – ASM48 for this mission.
Back in 1977, when these were first purchasable, there were no PCs or DOS to write down the map on. A cause constructed machine, the Intel MDS-II (microprocessor pattern platform) with an assembler also from Intel used to be extinct. Some scanned manuals I’ve came across display that the assembler outputs the following version string:
ISIS-II MCS-48/UPI-41 MACRO ASSEMBLER, V3.0
This could maybe well be a reproduction of it right here. The MDS-II ran a varied running system known as ISIS-II. It is a long way suspected (though not confirmed) that IBM developed the long-established PC BIOS on one in every of these machines too (they indubitably didn’t fabricate it on a PC), there could be a sharp thread about that right here, which info the challenges of making improvements to those early pattern instruments.
You maybe can also watch the MDS-II pictured in the portray under (blue, on the left).
There will seemingly be a simulator for the ISIS-II platform. A skill attention-grabbing re-talk over with for the prolonged speed.
Programming an MCS-48
Inside of EPROM MCS-48’s can’t be programmed in long-established EPROM programmers. They require a particularly designed programmer. Hardware is nonetheless obtainable for on the opposite hand not in particular low-payment. I went to the be troubled of building my hang programmer, in the make of an Arduino defend.
To boot to to the programmer, an EPROM eraser will seemingly be required. Mine is a classic fabricate from the 1980s on the opposite hand there are many cheapy Chinese objects in the marketplace on eBay on the present time.
Identical outdated debug tactics extinct on contemporary microcontrollers, as an instance printf() or in-circuit debugging are out of the question. An emulator would were of puny purposeful exercise as these devices nearly continuously wished to be debugged in-situ.
Assuming you weren’t building a product which is also physically broken by stopping the processor, the “austere” advance quick by the databook is to exercise a romless version with a single step circuit, blended with the SS (single step) pin to step by your code with an external good judgment analyser attached to an external EPROMs address/info signals.
With this you’re going to also watch what the program counter is as much as, but you have not any idea what any of the registers for the length of the CPU obtain. In case you must video display one in every of those, you must reproduction it into the accumulator, then write it out onto the bus, assuming that doing so didn’t trigger some roughly catastrophe, then capturing it with an excellent judgment analyser.
Successfully geared up engineers of the day can also were in possession of 1 among the above. The ICE-48 simulator used to be linked reasonably than a 40 pin MCS-48, allowing engineers to search the contents of inner registers, feature breakpoints and single step. Somewhat a luxury when put next with my experiences.
I came across that the highest map to debug an MCS-48 is to not debug it at all. As an different I time and yet again ran the directions by in my head time and yet again, and tried to bag it appropriate first time. Right here’s a lot less time drinking that any varied advance.
Somewhat shaggy dog account, at my expense
At the outset of this mission I purchased an MCS-48 databook off eBay (I appropriate desired to possess one). What I got used to be the long-established 1976 version, which, has errors in it. Damned eBay rubbish strikes yet again.
Above is the acknowledged MCS-48 pinout, which is wrong. The RD/WR pins are confirmed swapped. My first revision of the schematic integrated this mistake, on legend of I labored from this guide. This lead to a range of head scratching after I first attempted to debug it on my good judgment analyser.
Taming the Quasi-Bidirectional GPIO
On contemporary microcontrollers GPIOs are easy. Now we possess register which can enable a pair of P/Nch FETs for exercise as an output, generally being in a space to sink and source a gorgeous decent amount of present, generally sufficient to energy LEDs and puny relays as an instance.
On the MCS-48, we are lumbered with the quasi-bidirectional GPIO. The databook makes a lot of how extraordinary and revolutionary these are but from the perspective of getting extinct contemporary ‘appropriate’ GPIOs – they are a effort in the bottom.
The truth is these are both an enter and an output on the same time. The enter phase is exclusively a buffer which is continuously sampling the external pin, and the output phase is an N-ch FET which attracts the pin low, with an inner 50K pull-up providing the good judgment “excessive”. There will seemingly be a small P-ch FET with an impedance of 5K which is asserted for one clock cycle to give an even upward thrust time, but after that we’re striking fully off the 50K pull-up, which isn’t going to enable us to source sufficient present to form the rest priceless with out buffering.
Why not appropriate recede a 5K pull-up in circuit the whole time? Since the fabricate will seemingly be condemned to losing a well-known amount of energy continuously the safe outputs are held low. You can also set a stable pull-as much as enable sourcing of a better amount of present, but then you hit one other area in that the N-ch FET has an impedance of 300Ω so if the pull-up used to be 1K, you’re going to forestall up with a 1.15V “low” voltage. Not ideal.
The traits of these pins lend themselves very properly to driving FETs. The 5K pull-up “pulse” map the gate will payment fleet, and the 50K will abet it charged. The 300Ω low aspect also works properly. This train day getting elegant power present from the GPIO on an MCS-48 (and MCS-51) is exclusively a case of slapping a MOSFET of the desired polarity straight onto the pin (you’re going to also add a gate resistor to lower ringing, but not in point of fact wished).
Not one thing that can maybe well were completed again in the day (transistors and in moderation calculated corrupt resistors would were extinct) but is strictly what I’ve completed in my fabricate. As is acknowledged time and yet again in the databook, these pins are in a space to power the inputs of assorted TTL good judgment no complications, one thing also came across on my fabricate.
Not just like the TMS1000 which used to be masked-ROM handiest, the MCS-48 came in a cornucopia of assorted ROM alternatives and sizes.
I in point of fact possess generally seen it acknowledged that the 8048/8049 variants were “OTP” (one-time programmable). Right here’s (type-of) appropriate. They were in actuality camouflage ROM programmed.
The code for masked ROMs for these devices used to be supplied to Intel by prospects on punched-playing cards. The databook explains how these are to be formatted.
Camouflage ROM Versions:
- 8048: 1K(byte) ROM, 64 bytes RAM.
- 8049: 2K(byte) ROM, 128 bytes RAM.
- 8050: 4K(byte) ROM, 256 bytes RAM.
UV/OTP EPROM Versions:
- 8748: 1K(byte) EPROM, 64 bytes RAM.
- 8749: 2K(byte) EPROM, 128 bytes RAM.
- 8035: As much as 4K(byte) ROM, 64 bytes RAM.
- 8039: As much as 4K(byte) ROM, 128 bytes RAM.
- 8040: As much as 4K(byte) ROM, 256 bytes RAM (Very contemporary).
I constructed a puny PCB with an EPROM socket for running ROMless devices. A de-bounced reset circuit is integrated, to boot to a header with the latched lower address traces for the external bus. This used to be mainly constructed to relief me with the debugging on the map in the future of pattern (I did exercise an excellent judgment analyser for some of it). Gerbers for it are integrated on the stop of this page.
It would possibly well presumably’t be soft to possess gone to all this be troubled handiest to chase over this considerable variant of the MCS-48. The first Universal Peripheral Interface used to be the 8041 followed by the 8042 (alongside with 8741 and 8742 EPROM variations).
The UPI differs from a habitual range MCS-48 in that its bus interface is a slave, whereas the 8×48/8×49’s is a grasp. Its instruction feature will seemingly be pretty varied to a habitual MCS-48. They’re intended for setting up lustrous peripherals attached to the bus of 1 other roughly microprocessor.
The most famend software of the UPI used to be in the IBM AT, the exercise of an 8042 as its keyboard controller (it did some varied quirky stuff too), before every thing programmed with the IBM “1503033” ROM portray. In subsequent years its code used to be prolonged to bolster PS/2 mice. The 8042 used to be handiest retired from PC architecture rather recently. Standard PCs nonetheless emulate it to enable legacy running systems to make exercise of USB keyboards.
The UPI 8042 is the handiest member of the MCS-48 family to put in power code security (stopping code reads of programmed parts). Thanks to this, code for a 8042 essentially based entirely keyboard controllers is desirous to bag.
I idea it could in point of fact maybe presumably be attention-grabbing to form an experiment to study if I will be succesful to also make a UPI-41 form one thing varied than gape elegant in a share of anti-static foam. Because my temperature sensor doesn’t need the bus for its predominant mode of operation, this would maybe well speed on an 8741 or 8742 appropriate soft with predominant map portray. But that’s tedious.
So I went to the be troubled of writing one other puny program for it which accepts info from a ‘grasp’ temperature sensor.
Within the above demonstration the grasp board, fitted with an 8039 in this particular case, has four DS18B20 temperature sensors attached to it, and writes readings from sensors 3 and 4 the second board, which is exclusively a peripheral on the grasp board’s bus, with a few additional banks of shows on it.
K, so not in particular priceless but does expose the idea. The code for right here’s linked to on the stop of this page. The UPI idea is repeated on contemporary microcontrollers, as an instance, on PICs it is utilized because the PSP (Parallel Slave Port).
Below I in point of fact possess supplied every thing wished to make the boards I’ve confirmed on this text.