All posts by admin

Retro Computer Build Part 2 – Address & Memory Decoding

In this section we will look at the memory map, address decoding, memory devices and some other control signals that we need to get up and running for the computer.

The 6303 Micro has a 64K address range due to its 16 address lines. There are some key addresses that we need to know about and these are the interrupt  vectors. The table below shows these vectors –  these are memory locations that the Micro jumps to, when one of these interrupts are invoked. The purpose of these vectors is to tell the Micro what address it should look at to get the relevant instructions.

The most important of these is the Reset Vector, which is found at address locations FFFE and FFFF.

One simple method of managing the 64K memory map of the Micro is to break it up into smaller chunks. Back in the day, it was very common to break the memory map into 8 x 8K chunks and then to break these 8K chunks into small blocks.

As we plan to use a 32K RAM chip, we can use the address line A15 with a logic zero, to select this RAM chip. If we use a 74HC138 IC, which is a 3 to 8 line decoder, we can break up the upper 32K address space into 8 x 4K block. We can take the address line A15 with a logic high and the upper three address lines A14, A13 & A12 and use these to access each of these 8 x 4K  memory blocks.

As each of the ROMs are 8K in size, we will need to combine two 4K blocksin the address map to get an 8K address block for the ROM. There are 2 x 4K address blocks that we will use for expansion and video RAM.

The two most important items in this memory map are RAM1 and ROM1. ROM1 contains the code that will be executed when the Micro starts, while RAM1 is the location where program data can be stored.

It is worth saying that the addresses from 0x0000 to 0x00FF are used internally by the mMicro, some of which are internal RAM and internal registers. Addresses 0x0100 to 0x01FF will be used by external I/O, which we will define at a later time. The map below provides a simple overview of what can be used and what cannot be used.

0x0000 -> 0x001F – Internal registers of the Micro.
0x0020 -> 0x007F – External RAM, that can be used.
0x0080 -> 0x00FF – Internal RAM in the Micro.
0x0100 -> 0x01FF – External I/O for the Micro.
0x0200 -> 0x7FFF – External RAM.

A simple 40 Column by 25 Row display will use 1K just for text, with no formatting information such as colours, blinking text, etc. Once we start to add foreground and background colours as well as  other formatting, we find ourselves in the 4K region before we start.

Read & Write Enable

The Micro has a combined read & write line – the read control is active high and the write control is active low. When connected to some devices this is not a problem, but with other devices it can be very convenient to have separate read and write control lines.

This simple circuit provides the necessary signals from the combined  Read/Write line and the E clock signal.

Memory (ROM & RAM)

The memory side of this computer is very simple and we could just start with only 8K of RAM and 8K of ROM to get the system operating. Then later on we could think about adding more of both memory type, but this is not a good idea, as we might design ourselves into a corner with no way out. We have to think about this problem, so we can modify the design to allow the computer to be expandable.

When writing code for this computer, we will run into another problem – how to get the code into the ROM to begin with.  We can, of course use an EPROM programmer to program the base ROM. This is okay for the initial ROM, but if we want to make changes and test code, we won’t want to keep swapping out ROM’s all the time, with each change.

If the initial ROM (ROM1) is an EPROM and contains the basic code to get the system running and a system monitor (assembler), we can use this ROM to write programs in RAM, like a real computer. Then these programs can be tested in RAM and then copied to ROM2 or Ext ROM1, assuming these are EEPROM’s. This can help to speed up development on this computer.

As mentioned above, we can start with a basic 8K RAM – this will be perfect to get things up and running. We can add a second RAM and this will give another 8K RAM. Eventually we will run out of memory space to keep adding 8K RAM devices, so how can we add more RAM to the computer in the future, without having to re-design the computer?

One technique that was very common back in the day, was to page a RAM device. This was where the computer was able to access a certain amount of RAM at a specific moment in time. Then the computer would swap out that addressable range (page) on one device with the same addressable range (page) on a different device.

Think of it like a bookshelf – you start with just one book in your hands, as your eyes can only read one book at a time. When you’re finished reading or writing that book, you place it back on the shelf and take down the previous book or next book, to read or write. This is where the term “paging” came from – we are swapping one page of memory in and out. Only one page is active at a time.

