Sunday, 3 July 2022

How the Mini PET works - Debouncing

This is one of a series of deep dives into how bits of the Mini PET work which I wrote up for my Patreon last year. I presented the original post as is, followed by a lot of new material at the end.


A few people had requested a power switch on the Mini PET, and it seemed like a useful thing to have, so on the early prototypes of the Mini PET 40/80, I added one. 

This was a fairly simple option, an SPDT slide switch. 

I wasn't very happy with that, it looked OK, but was a bit flimsy. The better option of a rocker switch like the VIC20 and Commodore 64 had been ruled out when I had looked at them before and found the right ones were about £5 each.

Around this time I was looking at different options for the Mini PET, and this one (which appears was codenamed 'Mini Clubman') I tried the option of adding the second datasette port to the rear. That give space on the side for other stuff, so I looked at adding a soft power button. It seemed logical at that point to move the reset and NMI buttons into this group, and a new 40/80 button fitted nicely.

There were two main things to sort out here, neither of which was right on the board above. The power regulators now needed to be able to be switched on or off - I'll look at those in a future post. This time it's the simple task of providing the on/off control signal.

The idea is to have a permanent supply whenever 9V is plugged in, that just sits there waiting for you to press the on button, and turns on power to the rest of the board. It then needs to sit and wait for you to press the button again to turn it back off.

I could have just used an 8 pin microcontroller, with a 78L05 regulator generating a 5V Standby power supply. It would be a case of reading the switch inputs in software and toggling an output pin. Easy, but it seems a bit like cheating.

There is also already a microcontroller on there, could I use that? Well, I ruled that out as I was already short on pins, and powering that from a separate 5V supply would have caused issues with parasitic power to the various chips attached to it (6522, 7132, HC86 etc.)

So, I went proper old school 4000 series CMOS logic. That is low power, and can run directly from the 9V supply without need for a separate standby voltage regulator.

The 4013 is a CMOS dual flip flop (pretty much the same functionality as a 74x74).

This was the initial schematic. The 4013_Init is an RC circuit to give a brief positive pulse on the 'set' pin to make sure it always goes into the right state at power on. (looks like I have the logic the wrong way around there - this was just a rough idea to see how it all fitted together).


By the time I reached the stage of getting some boards made, the logic had been swapped around a bit, and I have changed the circuit around the switch itself to a slightly better one which should debounce the switch contacts and give a clean clock pulse.

When the V1.76 boards arrived, I didn't like the look of the keyboard, I think I had spaced the keys out too far. The design had also changed a bit whilst these were being made (I had changed the video output shift register back to an HC166 from a brief stint using an HC165 - more on that in another post), so I never actually built up a complete V1.76 board.

(aside: I did use one of the V1.76 boards to make the base for the PET ROM/RAM test setup, but that deserves a post of its own)


At the time, the only bit I did populate was the area with the soft power on bits, to test that, and it didn't work very well. 

These traces aren't from the same circuit, but show the effect I was getting. From the zoomed out view, you can see I press the button many times, and each time it is pressed, D (which is actually mislabelled, it is the clock signal) goes high, but the Q signal toggles briefly and goes back to it's original state and the 5V rail never switches on.


Zooming in, the D (again, these should all say 'clock') pulse is high when the button is pressed, but the edges are not clean.

What was initially a clean looking pulse is actually several pulses, and the flip flop was flip flopping too many times due to spikes from the button signal and the power was going on and off, and almost always going back to off.


This is mid press on another capture, and you can see a bit more toggling, which is too fast for the poor USB analyser to capture (at the time I was capturing this on using a cheap ebay logic analyser as it is the only one I had with analogue and digital inputs - see later for better captures on my new Keysight scope).


Normally the RC circuit takes care of that sort of thing, but it wasn't doing a good enough job. After some testing, I ended up using an idea I had seen in some circuits online, which added an RC circuit in the D-Q loop on the flip flop.


That seemed to work OK at 9V, but when I tried 8V or 10V, it was either not responding, or responding multiple times again.

Not good enough, back to the drawing board, or more precisely the breadboard.


