Saturday, October 17, 2020

My first computer and Forth

When I needed to select my career it was difficult to choose between chemistry and electronics. I decided to go for (analytical) chemistry and kept electronics as a hobby. In my last years at school computers were just coming. The last years i went to school there where 4 terminals (with one printer) connected (i expect via a phone line) to a computer somewhere else and we had to write some computer programs in Basic as exercise.   

There I became fascinated by computers, did know a little bit of electronics, and after finishing school I started working in a pharmaceutical company. 

I wanted to know more about the link between the electronics and computers. In the Popular Electronics Magazine i found an article about the 1802 microprocessor. That was the first article about a microprocessor where I at least thought that I understood something a little bit. Magazines spread interesting articles over multiple editions, so a month later i also needed to buy the next edition as, i expect for a business model, most interesting articles were spread over multiple editions. After this I did read articles about other microprocessors, however at that time a lot of it was very complicated for me.
As the desire to have a real computer for my own grew I started investigating options. I already had a programmable calculator. Buying a ready computer was, at that time, not an option. The only little affordable options were some microprocessor kits and I decided to buy an ELF II with an 1802 processor.

For me important features were that it had a graphic chip so you could create some (black and white) graphic output to display on a TV and the architecture and instruction set of the 1802 was easier for me to understand than that of other processors. I ordered a kit and after soldering I got the ELF II with its 256 byte (¼ k) ram, the graphic processor, a hexadecimal display, a hex keyboard working and started leaning more.

Very soon I also needed the expansion board with a 256 byte containing a small monitor program. The most important in the 256 byte rom was a program to read and write memory to an audio cassette recorder using simple hardware interfaces on this board.

Some of the 256 byte memory was also used as memory for graphics on the TV. 256 byte (¼ K) is not much so I kept looking at the slowly decreasing price of additional memory.
At some point I decided not to for the 4K ram memory board and made a big jump by buying a 64K ram board with 48K ram. I expect it was around that time that my boss told me that it was a little crazy that I had a computer. However he understood it as i was only living during the weekends with my parents a little more than 200 km away from my work. From Monday till Friday I lived in a small room near my work and could enjoy my computer.

And with the huge amount of memory it became possible using programming languages on the ELF II 1802 processor. However often the programming languages used a terminal on the RS232 interface and that was, after already spending more than a month's salary on my computer, above my budget. However i did buy a kit for an ASCII keyboard over the parallel port. 

There was Chip8, Pilot and from a magazine i did type over a terminal program using the video chip using black and white characters. I could not use Basic as this language needed an external terminal on the RS232 port and there was no info or source code about its internal working.

And then there came Forth. I got a cassette tape and a print of the 1802 programming code for Forth also using the RS232 interface. However the standard Forth interface uses only 3 important routines. ?KEY and KEY to check and get input from the keyboard and EMIT to output one character. Making ?KEY and KEY work was not that difficult and in my first Forth experiments i used the hexadecimal display with a button to go to the next character after reading the HEX Ascii value and decoding it to the ASCII value.

My plan was interfacing Forth with the 1802 terminal program as that seemed possible as the source code of these two programs was available. This was my first real big IT project and I am still proud that I, on my own, could make this work.

The first,and easiest step was to move the terminal program (and video memory) to another part in memory. After that came the bigger challenge. The 1802 processor has 16, almost identical, registers of 16 byte. Each of these registers can be assigned as a program counter, stack pointer, a pointer somewhere in memory or to store a bite in the high or low part. These registers are also used in the Forth implementation for the 1802 processor.
However these 16 registers ( 0 to F) are almost identical, not completely!
R0 was (also) used for DMA, direct memory access for the graphical display chip.
After a hardware interrupt (also used for the video display) R1 became the program counter and R2 became (assembler) stack pointer. Also some of the registers were used in the terminal display program.
As these registers were also used in the 1802 Forth code i needed to change this in the Forth code. Nowadays this would be easy. At that time I did not have a working assembler. Only the hex keyboard, a hexadecimal display, a simple monitor program in the rom to inspect and change a hex address using the limited I/O. And after making changes I needed to store my work on an audio cassette tape to continue on another day.  Printing a version with changes was not possible as a printer was not available. So i used a paper notebook to keep track of changes to do and done.

The video display worked using the interrupt code and DMA (direct memory access). Every time to display memory data on the TV screen the video chip gave an interrupt.. It did set R0 to the beginning of the video memory and some other housekeeping. As Forth and the Terminal program used the registers. Also a small assembler program that saved and retrieved some of the 16 registers in memory when going from Forth to the Terminal display program and vice versa was added.