To begin… if we had a 32K RAM, we could use address line A15 to select this RAM. But how could we page this RAM out? We would need to use some other control lines. If we had one pin of the Micro connected to control this RAM and another RAM, we could get a total of 64K RAM from one extra pin. If we had two control lines, then we could get up to 128K RAM in this computer. With a little bit of sideways thinking we could access more RAM memory, without giving up much of our memory map.

In the above circuit, you can see how you can use a 74HC139 and two control lines from the Micro and address line A15 to select one of four RAM IC’s.

The same logic can be applied to the ROMs.

Retro Computer Build Part 1 – CPU

So as part of the Retro Computer build, lets talk about the core of this computer, which will be a 6303. “What is this?” I hear you say. “I’ve never heard of this before?”  Well maybe you have, but just didn’t realise…So if you were asked had you heard about the 6800 from Motorola, I’m sure that many would say, “Oh, yes, I know it!”. Well back in 1977, Motorola took the 6800 microprocessor and added a few bells and whistles and called it the 680x microcontroller. This was used in thousands of systems back in the day and some variations are still in use now. Then Hitachi came out with their low power version called the HD630x.

https://en.wikipedia.org/wiki/Motorola_6800

Here is a link to wikipedia that gives more information on this chip.

I’m going to use the HD6303RP version of the micro for this computer. It will allow me to run 6800 code, while offering some basic I/O, which will help to get this computer operating.

The system will use about 8K/16K ROM depending on the configuration, and will have about 32K RAM for active memory. We may look at paging out memory at a later date.

To get the micro operational, there are a few things we have to do on the prototype board just to get things moving. It’s not that difficult if we take it one step at a time.

  • Clock
  • Reset Circuit
  • Operating Mode
  • External Interrupts
  • Power
Clock

The clock is used to provide timing to the micro – the faster the clock the faster the micro (to some extent). In this computer we are going to use a 4.9152MHz crystal to provide the basis of the clock for the micro. With the crystal, we have to use small bypass capacitors which help to stabilise the crystal while it’s operating.

Reset Circuit

The reset circuit is a very important part of the computer. When power is applied to the micro, it takes a little while for the clock to stabilise and get into a steady state. During this period we want to keep the micro in an inactive state. After a delay we then allow the micro to start working. To do this, we would normally have the reset pin on the micro held low (0, GND) then let it go high. This can be achieved with a simple RC (Resistor – Capacitor circuit).

Operating Mode

This micro has several modes that it can operate in. These normally are used in situations where the software is pre-programmed into the micro and it won’t be accessing any external memory. Other modes allow access to external memory, which is what we want to do for our configuration. To make the micro more flexible for future projects, we can add a small circuit to the system, to allow us to switch the operating mode for when the micro starts. We won’t be covering the different modes here, as we will be using Mode 2/4 for our application. This operating mode section, will allow us to choose, if we want to multiplex the lower address bus and the data bus. This is a good option, as it will free up port 1, which does contains other useful peripherals.

The small circuit below, shows both the reset circuit as well as a possible configuration to allow us to switch the operating mode of the micro.

External Interrupts

External interrupts are input pins, that when active, will cause the micro to stop working on what it is doing and jump to do something different. When it is finished doing this task, it will return back to what it was doing in the first place.

As we don’t want the computer to randomly jump to something else, we have to look after these external interrupts. Normally we just connect them to VCC via a pull up resistor.

Power

This is the simplest of all – just connect a clean 5V DC supply to the relevant pins on the micro. One nice feature of this micro is that it has a sleep mode, where the quiescent current is very low -nothing like today’s low power micro’s.

Schematic & Assembly

Here is the overall schematic for these first few sections of this computer. SW2,3 & 4 are used to set the startup mode for the computer, this mode is only set during the reset cycle. When operating, a quick check that was used to verify that this was operational, was to check the clock signal on pin 40 (E Output).

This image, shows the assembled circuit for this post. Part 1 is now operating and we are ready to move on to the next part.

Epson PX-8 Battery Rebuild