I gave up and accepted that I would need to add an extra chip. something with a schmitt trigger to clean up the signal. I used a 40106 hex inverter, also 4000 series but a slightly odd number.

I was hoping to capture some nice traces to illustrate this, but it seems the input circuit on that logic analyser is not particularly high impedence, and is dragging the signal down.


But it works. Basically, it switches on and off at different thresholds, so there is no jumping between one state and the other as the capacitors charges. That worked very reliably, first time, no tweaking of values required.


I've also added one of the spare gates (there are 6 in a 40106) to clean the set pulse, not really necessary, but why not be tidy.


A similar circuit is used for the 40/80 switch. Here the reset pin is held high when 5V is off, so it will always start in the off state. The diode only allows current to flow into the Q output, so will only conduct when Q is low and the resistor is pulled up to 5V. This performs a level conversion, and also stops parasitic power creeping into other parts of the circuit.


The NMI button is now also debounced, with a second gate used to invert the signal again, to give an active low pulse.

The only button that is not debounced is the reset button, as that is handled by the microcontroller, and even if there is a glitch like this towards the end, it will just reset it again before it has a chance to start.

So there is a lot involved in getting a simple on off pulse. Yes, an 8 pin microcontroller would have been easier, but it was nice to do a bit of old school 4000 CMOS.

What does this fantastic new on/off pulse drive? Find out in next week's thrilling instalment of 'How the Mini PET works'.

Update

That was the original post, on my Patreon last year. Rather than cutting it about, I have added this section onto the end showing some much better captures from the Keysight scope.

The yellow probe is connected directly to the switch, the green to the output of the RC circuit, which is the input to the schmitt trigger, and the blue shows the output of the schmitt trigger.


Here you can see the RC circuit slowly drops as the capacitor discharges, and starts to charge again once the switch is released. The schmitt trigger switches when the RC voltage crosses about 1/3 of VCC, and does not switch again until it is back over 2/3 of VCC. (the actual trigger voltages are closer, I am just generalising here)

On this capture, you might be able to see a bit of a blur on the falling edge of the switch pulse (in yellow).


Zooming in, you can see the initial contact bounce causes the input to go high again twice before staying low. If that were connected directly, it could be counted as two or three pulses. Here, the RC circuit has only just begun discharging, so the extra blips have not affect on the output.


The switches used on the Mini PET are already quite nice, so it did take a few goes to actually get some contact bounce. To better demonstrate better, I tried shorting the switch contacts with a bit of wire. That give a clearer indication of how much the pulse is cleared up.

Here you can see quite a pronounced blip in the input, and yet a nice clean pulse on the output.


Zooming in, you can see the green signal on the RC circuit starts to rise again, but not sufficiently to affect the schmitt trigger gate.


The rising edge had less of a blip, but still shows the nice clean response.


Mini PET 40/80D

The 40/80D does not have a soft power on, so has no need for the 9V CMOS circuitry. The NMI switch still needed debounching, so that uses a dual gate 74LVC14 chip to debounce that one signal.

Coda

I have used these circuits on several designs now, and they have always proven very reliable. However, I recently had a problem that left me scratching my head for quite a while.

I started writing up a Patreon post trying to describe the problem. In the process of which, I decided to get some more screen grabs from the scope to illustrate the issue. It was whilst getting those grabs that I discovered the problem. Neat. I like writing blog posts.


This is a simplified view of the circuit in question.


It switches a feature on or off based on a debounced switch input, the LED showing the state.

Here the two outputs are shown in yellow (/Q) and green (Q), and the switch input to the clock pin in blue. 


As expected, when there is a rising edge on the switch input, the output change state, just like a flip flop should.


However, when there is a second pulse to turn it off again, they briefly change state, and then go back again. This is repeatable. If turned off, it will always turn on. When on, it will never turn off.

I thought the LED might be causing a problem, so I first changed the value of the resistor down to 2K2, and finally cut it out all together, but that made no difference.

I even tried removing the onward connections of the Q and /Q signals, so there was nothing else connected to the outputs of the chip.


