• (FYI : I am currently not posting the projects in chronological order, because I have so much stuff lying around that I did before I had the blog. So those things will show up from time to time.)

    The 4×4 LED Display was my first project with a two-layer circuitboard layout. The alignment was not 100% optimal, but sufficent. I wanted to make the board as small as possible, so the parts had to be stacked at some places. The square LED’s were painted black on the sides to keep the pixels sharp.

    4x4 LED Matrix Circuit Board (Top)

    4x4 LED Matrix Circuit Board (Top)

    The rows and columns are both controlled by a 4094 Shift&Store-register. The upper four bits control the coloumns and the lower four the rows. So for each frame 4 bytes have to be shifted in. That is done via a QBasic programm that toggles pins on the serialport. Instead it would also be possible to just send the bytes over a serialconnection, but I was to lazy to write code for that.
    To generate the patterns, one can put them together binary by hand. But I choose the easy way again and wrote a Delphi-Program to generate patternfiles, which then would be send to the display by a QBasic programm. (I test all my circuits on old DOS-PCs).

    Here is a video of the display in action. The sequence is preprogrammed…so no actual tetris yet..

    Layout and circuit are here. QBasic sourcecode is too ugly to show. How to shift data into a shiftregister should be easy for everyone who can read the datasheet.

    Tags: , , , , ,

  • For quick testing of digital circuits and chips I often use the parallelport because it is easy to program in C and QBasic. But writing a program for every new circuit takes to much time. So I wrote a little program to control the parallelport via a nice GUI.

    Parallelport Control

    Parallelport Control

    When you start the executable, you get the Port-Control-Screen, which is divided into the three registers that contain the pins of the port. The pins can be set individually or a script can be created, which places the bitpatterns on the port automatically. Therefore you must select a port, enter the hex-value of the byte, and click ‘Add’. Delays work the same way. The script can be saved and loaded via the contextmenu of the listbox. You can also write the script with any editor, as long as the same syntax is used.

    The ‘Run’-button runs the script n times, with n being the number in the field next to the button.

    The I²C-Mode is activated with the button of the same name.

    I2C Control

    I2C Control

    Here you have a sequence-listbox, the available actions, the necessesary parameters and a listbox which displays the recieved data. Just select the desired action, enter hex-value of the byte to send or delay (if necessary) and click ‘Add’. The contextmenu of the sequence-listbox provides save and load for the scripts.

    In datasheets for i²c-chips you often only find binary values for the commands to send. So I included a field which converts the binary values to hexadecimal numbers. Instead of entering the binary value you can also select the bits directly. The value is loaded into the datafield by clicking the small ‘<‘ button right next to it.

    After clicking ‘Run’ it is first checked, if the bus is ready, that is if SCL and SDA are both high (idle). Then the sequence is processed.

    The pins are hardcoded for my parallel-i²c-adapter, which can be found here. If you have a different interface, you can change the code. Maybe I will in include those options in the next version.

    Delphi6 sourcecode can be found here (executable and inpout32.dll included).

    (I only use the code on a Win98 PC, where the inpout32.dll is sufficient. To use it with Win2K or XP you need something like DirectIO.)

    Tags: , , , ,

  • Some years ago a friend of mine introduced to me a numerical puzzle called Sudoku. For every one who has not already heard of it, i will give a short description: The puzzle consists of a square field divided into 9 rows and 9 columns. Furthermore the 9×9 block is divided into nine 3×3 blocks. In every of the nine rows, nine columns and 3×3 blocks the numbers from 1 to 9 have to be positioned, so that every number occurs only once in every row, column and 3×3 square.

    At the start some, depending on difficulty, cells are already filled in. Then one has to conclude the missing numbers by logic. This can be done by a process of elimination.

    My solver sequentially checks the remaining possibilities for every cell. This is done by checking every cell in the same row, column and 3×3 field for the already filled in numbers. The remaining numbers are the possible for the cell. If there is only one, it is written to the cell. This is the simple version, but also the one that executes quicker.

    The more complex version compares the possible solutions for one cell with all the cells in the same row, column and 3×3 field. This allows to assign an number to a field, even if there are more than one possibilities, if one of them only is true for this cell.

    Some times the solution for one cell is ambigous. Then the solver chooses one of the remaining possibilities and then continues with the solution process. If the field can not be solved (when contradictions occur), the next possibility is checked until the field can be solved.

    The code may be a bit over complicated at some points because the strategy developed over time and was not planned in advance. Besides that, all (of the very few) comments are in german, as are all loging-outputs.

    Delphi 5 sourcecode can be downloaded here.

    Tags: , ,