After checking and rebuilding the battery for the Epson HX-20 (see the link at the bottom of this post), I then decided to check the battery packs in the two Epson PX-8 computers that I have.

These were both in poor condition and needed to be replaced. This got me thinking of all the old retro computers out there that are slowly getting destroyed by leaky batteries. So if you have one of these computers buried in a wardrobe, garage or attic; please take it out and check its battery, as if you leave it too late, the battery acid just may corrode the main PCB to a state that makes it beyond repair.

Neither end of these batteries are in useable condition. I’m not going to open them, I am just going to bin them responsibly (local shops take in old batteries) and build new battery packs. If you don’t want to build them, you can purchase from several online suppliers.

After about an hour of repeating the same process that was used when making the new battery pack for the HX-20, I now have a new battery pack for the PX-8. Only one more battery pack to build, but I need to get a couple more of the 2/3 C Cell rechargeable batteries, to complete the last pack.

At least the connector was not as damaged as the connector on  the HX-20 battery pack. So now I have a good battery pack that can be used when I start the repair process on the PX-8 computer.

HX-20 Battery Pack Rebuild 

Solar Charge Controller – Monitoring

In an effort to help move the Solar Charge Controller project forward, I’m setting up a mini Solar System in the workshop. The purpose of the system is to charge two 12v 7AH lead acid batteries, that will power a 12v circuit in the workshop. Some basic monitoring devices, battery chargers and LED lights will be operating on this 12v circuit.

Using the Solar Charge Controller that was purchased a few weeks ago, it will charge two 12v 7AH lead acid batteries. These batteries will be connected in parallel to get maximum current.

Initially the Solar Charge Controller will be connected to a single 5W Solar panel, but will be replaced with 2 x 10Watt panels in the future. So why two panels? Well because the roof of the workshop is pitched, the plan is to have a panel on both sides, wired in parallel. Yes, I know that connecting them in parallel will reduce the overall voltage but it will maximise the current used to change the batteries.

5 Watt Solar Panel Change Calculations

Assuming that where only one 12v 7AH battery is connected with the 5 Watt panel, the best current that it can deliver is 0,3A, . Thus it will take 7Ah/0.3A = 23.3 hours to charge. This is the best case situation. When we have two batteries connected, it will take twice as long to change (almost two days). So in this configuration, we won’t be able to draw much from our battery pack. This 5W panel will be used for a later project, but at the moment it will be fine to get this little project up and running.

10 Watt Solar Panel Change Calculations

Assuming that we have only one 12v 7AH battery connected with the 10 Watt panel, the best current that it can deliver is 0,6A. Thus it will take 7Ah/0.6A = 11.6 hours to charge. This is the best case situation (with two 1- Watt panels this is now down to 5.8 hours). In reality this would never happen, as there wouldn’t ever be a situation where both panels had equal current flowing to deliver the necessary 1.2A. I’m hoping that when installed, there will be enough power delivered to keep the battery pack charged and able to run the monitoring system and a couple of 12V LED lights.

With the batteries connected in parallel and the solar panel also connected in parallel, I want to record the actual current flow into the batteries during the day, as well as recording the current flow out of them at night. Before I get the Retro Computer built, I’m thinking of using an Arduino to monitor the system.

Environmental Factors

I also want to record the temperature of the solar panel, as the efficiency of the panels is determined by temperature. As wind has a correlation to the temperature of the panel, it may be necessary to record wind speed as well. Although there may be sunlight, if the panels gets too hot, they are less efficient and having a cool wind blowing will help keep the panel temperature down. This brings me to the last item I want to measure, which is solar radiation (how much sunlight there is).

This simple setup should help provide the necessary information helping me to design my own Multi Purpose Charge Controller (I would like to take power from wind in the future, for days where there is little sun).

Hopefully getting this type of information will prove useful when deciding whether or not to move onto something larger. I’m hoping it will help me to choose which type of solar panels will work best for the workshop.

Input Signals

To begin with, I normally make a list of the input signals that I want to monitor. Then I make a list of the various outputs needed, as this may add more inputs signals that I need.

Current Sense Inputs
  • Current from Solar Panels to Charge Controller (Analogue).
  • Current from Charge Controller to Battery Pack (Analogue).
  • Current to the Load (Analogue).