In those pictures, the blue probe is the third input on the scope, trigger, to show the input pulse, and that is digital, so it looks nice and clean. I know it should be clean as it is being debounced by the same circuitry that handles the power on / off switch, which is working very well.


As this is part of the power on/off circuitry, the inverter gate is powered from 9V. A simple level shifter is created with a diode and a 5V pullup resistor. When the output of the inverter is low, the diode conducts and pulls the Switch signal low. When it is high, the diode is reverse biased, so no current flows and the pullup holds the Switch signal at 5V. 

Just to be sure, I thought I would probe that with one of the analogue scope channels, so I connected the green probe to the same place as the blue one.


And there you go, it's not a perfect square, but it's being debounced, and .......

....hang on, that's working?


and back again. 

Oh no, not another one of those things that change when you probe them (reference to another post, which will probably be posted in a few weeks time)

This was indeed now working most of the time. I found that when I had both the external trigger input and the green probe on that signal, it worked.

I tried a few things and managed to capture the issue with just the green probe connected.


It looks like there is just enough of a spike at just the right time to make it appear as two clock pulses and turn it back off again.

How weird. I would not have expected that. 

Now, it seems it is being "fixed" due to the capacitance of the two scope probe together on the same pin. I could fix this by adding capacitance, but I'm never keen on doing that.

Instead of that, I reduced the pullup resistor to 4K7, to increase the rise time and give a sharper signal. 

That seems to have fixed it. 


I have overlaid the previous pulse in red

What of the other debounced switched you say? Why has this not been an issue elsewhere?

Well, power on/off is used directly in the 9V circuit, so no issue there, and that is working solidly and reliable. Reset is level shifted in the same way, but doesn't seem to be an issue (it may cause a second reset just after the first has started). The final debounced switch is Menu, and that makes use of the internal pullup in the micrcontroller, and has not been an issue so far.

All of the other interfaces to the 5V section were levels, this was the only time I had translated a pulse, which explains why I hadn't seen it before.


Advertisements

The Mini PET 40/80 kits are all sold out, but there are some Mini PET 40/80D boards still available from TFW8b NOW WITH £30 OFF (whilst stocks last) 

https://www.thefuturewas8bit.com/shop/tynemouth-products/minipet4080d.html

You might have also guessed that the circuit at the end is from a potential new product, another 8 bit computer kit. If you would like a new kit to be available from TFW8b, please let them know, so they can see if there is enough demand to justify quite a large investment in the parts required to make more kits.


Patreon

This post is an updated and extended version of a post from my Patreon. If you want advance previews of posts like this and behind the scenes progress on new projects, you can follow along and support me on Patreon. 

This now also includes access to my new Patreon only Discord server for even more regular updates.

https://www.patreon.com/tynemouthsoftware

Sunday, 26 June 2022

Custom ROM sets for the Mini PET and PET ROM RAM

This question has come up a few times recently, so I thought I would go into more detail.

The Mini PET and PET ROM/RAM both uses a single large EPROM to replace many individual ROM chips in the original Commodore PET. But more than that, they contain several different sets of these replacement ROMs, to give a choice of BASIC to match the machine they are going into.


PET Memory Map

To start with, lets have a look at how the various PET models split up the 64K memory map of the 6502.

Address range
2001 (8K)
3016
4032
8032
0000-0FFF
8K RAM
16K RAM
32K RAM
32K RAM
1000-1FFF
2000-2FFF
-
3000-3FFF
-
4000-4FFF
-
-
5000-5FFF
-
-
6000-6FFF
-
-
7000-7FFF
-
-
8000-8FFF
1K Video RAM
1K Video RAM
1K Video RAM
2K Video RAM
9000-9FFF
-
4K Option ROM
4K Option ROM
4K Option ROM
A000-AFFF
-
4K Option ROM
4K Option ROM
4K Option ROM
B000-BFFF
-
4K Option ROM
4K BASIC ROM
4K BASIC ROM
C000-CFFF
2 x 2K ROM
4K ROM
4K BASIC ROM
4K BASIC ROM
D000-DFFF
2 x 2K ROM
4K ROM
4K BASIC ROM
4K BASIC ROM
E000-EFFF
2K ROM
2K ROM
2K EDIT ROM
2K EDIT ROM
F000-FFFF
2 x 2K ROM
4K ROM
4K KERNAL ROM
4K KERNAL ROM


