📜 ⬆️ ⬇️

Brainfuck computer

Perhaps many of you have heard of Brainfuck, an esoteric programming language, or a Ponte tool. But here everyone has their own opinion. Below I want to give a translation of one enthusiast who created a computer that works based on Brainfuck.

Computer brainfuck



news

Some freaks (otherwise you will not name them) actually built a copy of this project, and wrote an multiplication program for it . Here is his image. .

The essence

')
It seems that the code that I posted here does not work, and I lost the source code. Now I rewrote the ROM code, and it works fine. In the future, it was foolish not to use the internal pull-up resistors in the PIC, and not those 10-kilohm resistors that I use now. This is likely to reduce the power consumption of the LEDs very little, maybe just a few microamps.

None of the software projects I am working on is useful, but this plays a special role ... I built a computer on the PIC16F84A microcontroller using an 8-pin DIP switch (has four pairs of pins) and 8 3-millimeter red LEDs. Speed? I use a 32.768kHz clock crystal - and since the PIC takes about 4 cycles for each command, it all works on 8192 instructions per second. Now, here is the best part. The only program is a simple “editor” and interpreter Brainfuck! This is rather inefficient, due to the simplicity of the PIC architecture, so you might expect maybe 100-500 operations per second from it. It has 68 bytes of RAM, of which 32 can be used by user programs. Programs are stored in non-volatile PIC memory (64 bytes), which allows programs to run up to 128 instructions (2 3-bit instructions and 2 empty bits per byte).

The largest and most complex program ever written for this fantastic computer is:

,>,[<+>-]<.

It was transferred to a computer by converting the program into a sequence of numbers - 72743021536 - which were entered one digit at a time while being typed using the binary number system. Brainfuck-computer, of course, is nothing special and I want to improve it, theoretically it can be done, since I actually added some features to make the editor a little more user-friendly (or rather, a little less hostile to the user ). This useful piece of software was written by my friend Eric, and if you violate his copyright, he will most likely kick your ass. You have been warned.

By the way, anyone who can guess what this program actually does gets a good experience! (Hint: she will ask you to enter and add two numbers, and then output the result).
image

Necessary components.


Component: Characteristic.
B1-B4: DIP switch.
C1-C2: Capacitors; 100 pF; ceramic.
D1-D8: 3 mm red LEDs.
R1-R9: Resistors; 1k.
R10-R13: Resistors.; 10k.
U1: PIC16F84A microcontroller.
X1: 32.786kHz crystal.

The result of the foregoing.


The best thing about this project is that you can get all the parts for two or three US dollars (of course, if you live in the USA, but in principle, it’s easy to find these parts in any country). In addition, Microchip sends you a free PIC, in other words, it saves you a certain amount of money.

Related files


Source Code (with documentation)
Computer image

From me:

From me there have been added some explanations, comments and links missing in the original. I will ask you to report any inaccuracies or errors to the LAN. I will be grateful for the reasoned comments and your opinions regarding this project.

Source: https://habr.com/ru/post/152741/


All Articles