Computer Logic Design with KTechLab
A couple of weeks ago, I wrote an article about a digital and analog circuit simulator called ksimus. One of my readers asked what the difference was between ksimus and ktechlab so I thought I'd take a look at ktechlab. Let me just say that both of these programs are a lot of fun to play with.
My first impression of ktechlab was that it has a much richer assortment of components from which to build circuits. Unlike ksimus, ktechlab includes an addressable memory as well as DAC's, ADC's and even a PIC micro-controller! As I'll discuss later, I had to use Google to find out what some of the components were. Ktechlab's documentation seems to be reasonably complete though the program's website has a lot of broken links. The website does include a plea for help from the user community, so if you find the program useful, perhaps you can help the program's developers by helping with the website.
The components in ktechlab are roughly broken down into categories: sources, discrete components, switches, outputs, logic circuits, connections, and integrated circuits.
Amazingly, ktechlab comes with ten voltage sources, including a few I'd never heard of! I'm not an Electrical Engineer, but I did find it a bit redundant to have both a battery, and a fixed voltage source. Both components had a configurable voltage output. The voltage signal source provides a sine wave with a configurable amplitude and frequency. The square wave clock generator has a configurable frequency and duty cycle, although it's somewhat counter-intuitively categorized as a logic component and not a source.
Ktechlab also provides discrete components that let you build simple analog circuits. Here we find resistors, capacitors, inductors, diodes and transistors. We also find a wide variety of switches. We have momentary contact and momentary break switches as well as SPST, DPST, SPDT, DPDT, and a rotary switch.
The outputs that ktechlab provides are just as varied. We have simple LED's and lamps. We also have bidirectional LED's, seven segment LED's, and a dot matrix display. The dot matrix display can be made almost any size you can imagine. We also find volt meters and ammeters. Finally, we can use the logic, voltage, or current probes to get a plot at the bottom of the application screen. Figure 1 shows a trivial circuit I built to demonstrate a couple different switches, a battery, a light bulb, a volt meter, and a potentiometer.

Ktechlab has a connections section that had some unexpected goodies. Here we find serial and parallel ports with all of the pins labeled! Ktechlab also has a bus connection that allows us to combine many conductors so that they can be routed and connected as a whole. For example, all of the address lines to a memory chip could be combined into one bus. We can use external connections to build modules that can then be used in larger projects.
When we get into the digital components things begin to get really interesting. Generally speaking, you'll find all of the gates and logic levels you expect and the gates can be any size you want. Creating an OR gate with 50 inputs is just crazy, but ktechlab will let you do it. We also find JK, SR, and D flip-flops. Then we move on to more complicated integrated circuits like DAC's, ADC's, Op Amps, 2-bit Adders, Multiplexers, Demultiplexers, and Counters. At this point, you could call the parts list fairly complete, but there's still more. Ktechlab has a BCD to 7 segment display encoder as well as a matrix display driver. We can even use a 555 timer chip! Remember those?
Figure 2 shows another simple circuit that I created. This time we have a clock source that drives an 8-bit counter. The output of the counter is used as data for a dot matrix display driver, which drives a single character of a dot matrix display. As you can see, I've got an enable, up/down, and a reset button. So, when the enable button is closed, the clock starts and the display cycles through all of the possible characters. If you press the reset button, it starts over again. If you toggle the up/down button, the display cycles in the other direction. This is a simple circuit, but it's a nice demonstration of some of the nicer features of ktechlab.

Next we come across the two chips I never expected to find in a simulator. One of the circuits is a RAM chip with up to a 32 bit address bus! I stopped increasing the data word size when I got to 90 bit!
The other chip I didn't expect to find in such a general circuit simulation package is a PIC micro-controller! Ktechlab allows you to use a P16F84 PIC in your design. Not only will Ktechlab simulate the PIC, it will allow you configure and program it! On a real PIC, each pin can be configured as either an input or an output. This configuration is done by writing a particular bit pattern into a configuration register. Ktechlab makes initial PIC configuration trivial; you can set the initial logic level by clicking on each pin to toggle between high and low. You configure each pin as input or output by clicking on the pin and dragging the mouse in the direction you want data to flow on that pin. Each pin has an arrow next to it indicating whether the pin is an output or input.
Figure 3 shows a fictional circuit featuring a PIC micro-controller and a parallel port. It's easy to see that with just a little bit of research, building a parallel interface circuit using a PIC could be trivial. Ktechlab allows you to design and model such a circuit.

Once you've got the PIC configured, which ktechlab will help you do, you can load a program onto it in either .asm, .c, or .microbe format. If your program is in .asm format, ktechlab will simulate the program while it's in the circuit.
PIC assembly language can be a bit daunting, but ktechlab helps make PIC programming easier. With ktechlab, you can actually create simple programs by combining flowchart elements. It's actually easier to show than to describe, so take a look at figure 4. In the left-hand corner, you see the PIC, with it's pins labeled. Each pin has an arrow next to it that indicates whether the pin is an output or an input. You also see the skeleton of a simple program and a subroutine. So, ktechlab gives you a unified environment where you can program, simulate and interface with PIC micro-controllers.