The bits that aren't ROMs

Character ROM

OK, so it is a ROM, but it does not contain executable code, is not accessible to the processor, and does not appear in the memory map. It is wired directly into the video circuitry. This means it cannot be replaced from the 6502 socket with a PET ROM/RAM, and is a separate ROM chip on the Mini PET.

Video RAM

Video RAM is also a special case. It does appear in the memory map, but is still separate from the main RAM, and cannot be replaced by a PET ROM/RAM

IO Cutout

The 2K region from E800 to EFFF was not allocated to ROM and was used for memory mapped IO. Later machines reduced the cutout to E800-E8FF, allowing the remaining space to be used for extensions to the edit ROM.


BASIC Versions

There were several versions of BASIC, each of which will run on most of the machines in the PET range. There can be a bit of inconsistency with the numbering. This is my take on it.

BASIC 1  *** COMMODORE BASIC ***

This is the original version from the 2001 which has a few bugs. I don't generally include this in any ROM sets.

BASIC 1r *** COMMODORE BASIC ***

This is a patched version of BASIC 1 which fixes some of the bugs (but notably not the one that stops IEEE-488 disk drives being used). This is the version of BASIC 1 I use.

BASIC 2 ### COMMODORE BASIC ###

This is the second major version of BASIC, available as an upgrade to the 2001, and used on the 2001N and 30xx series. Sometimes referred to in older books as "new ROMs". It is also sometimes called BASIC 3, since it was used on the 30xx series of machines, and was followed by BASIC 4, but I stick to calling this BASIC 2.

BASIC 4 *** COMMODORE BASIC 4.0 ***

No confusion with numbering this one, it says 4.0 on the screen. There are however many different versions of it. The original release had a few bugs that were fixed by replacing one of the five chips. I don't include the buggy version in any ROM sets, and just stick to the fixed version. Frustratingly, even after ruling out that buggy version, there are several different flavours of BASIC 4 for different hardware, which confuses things a bit.

There is a more pronounced split between the regions of ROM in BASIC 4. B000-DFFF is BASIC, E000-E7FF (and in some cases also E900-EFFF) is the screen editor and F000-FFFF is the kernal (that is how it is spelled in all the Commodore documentation of the day). The changes were all within the editor ROM, and that would often be the only one of the system ROMs that was socketed. I will not go into too much detail here, maybe one day I will do a detailed breakdown of how BASIC 4 fits together - I did a lot of reverse engineering when producing the Mini PET ROMs)

  • BASIC 4 for non CRTC machines
  • BASIC 4 for 4032 (normal keyboard, link linking etc.)
  • BASIC 4 for 8032 (business keyboard, windowing etc.)
  • BASIC 4 regional differences (DIN etc.)

Machines

Now we have seen all the versions of BASIC, let's look at the machines they ran on.

PET 2001

The 2001 had a total of 7 2K ROM chips, from C000 to FFFF, with a gap at E800-EFFF for the IO chips. BASIC 1 and BASIC 2 were available in 2K ROMs, either as 6540 ROMs on earlier machines or 2716 style on later boards. There was no space on the board for more than 8K of RAM or ROMs in the 9000-BFFF range. Options ROMs and even BASIC 4 could be added using expansion boards on the side edge connector, or plug in boards such as the PET ROM/RAM.

PET 2001N / 3008/3016/3032 etc.

The 2001N boards also had 7 ROM chips, but these were 4K each, and covered the complete range from 9000-FFFF (with the cut out at E800-EFFF). They initially came with BASIC 2, which left three sockets free for expansion ROMs from 9000-BFFF. They could be upgraded to BASIC 4 which used one of those for it's larger version of BASIC. These were the 9" 4008/4016/4032 machines. Not to be confused with the 12" monitor versions of the 4016/4032 I am just about to talk about.

PET 4016/4032 / CBM 8032/8096/8296