After many evenings of work the changes in the code where ready and the Forth ok prompt appeared on my black and white television and my adventure could continue on a higher level. 

Thursday, October 8, 2020

EPROM programmer -1-

I have several old UV erasable EPROMs that i want to use.
The UV EPROM ereaser orderd on AliExpress for using the EPROMS came sooner than expected. Now i also have received the PCB that i designed for the programmer and soldered some components on it.
For the programmer i wanted to use an Arduino and an external power supply for the programming voltage. The datalines will be directly connected to Arduino pins. For the address bus using a counter (or bigger an Arduino with more pins) would be the most easy solution. I want also to read data and select addresses without the need to count. In this first test circuit i want to use an Arduino Uno and a shift register to output the address.

As the PCB had some open space and there where also some unused lines from the Arduino and the shift register. I decided to add some useful (optional) bonus items on the PCB.

  • Pushbuttons (reset and an extra)
  • Leds
  • Buzzer
  • Voltage divider with two resistors to measure the programming voltage with an Arduino analog input port.
  • EEPROM (additional storage)
    Having an EEPROM on a UV EPROM board is perhaps a little confusing. It think it can be a valuable add on. Use cases can be; using the EPROM programmer as stand alone device to write the same program to several EPROMs, reading several EPROMS to the EEPROM for later investigation, comparing EPROMs, creating an EPROM emulator etc.

 


The first item i want to test on this PCB is the EEPROM. I hope soon on my blog will appear a post about this.
Testing of the UV EPROM i want to do after having more (programming) experience with the shift registers.
A project currently in progress is a special Arduino shield PCB to test and play with shift registers (and leds) This is a separate project i want to do before real EPROM programming. I ordered my EPROM programmer PCB at JLCPCB with the cheapest (slow) shipping service together with some other PCBs including the shift register test shield. With JLCBP (and some other PCB manufacturers) you currently get multiple PCBs for a very low price.

A project i want to do is a EEPROM test shield. I already designed this test shield however first i want to test my EEPROMs (using this EPROM shield) before ordering the EEPROM test shield.

There are also some other finished projects i want to publish on my blog. I hope you visit by blog again soon, and by that time there is also a post about my first EEPROM test results. 



Tuesday, October 6, 2020

Metal detector -2-

 After building the metal detector kit from the first blog post i received another DIY kit from Aliexpress for a metal detector. From this version i ordered (and received) two. Until now i only assembled one) . I did not (yet) find the circuit used in this version however as it contains other parts as than the first kit the circuit must be different.

The kit contains more transistors than needed so after building an testing i now have some extra transistors. An instruction manual or schematic was not included. Information which components to place where was on the PCB



I included a photo of the front and back of the PCB.

After assembling i powered the metal detector using 3 1.5 AA batteries (= 4.5V). This metal detector seems to work better than the one in my Metal detector -1- blog post. This second metal detector only has a buzzer. not an led. See picture below. It only gives a signal when metal is near the PCB. (It is possible to create a (false) signal by moving the batteries and battery wires near the detection coil. The pot meter can be used to adjust the sensitivity.

I have found a circuit for a metal detector using a 555 timer and i have some of these 555 times i stock.
Perhaps, some time, i also build a metal detector using the 555. However i  am also working on other projects and received some PCBs and other components for these project. And for now i have a nice working metal detector so i want to give priority for these other projects. 


Sunday, October 4, 2020

Metal detector -1-

Recently i did buy this cheap DIY metal detector kit at Aliexpress.

Here some pictures of the parts ant the assembly. Soldering the components was not very difficult. As i wanted to use the power screw terminals in another project i soldered two Dupont pins instead for the power. In fact is was a three pin male Dupont pin where i removed the middle pin. The two outer pins where at exact the right distance on the PCB.




Below the circuit diagram for this metal detector found on the internet 


I did build and tested the device powering it with 3 1.5 volt batteries (=4.5V) on the Dupont pins. My device continuous gives a signal that changes a when near metal. Changing the pot meter gives a change in the sensibility.This metal detector continuous gives a sound. Don't know if this is due to an error or intentionally. I did not do much troubleshooting to see if it was due to an error made during building and if i could improve it as i don't like it.

This is part -1- of my post about a metal detectors as i also ordered another cheap metal detector and i want to compare them.