Once thing that I find conspicuously missing from ktechlab, as well as ksimus, is the ability to output signal levels to a file or read them in as circuit inputs. This would open the door to being able to simulate a circuit using real-world inputs. You'd also be able to compare the output of a simulation to known-correct results. Sadly, neither ktechlab nor ksimus offer this feature.
I came across ksimus and installed it out of curiosity. Ktechlab was pointed out to me by a reader. Both programs are fun to use and quite functional. Ksimus is probably better at modeling analog circuits using it's superior floating point functions. Ktechlab is vastly superior for doing computer logic design because it offers a wider range of components.
| Attachment | Size |
|---|---|
| Fig1.png | 4.62 KB |
| Fig2.png | 13.12 KB |
| Fig3.png | 14.98 KB |
| Fig4.png | 17.31 KB |
Mike Diehl is a freelance Computer Nerd specializing in Linux administration, programing, and VoIP. Mike lives in Albuquerque, NM. with his wife and 3 sons. He can be reached at mdiehl@diehlnet.com
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.
Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.
Sponsored by ActiveState
| Non-Linux FOSS: libnotify, OS X Style | Jun 18, 2013 |
| Containers—Not Virtual Machines—Are the Future Cloud | Jun 17, 2013 |
| Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer | Jun 12, 2013 |
| Weechat, Irssi's Little Brother | Jun 11, 2013 |
| One Tail Just Isn't Enough | Jun 07, 2013 |
| Introduction to MapReduce with Hadoop on Linux | Jun 05, 2013 |
- Containers—Not Virtual Machines—Are the Future Cloud
- Non-Linux FOSS: libnotify, OS X Style
- Linux Systems Administrator
- Validate an E-Mail Address with PHP, the Right Way
- Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer
- RSS Feeds
- Senior Perl Developer
- Technical Support Rep
- Introduction to MapReduce with Hadoop on Linux
- Weechat, Irssi's Little Brother
- What the author describes
53 min 39 sec ago - Reply to comment | Linux Journal
5 hours 4 min ago - Reply to comment | Linux Journal
5 hours 49 min ago - Didn't read
5 hours 59 min ago - Reply to comment | Linux Journal
6 hours 4 min ago - Poul-Henning Kamp: welcome to
8 hours 14 min ago - This has already been done
8 hours 15 min ago - Reply to comment | Linux Journal
9 hours 59 sec ago - Welcome to 1998
9 hours 49 min ago - notifier shortcomings
10 hours 13 min ago
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?



Comments
kteclab-gcb
ktechlab is a great tool for simulation designed for begginers and not that beggineer users, but is exist a fork about this software, in our comunity, an effort has made, tha costruccion, the site is in Spanish, but i don't belive that's a problem :D
only search in google ktechlab-gcb and you can find debian packages was make Pikitin
Greetings
ktechlab is very interesting
Is true u tell about ktechlab, but in this forum,
http://pic-linux.foroactivo.net/ktechlab-f6/
a fork from ktechlab was make
http://pic-linux.foroactivo.net/ktechlab-f6/ktechlab-gcb-t233.htm
the effort made by Pikitin, et al. who are the authors of this fork, are great
The forum is in Espanish. but may be you can found interesting.
For AlonzoTG
Hello Alonzo,
you say that you are the current main developer of Ktechlab so i hope that you can address some serious issues that IMO are slowing down the adoption of this excellent piece of software that we call ktechlab.
Before adding new functionalities i think there are stability problems to be addressed.
I use the precompiled RPM of Mandriva 2009 and ktechlab sometimes crashes without warning, i also have some friends who use Gentoo and compile it by themselves who experience the same kind of stability issues. The same stability problems have been observed by other people that i know using different distros and ktechlab's versions.
Do you experience them too? Because it is pretty bothering to spend time connecting components together and then lose all your work for a sudden and unexpected crash. This is the main reason that keeps me away from ktechlab. It is a very good simulator and it is a shame that it keeps crashing when you less expect it.
It would be great to see it used in schools but until it is not stable enough to be usable i doubt anyone will adopt it.
Adding new functions is cool... but if the software keeps crashing no one will really use it. Also... i have noticed that disabling the simulation while building the circuit prevents most crashes... why does ktechlab start with simulation enabled by default?
Thank you,
Luca
Current development
I'm the current main developer. A KDE 4 port is in progress.
The battery in ktechlab is the ideal abstract battery, if you require a voltage drop, you need to explicitly add a resistor to it.
When you simply want a single fixed voltage point, you could use a battery and a ground, however it's simpler, and common practice!, to indicate a fixed voltage point on a schematic. The actual computational matrix for both the single fixed voltage point and the battery combined with a ground should be identical though the code for the fixed voltage point is far more compact. Ideally, this would create a second circuit to allow you to manage the return currents.
KTechlab is death
KTechlab was a really impressive project.
But since David Saxton left the project a few years ago there is nearly zero progress.
There will probably never be a KDE4 version.
Battery not constant
It's internal resistance increases as charge depletes but I'm not sure KTechLab models that.
Interesting program anyways. Thanks for the review.