The various versions of the 40xx and 80xx boards had 7 ROM slots again. Often only the two options ROMs at 9000-9FFF and A000-AFFF and the editor ROM E000-EFFF (minus IO cutout) would be socketed. The others being tried and tested and unlikely to change. These machines had 6545 CRTC chips used to drive the display. This had to be initialised before it would display anything, so the correct editor ROM has to be used. It means that these machines cannot run earlier versions of BASIC as they do not initialise the CRTC at boot up.


ROM images

The PET ROM/RAM boards replace all of the ROM from 9000 to FFFF, leaving the full IO region E800-EFFF alone. This is almost 32K, so it makes sense to deal with this in 32K blocks.

Considering the simplest case of a single ROM set, the 32K ROM image is mapped into the upper 32K of the memory map, with the cutouts for video RAM and IO.

ROM Image Address range
PET Address range
Use
-
0000-0FFF
RAM
-
1000-1FFF
-
2000-2FFF
-
3000-3FFF
-
4000-4FFF
-
5000-5FFF
-
6000-6FFF
-
7000-7FFF
0000-0FFF
8000-8FFF
Video RAM
1000-1FFF
9000-9FFF
Option ROM
2000-2FFF
A000-AFFF
Option ROM
3000-3FFF
B000-BFFF
BASIC ROM
4000-4FFF
C000-CFFF
BASIC ROM
5000-5FFF
D000-DFFF
BASIC ROM
6000-6FFF
E000-EFFF
EDITOR ROM*
7000-7FFF
F000-FFFF
KERNAL ROM

* including IO cut out E800-E8FF or E800-EFFF

In this simple case, the 32K ROM image is built up so that it maps to the upper 32K of ROM. The regions in the ROM that would map to the video RAM and IO region are ignored, and I sometimes use those to note what is in the ROM image.


Next consider a two ROM set version. a 27C512 ROM will contain 64K, two 32K ROM images. The first set is as before 0000-7FFF, which is mapped into the PET memory map at 8000-FFFF (minus cut outs). The second set is in the EPROM from 8000-FFFF, and is mapped into the PET at 8000-FFFF.

And so on, a 27C010 can contain 4 images, 27C020 8 images, a 27C040 16 images and a 27C080 can contain 32 ROM images, which should be enough for anyone. 

In all cases, these are 32K blocks just stuck together.

ROM Address
Contents
00000-07FFF
ROM set 1
08000-0FFFF
ROM set 2
10000-17FFF
ROM set 3
etc.
etc.


Building ROM images

To build a ROM image, I suggest working on 32K chunks at a time, and then combining those later to create the final ROM image. This allows you to go back and make different "mix tape" ROM sets of all your favourite versions of BASIC. No? Just me then.

The individual ROM images can be found online, the best source being the wonderful zimmers site.

http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/index.html

Any space not used should be padded with 0xFF characters.

I'll only give a couple of examples here, as this post is already far too long and has no where near enough pictures in.

BASIC 2

ROM Image Address range
Contents
File
0000-0FFF
-
-
1000-1FFF
Option ROM
Various / Optional
2000-2FFF
Option ROM
Various / Optional
3000-3FFF
Option ROM
Various / Optional
4000-4FFF
BASIC 2 C000
901465-01
5000-5FFF
BASIC 2 D000
901465-02
6000-6FFF
BASIC 2 E000 (Normal)
901447-24
BASIC 2 E000 (Business)
901474-01
7000-7FFF
BASIC 2 F000
901465-03

There are a choice of the E000 ROMs for normal or business keyboards.

BASIC 4

ROM Image Address range
Contents
File
0000-0FFF
-
-
1000-1FFF
Option ROM
Various / Optional
2000-2FFF
Option ROM
Various / Optional
3000-3FFF
BASIC 4 B000
901465-23
4000-4FFF
BASIC 4 C000
901465-20
5000-5FFF
BASIC 4 D000
901465-21
6000-6FFF
Editor E000 (Non CRTC)
901447-29
Editor E000 (40 column normal 50Hz)
901498-01
Editor E000 (80 column business 60Hz)
901474-03
etc.
so many to choose from
7000-7FFF
KERNAL F000
901465-22

