From 561bac75579391c14e47eaccfabdf9eda98855da Mon Sep 17 00:00:00 2001 From: Thomas Albers Date: Wed, 27 Jul 2022 18:13:20 +0200 Subject: Initial commit --- src/abgabe.org | 101 ++++++++++++++++++++++++++++++++++++++++ src/index.org | 27 +++++++++++ src/privacy.org | 96 ++++++++++++++++++++++++++++++++++++++ src/programs/index.org | 20 ++++++++ src/style.css | 123 +++++++++++++++++++++++++++++++++++++++++++++++++ src/z80/index.org | 22 +++++++++ src/z80/plm.org | 66 ++++++++++++++++++++++++++ src/z80/prototype1.org | 78 +++++++++++++++++++++++++++++++ src/z80/prototype2.org | 51 ++++++++++++++++++++ src/z80/spi.org | 30 ++++++++++++ 10 files changed, 614 insertions(+) create mode 100644 src/abgabe.org create mode 100644 src/index.org create mode 100644 src/privacy.org create mode 100644 src/programs/index.org create mode 100644 src/style.css create mode 100644 src/z80/index.org create mode 100644 src/z80/plm.org create mode 100644 src/z80/prototype1.org create mode 100644 src/z80/prototype2.org create mode 100644 src/z80/spi.org (limited to 'src') diff --git a/src/abgabe.org b/src/abgabe.org new file mode 100644 index 0000000..772d04d --- /dev/null +++ b/src/abgabe.org @@ -0,0 +1,101 @@ +#+TITLE: Übungsblatt 5 - Aufgabe 3 +#+HTML_HEAD_EXTRA: +#+SETUPFILE: ../options.org + +[[https://thomaslabs.org/shortcoil.m][Quellcode herunterladen]] + +* Ergebnisse des Programms +[[https://thomaslabs.org/media/betrag.png]] + +[[https://thomaslabs.org/media/richtung.png]] + +[[https://thomaslabs.org/media/spulenachse.png]] +* Octave / Matlab Quellcode +#+BEGIN_SRC octave + clear all; + close all; + clc; + + %% length of the observed region in m + len = 40e-3; %m + len = len / 2; %we shall go from -len to +len + %% number of points in x- and z-direction + N_space = 50; + %% number of points for integration along coil + N_phi = 250; + %% radius + R = 5e-3; %m + %% length + L = 23e-3; %m + %% number of windings + N = 5; + %% current + I = 8; %A + %% vacuumpermeability + mu0 = 4 * pi * 1e-7; %Vs/Am + + %% define grid + z = linspace(-len, len, N_space); %m + x = linspace(-len, len, N_space); %m + + %% parameter of coil-wire-path-paramtrisation + phi = linspace(0, N * 2 * pi, N_phi); + dphi = phi(2) - phi(1); + + %% Precalculate cos and sin + p_sin = sin(phi); + p_cos = cos(phi); + + %% loop through all x-z-points + for iz = 1 : N_space + for ix = 1 : N_space + %% r of this x-z-point + r = [x(ix); 0; z(iz)]; + B = [0; 0; 0]; + + %% Riemann sum along the coil + for ip = 1 : N_phi + %% Point along the coil + l = [R * p_cos(ip); R * p_sin(ip); ip * L / N_phi - L / 2]; + %% Vector tangent to the coil of length dl = R * dphi + dl = [- R * p_sin(ip); R * p_cos(ip); L / 2 / N / pi]; + dl = (R * dphi / norm(dl)) * dl; + %% Vector from the coil to the x-z-point + rp = r - l; + %% Add dB + B = B + (mu0 / 4 / pi) * I * (1 / norm(rp) ^ 3) * cross(dl, rp); + end + + B_X(iz, ix) = B(1); + B_Y(iz, ix) = B(2); + B_Z(iz, ix) = B(3); + end + end + + figure('Name', 'Richtung der Flußdichte', 'NumberTitle', 'off'); + quiver(x * 1e3, z * 1e3, B_X ./ sqrt(B_X .^ 2 + B_Z .^ 2), + B_Z ./ sqrt(B_X .^ 2 + B_Z .^ 2)); + title('Richtung der Flußdichte') + xlabel('x [mm]') + ylabel('z [mm]') + axis image + saveas(gca, 'richtung.png') + + betrag = sqrt(B_X .^ 2 + B_Y .^ 2 + B_Z .^ 2) + figure('Name', 'Betrag der Flußdichte', 'NumberTitle', 'off'); + imagesc(x * 1e3, z * 1e3, betrag); + title('Betrag der Flußdichte'); + xlabel('x [mm]') + ylabel('z [mm]') + colormap(gray); + colorbar('title', 'B [T]'); + saveas(gca, 'betrag.png') + + figure('Name', 'Flußdichte entlang Spulenachse', 'NumberTitle', 'off'); + B_2 = B_Z(:, round((N_space - 1) / 2)); + plot(x * 1e3, B_2); + title('Flußdichte entlang Spulenachse'); + xlabel('z [mm]'); + ylabel('Flußdichte [T]'); + saveas(gca, 'spulenachse.png') +#+END_SRC diff --git a/src/index.org b/src/index.org new file mode 100644 index 0000000..77dfc1f --- /dev/null +++ b/src/index.org @@ -0,0 +1,27 @@ +#+DATE: <2021-02-26> +#+SETUPFILE: ../options.org +{{{date_place(Bremen, Germany)}}} + +/Welcome!/ I am Thomas and this is my personal website. + + +/Note: This site is still under development!/ + +The idea behind this site is to share with the world the stuff +I do in my free time. Here you can find articles about +hobbyist electronics, programming and maybe in the future even +math and physics. + +You can contact me through my email +@@html:@@thomas at thomaslabs dot org@@html:@@. +Here is my [[local:/pub.key][OpenPGP key]]. + +** Donations +If you wish to support the things I do, a donation is always welcome. + +- Monero ([[/xmr.png][XMR QR)]]: + @@html:@@ + 4A8brnoX1B9NNopzoYMvAQW1ggA6sWBckN3McRTsU3mtFFkTV71XpWJHn4JHAytdo6CEqrcmhGqx556G7Fb7HNBRUaujwwB + @@html:@@ + +- [[https://paypal.me/thomasalbersraviola][PayPal]] diff --git a/src/privacy.org b/src/privacy.org new file mode 100644 index 0000000..9e48a38 --- /dev/null +++ b/src/privacy.org @@ -0,0 +1,96 @@ +#+TITLE: Privacy Policy +#+HTML_HEAD_EXTRA: +#+SETUPFILE: ../options.org + +Personal data (usually referred to just as "data" below) +will only be processed by us to the extent necessary and +for the purpose of providing a functional and +user-friendly website, including its contents, and the +services offered there. + +Per Art. 4 No. 1 of Regulation (EU) 2016/679, i.e. the +General Data Protection Regulation (hereinafter referred +to as the "GDPR"), "processing" refers to any operation or set of +operations such as collection, recording, organization, structuring, +storage, adaptation, alteration, retrieval, consultation, use, +disclosure by transmission, dissemination, or otherwise making +available, alignment, or combination, restriction, erasure, or +destruction performed on personal data, whether by automated means or +not. + +The following privacy policy is intended to inform you in particular +about the type, scope, purpose, duration, and legal basis for the +processing of such data either under our own control or in conjunction +with others. We also inform you below about the third-party components +we use to optimize our website and improve the user experience which +may result in said third parties also processing data they collect and +control. + +Our privacy policy is structured as follows: + +1) Information about us as controllers of your data +2) The rights of users and data subjects +3) Information about the data processing + +* I. Information about us as controllers of your data +The party responsible for this website (the "controller") for +purposes of data protection law is: + +Thomas Albers Raviola@@html:
@@ +Email: tgalbers2000 /at/ google /dot/ com + +* II. The rights of users and data subjects +With regard to the data processing to be described in more detail +below, users and data subjects have the right + +#+ATTR_HTML: :type disc +- to confirmation of whether data concerning them is being processed, + information about the data being processed, further information + about the nature of the data processing, and copies of the data (cf. + also Art. 15 GDPR); + +- to correct or complete incorrect or incomplete data (cf. also Art. + 16 GDPR); + +- to the immediate deletion of data concerning them (cf. also Art. 17 + DSGVO), or, alternatively, if further processing is necessary as + stipulated in Art. 17 Para. 3 GDPR, to restrict said processing per + Art. 18 GDPR; + +- to receive copies of the data concerning them and/or provided by + them and to have the same transmitted to other providers/controllers + (cf. also Art. 20 GDPR); + +- to file complaints with the supervisory authority if they believe + that data concerning them is being processed by the controller in + breach of data protection provisions (see also Art. 77 GDPR). + +In addition, the controller is obliged to inform all recipients to +whom it discloses data of any such corrections, deletions, or +restrictions placed on processing the same per Art. 16, 17 Para. 1, 18 +GDPR. However, this obligation does not apply if such notification is +impossible or involves a disproportionate effort. Nevertheless, users +have a right to information about these recipients. + +#+BEGIN_EXPORT html + +Likewise, under Art. 21 GDPR, users and data subjects have the right +to object to the controller's future processing of their data pursuant +to Art. 6 Para. 1 lit. f) GDPR. In particular, an objection to data +processing for the purpose of direct advertising is permissible. + +#+END_EXPORT + +* III. Information about the data processing + +We do not store any data. + +#+BEGIN_EXPORT html + +Model Data Protection Statement for +Anwaltskanzlei Weiß & Partner +#+END_EXPORT diff --git a/src/programs/index.org b/src/programs/index.org new file mode 100644 index 0000000..f5ac0b1 --- /dev/null +++ b/src/programs/index.org @@ -0,0 +1,20 @@ +#+TITLE: Programs +#+DATE: <2021-02-26> +#+SETUPFILE: ../../options.org + +{{{date_place(Bremen, Germany)}}} + +The purpose of this section is to serve as place to share the +collections of programs I have written. + +All programs here published are under the conditions of the [[https://www.gnu.org/licenses/gpl-3.0.en.html"][GPLv3 +Licence]] unless explicitly noted and are therefore [[https://www.fsf.org/about/what-is-free-software][Free Software]]. + +Many of these programs were created to solve particular +problems that maybe only I had. As such I may not include +changes to them, unless I really felt that such changes could +improve their performance and use range. That being said, feel +free to adapt them to your own use case. + +- [[https://gitlab.com/thonos/autotag][autotag]] a program designed to fill metadata into songs from within + the terminal (uses dmenu). diff --git a/src/style.css b/src/style.css new file mode 100644 index 0000000..bd731ad --- /dev/null +++ b/src/style.css @@ -0,0 +1,123 @@ +html { + height: 100%; + color: #cccccc; + background-color: hsl(240, 30%, 10%);/*#452b41*/ /*#2c314b*/ +} + +body { + margin: auto; + max-width: 64em; + min-height: 100%; + display: flex; + flex-direction: column; + background-color: hsl(240, 30%, 15%); +} + +nav { + /*#3a2438*/ /*#2a3257*/ + background-color: hsl(240, 30%, 20%); +} + +nav > ul { + display: flex; + margin: 0 auto; +} + +nav > ul > li:last-child { + margin-left: auto; +} + +nav ul { + padding: 0; +} + +nav li { + margin: 2px; + display: block; + list-style: none; +} + +nav li:hover { + background-color: hsl(240, 30%, 30%); +} + +nav .submenu:hover .submenu-contents { + display: block; +} + +nav .submenu-contents { + display: none; + position: absolute; + z-index: 10; + background-color: red; +} + +nav a, +nav span { + text-decoration: none; + color: #dddddd; + display: block; + line-height: 2em; + height: 2em; + margin-left: 1em; + margin-right: 1em; +} + +nav span { + cursor: pointer; +} + +.article-date { + margin-left: auto; +} + +.link-like, a { + color: #eeeeee; + text-decoration: underline; +} + +.rel-header { + padding: 1em 2em 1em 2em; +} + +header { + background-color: hsl(240, 30%, 10%); +} + +header p { + text-align: center; + margin-bottom: 0.15em; +} + +header p ~ h1 { + margin-top: 0.15em; +} + +main { + padding: 2em 2em 2em 2em; + flex-grow: 1; +} + +hr { + margin: 0; + margin-top: auto; +} + +footer { + padding: 1em 2em 1em 2em; +} + +figure { + text-align: center; +} + +figure img { + max-width: 30em; + object-fit: contain; + display: block; + margin: auto; +} + +h1, h2, h3, h4, h5, h6 { + text-align: center; +} diff --git a/src/z80/index.org b/src/z80/index.org new file mode 100644 index 0000000..ab827eb --- /dev/null +++ b/src/z80/index.org @@ -0,0 +1,22 @@ +#+TITLE: Z80 +#+DATE: <2021-03-03> +#+SETUPFILE: ../../options.org + +{{{date_place(Bremen, Germany)}}} + +This section is dedicated sharing all the Z80 related work. This +includes software, schematics and tools that I've designed to +accomplish this task. It also includes a kind of narration of the +project itself, throughout its development and changes. + +** Articles about the history of the project +- [[local:/z80/plm.html][PLM: Pocket Lisp Computer]] +- [[local:/z80/prototype1.html][Prototype 1]] +- [[local:/z80/prototype2.html][Prototype 2]] + +** More technical articles +- [[local:/z80/spi.html][SPI for microprocessors]] + +** External Links +- [[http://www.z80.info/index.htm][z80.info]] useful z80 resources +- [[https://www.zilog.com/index.php][Zilog website]] diff --git a/src/z80/plm.org b/src/z80/plm.org new file mode 100644 index 0000000..b0eef1d --- /dev/null +++ b/src/z80/plm.org @@ -0,0 +1,66 @@ +#+TITLE: PLM +#+SUBTITLE: The Pocket Lisp Machine (except its not) +#+DATE: <2021-03-03> +#+SETUPFILE: ../../options.org + +#+BEGIN_COMMENT +m4_define(`_REL_HEADER', `Next: Prototype 1Up: Z80')m4_dnl +#+END_COMMENT + +{{{date_place(Bremen, Germany)}}} + +* Background + +If you have read my article about my first [[local:/z80/prototype1.html][Z80 prototype]], then you +probably already know, what all of this is about. But, as a small +recap, the idea of my project is to build a pocket computer that can +be carried around like the pip-boy from the [[https://en.wikipedia.org/wiki/Fallout_(series)][Fallout]] series. + +The exact objectives have changed with the development of the computer +itself. I soon realized, that the way a user would interacts with a +pip-boy, was less than optimal. A keyboard was mandatory. I also +changed my mind about what processor I should use for the project, +starting with an AVR and later with a Z80. + + +As of right now, the objectives are the following: + +* Objectives + +- Have a pocket computer, that can be carried like a wrist watch + +- It should have as much RAM as its possible with a 8-bit CPU + +- It will run a lisp interpreter as its operating system + +- It would probably end up being used as a scientific calculator + +- It has to be expandable enough, so that I can be used as a pocket + Arduino replacement + +* Pocket Lisp Machine? +A lisp machine is a computer design to run lisp code. This means, it +is optimized to do so, be that through special hardware or ISA. + +Under this definition, my computer is no lisp machine. But the name +refers to the fact that it designed to run a lisp interpreter, scheme +specifically, as its operating system. + + +* Why don't I use a 6502/65816 instead of a Z80? +Between a Z80 and a 6502 I definitely prefer the Z80. Mainly because +of the instruction set and peripherals available. + +A 65816 would be easier to program than a Z80 due to the built-in +support for memory banking. But again, I still prefer the peripherals +of the Z80. + +The Z80 DMA is also a important factor for my decision. While it could +be used with other processors, I prefer to use it together with the Z80. + +The last reason is that, I began building my computer using a Z80 and +would like to complete this project using the same CPU I started with. + + +I do have the idea of building another computer in the future. This +time based on a WDC 85C816. diff --git a/src/z80/prototype1.org b/src/z80/prototype1.org new file mode 100644 index 0000000..23adec1 --- /dev/null +++ b/src/z80/prototype1.org @@ -0,0 +1,78 @@ +#+TITLE: Prototype 1 +#+DATE: <2019-03-03> +#+SETUPFILE: ../../options.org + +#+BEGIN_COMMENT +m4_define(`_REL_HEADER', `Previous: PLM +Next: Prototype 2Up: Z80')m4_dnl +#+END_COMMENT + +{{{date_place(Temuco, Chile)}}}@@html:
@@ Last edited: Bremen, +Germany, February 02, 2021 + +* Background + +Back in 2015 I used to watch gameplays of the just released [[https://en.wikipedia.org/wiki/Fallout_4][Fallout 4]]. +From this game the thing I loved the most was the pip-boy, so much so, +that I had the brilliant idea, /Why don't I build my own pip-boy? I +mean, How hard could it be?/. + +Unsurprisingly, it turned to be harder than expected. I only knew how +to program at an application level (I wasn't that good at it either) +and had basically no knowledge of electronics, assembly language, nor +did I even have the components at my disposal. + +* Beginning + +Some time after this idea, I got myself an atmel328p and a programmer. +I learned to instruct this AVR to draw text on a 16x4 lcd and could +get input from buttons. + +But I had some challenges. First, microcontrollers are usually based +on the Harvard architecture. This means that running programs from ram +was virtually impossible. + +Added to this was the fact that the AVR had only 2K of ram and no way +to add more. I avoided serial alternatives, because they are slower +and can't be used as normal RAM inside C code. + +These problems were ultimately fixed by switching to a Z80 +microprocessor. The Z80 could in fact handle more memory and run code +from its RAM, but with it came also the limitation of size. All memory +had to be external to the chip's package and the processor itself came +with no peripherals, as microcontrollers usually do. + +* First prototype + +Three years later, and with the help of many people, I finally +managed to get all the components and build my first working +prototype. It did not look beautiful, but it was functional. + +#+CAPTION: Prototype 1 together with its serial terminal +[[https://thomaslabs.org/media/prototype1.jpg]] + +I wasn't satisfied with this prototype though. It was not what I had +envisioned. I wanted to have a pocket computer and this was nothing +like that. It was huge and full of parts. + +* Partial conclusion + +Thanks to this project I learned a lot about electronics, programming, +circuit design and the inner workigs from a computer. + +Reinventing the wheel wouldn't have been the only way to acquire this +knowledge. But I would definitely recommend it to anyone wanting to +learn about the internals of computers. + +This being said, I can't deny that I still have a lot left to learn. + +* The end? +I wouldn't publish something on the Internet just to say I wasn't able +to accomplish my dream. Or would I? + +It turned out that the idea managed to stay alive long enough, to see +the day in which I decided to give it another try. This time, hoping +that the collected knowledge allows me to get further. + +This requires its own [[local:/z80/plm.html][series of articles]] though. diff --git a/src/z80/prototype2.org b/src/z80/prototype2.org new file mode 100644 index 0000000..ba19bd7 --- /dev/null +++ b/src/z80/prototype2.org @@ -0,0 +1,51 @@ +#+TITLE: Prototype 2 +#+DATE: <2021-03-03> +#+SETUPFILE: ../../options.org + +#+BEGIN_COMMENT +m4_define(`_REL_HEADER', `Next: Prototype 1 Up: Z80')m4_dnl +#+END_COMMENT + +{{{date_place(Bremen, Germany)}}} + +#+CAPTION: Prototype 2 +[[https://thomaslabs.org/media/prototype2_1.jpg]] + +Because when moving to Bremen, I wasn't able to take my old Prototype +with me, I had to build a new one. This time though, I needed +something easily modifiable. + + +One of the disadvantages of my first Prototype, was the fact, that it +took me around 3 days to build and, because it was soldered, it was +difficult to modify. This made experimenting with new ideas somewhat +impractical. + +Prototype 2 would be a prototyping tool, as such, it had to be built +with a technique, that allowed for the electrical stability of a +soldered circuit, but with the flexibility of a breadboard. + +This time I chose the wire wrap assembly technique, as it met all +requirements. + +The following is a list of what I was able to accomplish thanks to +Prototype 2 + +- New memory banking system that would allow it to handle up to 4 MiB + of memory, instead of the default maximum of 64KiB. + +- Add a RTC + +- Add video capabilities using a 480x320 18-bit color display + +- Dual serial ports with complete modem control lines + +#+CAPTION: Prototype 2 together with screen +[[https://thomaslabs.org/media/prototype2_2.jpg]] + +It didn't take long until Prototype 2 became incapable of fulfilling +its task. Once it was clear, which parts would definitely be part of +the final design, the flexibility of wire wrapping was no longer +needed. Added to this, the circuit experimented detrimental voltage +drops, due to the length of wire used. It was now time to design a +third prototype, this time using a PCB. diff --git a/src/z80/spi.org b/src/z80/spi.org new file mode 100644 index 0000000..d0e55a5 --- /dev/null +++ b/src/z80/spi.org @@ -0,0 +1,30 @@ +#+TITLE: SPI for microprocessors +#+SETUPFILE: ../../options.org + +Bremen, Germany, {{{date}}} + +SPI is a useful serial communications interface. It is used in +hobbyist projects to control from memory ICs to LCD screens and it's +even possible to read SD cards through it. + +Most modern microcontrollers are equiped with built-in SPI support, +which can be easily used from code without much hardware required. But +what happends when one wants to interface SPI peripherals with old +microprocessors? These usually don't have any built-in peripherals and +, as far as I am aware, there are no enternal peripherals one can buy. + +This article aims to provide an overview of how SPI works, the +instructions on how to build a SPI module for old microprocessors like +the Z80 and the explanation of how such a module operates. + +This is also a part of my ongoing series on the progress of my [[local:/z80][Z80 +based project]]. + +** Table of Contents +1) [[#how-does-spi-work][How does SPI work]] + +#+NAME: how-does-spi-work +** 1. How does SPI work +:PROPERTIES: +:CUSTOM_ID: how-does-spi-work +:END: -- cgit v1.2.3