For these current sense measurements, I could use an INA219 bi-directional current sense module – this way I could monitor the current IN and current OUT of the battery pack. As the IAN219 is a I2C device, I could have 3 of them on the same I2C bus, thus freeing up the 3 Analogue input pins on the Arduino. As we can set the address on each of these devices, it should be fairly easy to identify each device on the bus.

As the INA219’s also measure high side voltage, we now have the power measurement. It makes it a simple choice for this application. These are available as modules which can be plugged into a breadboard.

Temperature of Solar Panels

The temperature sensor could be a Dallas DS18B20 digital thermometer as I could wire a few of these on the same bus for different temperature measurements around the system.

Windspeed (Pulse input? Not sure at the moment).

Pulse input is simple to measure, as we just record the number of pulses within a time interval. Most wind speed sensors will provide a calibration value of the wind speed to the number of pulses per minute.

Rainfall (Digital Pulse Input)
Tipping Bucket Rain Gauge (Click on image)

Rainfall is fairly simple, as most rainfall gauges will tell you how many ml of rain fell per pulse output. Some of the cheap eBay ones have a value of 1 to 0.4ml per pulse. This makes it fairly simple to multiply up the number of pulses per interval to work out the amount of rain that fell.

Output Signals

We have looked at the sensor inputs, now lets looks at various outputs. We could have an LCD screen that shows the various results and information. If it had a backlight that we could switch on /off, it would be easier to read. Then when the backlight is not in use, we would be saving power, letting the system run for longer on the batteries.

If we had an LCD screen it would be nice to have a few buttons to navigate a menu to view results. This of course would add more inputs to the requirements list. If we had four buttons, Up, Down, Select & Exit, this should be enough to navigate through the various menus.

We may have an indicator or two to let us know how things are getting on, without having to look at the display.

 

Replacement Battery Pack for Epson HX-20

After disassembling the HX-20 the other day, and discovering that the Ni-Cad battery pack is leaking after 35 years,  I purchased some 2/3 C size cell rechargeable batteries. I purchased a total of 10 of these cells, as I plan to make a new battery pack for the HX-20 and one for a Epson PX-8’s that I also have. I suspect that if the batteries in the HX-20 are in this state then the ones in the PX-8 are not far behind.

Blog Post showing the teardown of HX-20.

Here is a link to these batteries on Amazon for those of you who want to replace their batteries in the computer.

After verifying that they were the correct size, I started to break apart the old battery pack to see how far gone  the batteries were. If you’re doing this at home, lay out some newspaper and wear gloves, as battery acid is nasty stuff.

Once I removed the yellow plastic shrink wrap from the battery pack, it was very clear that the protective foam on the negative side of the battery pack terminal was saturated (battery acid) and the terminal was corroded.

When the protective foam was released the lead to the negative side of the battery pack just fell off. It obviously hadn’t had a solid connection to the negative battery terminal for a long while.

Just to see how far the corrosion had gone, I cut into the wires going to the connector for the main PCB. I was unable to find any good clean tinned or copper wire – it was tarnished all the way to the connector. This means that I need make up a new connection going to the main PCB (I may just replace the headder  to the main PCB with PCB molex headder and replace the connection on the battery pack).

Curiosity got the better of me and I removed the last of the red shrink wrap on the old battery pack, just to see how bad the batteries were. The walls of two of the batteries were paper thin and were corroded in places completely. In fact I found two holes in the battery shells which are visible above. Can you spot them?  These batteries had seen better days and I was very happy that there were getting replaced.

It was very easy to wire up the new batteries. I just had to tack solder the positive lead of one cell to the negative lead of the other cell in series. Next step is to organise some spacers for in-between the cell, so the casings don’t short together, then to wrap the cells and install back in the computer.

– [Batt1] +  – [Batt 2] + – [Batt 3] + – [Batt4] +

We just have 4 x 1.2V Cells in series giving 4.8V. Once I get the new connectors for the battery pack and the main PCB. I’ll re-fiit the battery pack back in the HX-20, charge it up  and start testing.

** REMOVE BATTERIES FROM COMPUTERS GOING INTO STORAGE **