There are many editor ROMs to chose from, for different hardware, different refresh rates, different languages, different keyboards etc. There are also differences to the way the screen editor works, with the normal keyboard, 40 columns builds using line linking to allow mulitple screen lines per lines of code. The 80 column business keyboards were single line only, but supported windowing modes where areas of the screen could be fixed (c.f. the status line in Zork).

There are many versions of the editor ROMs on Zimmers, including a couple I patched for alternate keyboard types. Those are the ones with .ts.bin extensions (my attribution appears to have been lost in the mail).

Other images types

I think that is just about it. There are a few exceptions, you can put any code you want in there, you can run from 9000 through to FFFF with only the IO cutout. Put the usual NMI, IRQ and Reset vectors in the last six bytes and the rest is up to you. For example, see a previous post about running Cheese and Chive from ROM

http://blog.tynemouthsoftware.co.uk/2022/04/running-cheese-and-chive-from-rom-on-a-mini-pet.html



Advertisements

The Mini PET 40/80 kits are all sold out, but there are some Mini PET 40/80D boards still available from TFW8b NOW WITH £50 OFF (whilst stocks last) 

https://www.thefuturewas8bit.com/shop/tynemouth-products/minipet4080d.html


PET ROM RAM 

The PET ROM RAM is available from my Tindie store.

The smaller version on the left allows up to 8 ROM images to be select, and replaces either all or none of the ROMs and all or none of the RAM. Ideal for a fit and forget repair or upgrade.

The larger version has up to 16 ROM images and has finer control of which regions of ROM and RAM are replaced.

Patreon

You can support me via Patreon, and get access to advance previews of projects and behind the scenes updates. This now also includes access to my new Patreon only Discord server for even more regular updates.

https://www.patreon.com/tynemouthsoftware

Sunday, 19 June 2022

Powering Commodore Datasette Drives

After last weeks post covering the modification of a Commodore datasette drive to create cassette masters, literally no one asked for more details on how the datasette drive was powered. So I thought that was a perfect excuse to go into considerably more detail on the subject.


The datasette was first introduced to go with the Commodore PET in 1977, and remained in use right through into the early 1990s. The original PET was almost entirely 5V. All the logic, ROM and RAM was 5V only. These were the days before the 4116 DRAM chips which need -5V and +12V as well. 

The exception to the 5V only statement is the datasette drive. It has a 5V supply for the internal logic, but there is a separate power connection for the motor, which should be supplied with 6V.

The arrangement is different from most cassette mechanisms. Normally there would be a permanent 6V supply for the motor, and a mechanical switch on the drive itself to turn the motor on or off, sometimes in series with a relay controlled switch on the computer end. The Commodore datasette relies on the host to use the sense line to detect when a key is pressed on the mechanism to turn the motor on or off. 

You will see some situations where these are driven from 5V, for example the old parallel port X1531 type transfer cables. These run the motor slowly, 5/6 of normal speed. This makes the tape move more slowly, so the data is written closer together on the tape. When played back at normal speed, it will actually be 20% fast. This is just about within the tolerance of the loading routine, so can speed up loading a bit, but it's not guaranteed, and wouldn't be recommended these days.

PET 2001

The PET's power supply was 9V DC unregulated, with several 7805 5V regulators, so 9V was available, and that was used to generate 6V for the motor.

There is quite a lot going on there. If you ignore the resistors and 2N3904 on the left, what you have is a 7.2V zener diode fed via a 1.5KΩ resistor, which gives a regulated 7.2V reference. The 10nF capacitor smooths the reference voltage, which is then buffered by the two transistors in a darlington arrangement. The output is a regulated supply of 7.2V, minus the two base voltage drops, 0.6V each, giving a 6V supply. 

Bringing back the 2N3904, when the Control signal is low, the 2N3904 is off, and does nothing, and the output voltage remains at 6V. When the control signal is high, the transistor is turned on and pulls the 7.2V reference voltage down, and in turn, the output transistors are turned off and there is no output.

That gives a simple switched 6V output. Control is high, motor is off. Control is low, motor is on.

VIC20 / C64 / C128 / TED

Over the years, that circuit was revised a few times, and I found quite a bit of variation from model to model and machine to machine. Different drive transistors, different zeners etc. The voltage is always "around 6V", but it varies from a little over 5V to almost 7V on some of the machines I have tested.

The final version in the TED machines like the C16 and plus/4 was much simplified.

This used a 7406 gate to replace the 2N3904 transistor, but still doing the same job of pulling down the reference voltage when the drive is not in use. Gone is the second buffer transistor, so more current is drawn from the zener reference, which had it's resistor value dropped to 470Ω. That does mean that when the motor is off, the 470Ω resistor is across the supply rails and wasting 20mA all the time.

Mini PET

When I designed the original Mini PET, I used the design from the TED machines shown above.


The two datasette drive circuits were drawing 40mA in total, with the rest of the board drawing less than 100mA, but it was nice and simple and a product of the last generation of Commodore optimisation. 

Mini PET 40/80

When it came to the Mini PET 40/80, there was an additional challenge to deal with, soft power on/off. I could have stuck with the same circuit, but the 40mA draw would have been present when the rest of the unit was switched off, not ideal. I could have added a separate transistor, probably a MOSFET, to switch the 9V rail before this circuit, but I was trying to simplify things.

I had used some new surface mount 6V regulators with on/off controls in the multi port duplicators I had made for TFW8b. Each drive had it's own switched and regulated supply, which worked quite nicely. I was able to use the sense input directly to switch them on or off, so no additional logic was required, not even a pullup resistor.


I would have like to use those, but they were only available in surface mount, or the sort of 5 pin TO220 packages that might be a problem for some kit builders as the leads are a bit close together. 


After looking around for quite a while for alternatives, I finally settled on the Micrel MIC2951. (Micrel is now owned by Microchip, but I haven't seen any Microchip branded as yet.)

This little 8 pin chips work in two modes. In the first mode, they are fixed 5V, 150mA regulators, with a shutdown input so they can be turned on or off via the soft power on controls.


The Mini PET uses less than 100mA, so 150mA should be fine. I used a second 5V regulator to supply the datasette port, more than enough for a datasette drive logic and powering an SD2PET.

The second mode allows the voltage to be set via a resistor divider (like an LM317 if you remember those). The shutdown signal is the same logic as the datasette control, low is on, high is off. A 74LS07 gate is used to pull the signal low when the motor should be on, the rest of the time, the 10KΩ resistor pulls it high and keeps the output turned off.


The value is set using the following equation, Vref is an internal 1.235V reference, and R2 is using the recommended value of 100KΩ. The nearest standard resistor value to give the output voltage we need is 390KΩ.

That gives an output voltage of around 6.05V. The value depends on the resistors which have a 5% tolerance (absolute worst case 5.59V-6.56V). The exact value is not important, as long as the voltage is within range and is constant during playback. Speed was expect to vary over the life of the drive due to belt stretching, so is accounted for in software (by timing the header tone at the start). The output is current limited to 150mA, to avoid motor burnout when rewinding or fast forward is left pressed and the end of the tape is reached.

That left the power section of the Mini PET 40/80 as four identical MIC2951 chips, and a pile of passive components.

Mini PET 40/80D

When it came to the Mini PET 40/80D, I was able to go for one of the surface mount 6V regulators with enable pins, so no need for the resistors, these were pre-set for 6V. The 5V regulator next to them is a plain fixed voltage always on type, as there was no need for soft power on with the 40/80D.

The on/off pin was now the inverse logic, so I needed to use 74LS06 dates to drive those, but it at least there were no zeners or set resistors.



Advertisements

The Mini PET 40/80D is still available from TFW8b (whilst stocks last)

https://www.thefuturewas8bit.com/shop/tynemouth-products/minipet4080d.html



This post is an combination of several posts from my Patreon. If you want advance previews of posts like this and behind the scenes progress on new projects, you can follow along and support me on Patreon (which now includes access to my new Discord server)

https://www.patreon.com/tynemouthsoftware