# From Gates to FPGA’s – Part 1: Basic Logic

It’s time to do a series on logic including things such as programmable logic, state machines, and the lesser known demons such as switching hazards. It is best to start at the beginning — but even experts will enjoy this refresher and might even learn a trick or two. I’ll start with logic symbols, alternate symbols, small Boolean truth tables and some oddball things that we can do with basic logic. The narrative version is found in the video, with a full reference laid out in the rest of this post.

## Invert

The most simple piece of logic is inversion; making a high change to low or a low change to high. Shown are a couple of ways to write an inversion including the ubiquitous “bubble” that we can apply almost anywhere to imply an inversion or a “True Low”. If it was a one it is now a zero, where it was a low it is now a high, and where it was true it is now untrue.

## AND

Moving on to the AND gate we see a simple truth table, also known as a Boolean Table, where it describes the function of “A AND B”. This is also our first opportunity to see the application of an alternate symbol. In this case a “low OR a low yields a low”

## NAND

Most if not all of the standard logic blocks come in an inverted form also such as the NAND gate shown here. The ability to invert logic functions is so useful in real life that I probably used at least three times the number of NAND gates as regular AND gates when doing medium or larger system design. The useful inversion can occur as spares or in line with the logic.

# Weekend Proves Hardware Wins Hackathons

Teams hacking on hardware won big this weekend in New York. There were ten teams that answered Hackaday’s call as we hosted the first ever hardware hackathon at the Tech Crunch Disrupt NYC. These teams were thrown into the mix with all of the software hackers TC was hosting and rose to the top. Eight out of our ten teams won!

As we suspected, having something physical to show off is a huge bonus compared to those showing apps and webpages alone. Recipe for awesome: Mix in the huge talent pool brought by the hardware hackers participating, then season with a dash of experience from mentors like [Kenji Larson], [Johngineer], [Bil Herd], [Chris Gammell], and many more.

Out of over 100 teams, first runner-up went to PicoRico, which built a data collection system for the suspension of a mountain bike. The Twillio prize went to Stove Top Sensor for Paranoid, Stubburn Older Parents which adds cellphone and web connectivity to the stove, letting you check if you remembered to turn off the burns. The charismatic duo of fifteen-year-olds [Kristopher] and [Ilan] stole the show with their demonstration of Follow Plants which gives your produce a social media presence which you can then follow.

We recorded video and got the gritty details from everyone building hardware during the 20-hour frenzy. We’ll be sharing those stories throughout the week so make sure to check back!

# VCF East: [Bil Herd] And System Architecture

Last Friday the Vintage Computer Festival was filled up with more than a dozen talks, too many for any one person to attend. We did, however, check out [Bil Herd]’s talk on system architecture, or as he likes to call it, the art and science of performance through balance. That’s an hour and fifteen minute talk there; coffee and popcorn protocols apply.

The main focus of this talk is how to design a system from the ground up, without any assumed hardware, or any specific peripherals. It all starts out with a CPU, some memory (it doesn’t matter which type), and some I/O. That’s all you need, whether you’re designing a microwave oven or a supercomputer.

The CPU for a system can be anything from a 6502 for something simple, a vector processor for doing loads of math, or have a RISC, streaming, pipelined, SIMD architecture. This choice will influence the decision of what kind of memory to use, whether it’s static or dynamic, and whether it’s big or little endian. Yes, even [Bil] is still trying to wrap his head around endianness.

MMUs, I/O chips, teletypes, character displays like the 6845, and the ANTIC, VIC, and GTIA make the cut before [Bil] mentions putting the entire system together. It’s not just a matter of connecting address and data pins and seeing the entire system run. There’s interrupts, RTCs, bus arbitration, DTACK, RAS, and CAS to take care of that. That will take several more talks to cover, but you can see the one last Friday below.

# How to Build a Thermocouple Amplifier

A Thermocouple is a terrific way to measure temperature. The effects of temperature change on dissimilar metals produces a measurable voltage. But to make that measurement you need an amplifier circuit designed for the thermocouple being used.

While researching “Zero Drift Amplifiers” as a follow-up to my video on Instrumentation Amplifiers I noticed the little schematic the front page of the LTC1049 datasheet which is shown here. I thought it was an ideal example of an analog application where some gain and some “gain helper” were needed to accomplish our useful little application of amplifying a thermocouple probe.

In the video I don’t really talk much about the thermocouples themselves other than the type I see most of the time which is type K. If you’re not already familiar with the construction of these probes you can find an informative write-up on thermocouples and the different types on the Wikipedia page and you might also want to check out the Analog Devices app note if you would like to know more. What I will cover is a reliable and precise way to read from these probes, seen in the video below and the remainder of the post after the break.

# We Assume Control: SPI and a Digital Potentiometer

In the last video I demonstrated a Universal Active Filter that I could adjust with a dual-gang potentiometer, here I replace the potentiometer with a processor controlled solid-state potentiometer. For those that are too young to remember, we used to say “solid-state” to differentiate between that and something that used vacuum tubes… mostly we meant you could drop it without it breakage.

The most common way to control the everyday peripheral chips available is through use of one of the common Serial Protocols such as I2C and SPI.  In the before-time back when we had only 8 bits and were lucky if 7 of them worked, we used to have to memory map a peripheral or Input/Output (I/O) controller which means we had to take many control and data lines from the microprocessor such as Data, Address, Read/Write, system clocks and several other signals just to write to a couple of control registers buried in a chip.

Nowadays there is a proliferation of microcontrollers that tend to have built-in serial interface capability it is pretty straightforward to control a full range of peripheral functions; digital and analog alike.  Rather than map each peripheral using said data and address lines,which is a very parallel approach,  the controller communicates with peripherals serially using but a handful of signal lines such as serial data and clock. A major task of old system design, mapping of I/O and peripherals, is no longer needed.

# Universal Active Filters: Part 2

An easy way to conceptualize active filters is thinking about audio speakers. A speaker crossover has a low-pass, high-pass and band-pass effect breaking a signal into three components based upon frequency. In the previous part of this series I took that idea and applied it to a Universal Active Filter built with a single chip opamp based chip known as the UAF-42. By the way, it’s pretty much an older expensive chip, just one I picked out for demonstration.

Using a dual-ganged potentiometer, I was able to adjust the point at which frequencies are allowed to pass or be rejected. We could display this behavior by sweeping the circuit with my sweep frequency function generator which rapidly changes the frequency from low to high while we watch what can get through the filter.

In this installment I’ll test the theory that filtering out the harmonics which make up a square wave results in a predictable degradation of the waveform until at last it is a sine wave. This sine wave occurs at the fundamental frequency of the original square wave. Here’s the video but stick with me after the break to walk through each concept covered.

# Making the CES Show… Thirty Years Ago

This year’s CES has dredged up some memories. I had assumed that as one becomes old they are supposed to become used to memories of a young vigorous person that shared their body and memories leaving little else except some scars and some old stale socks lying around plus 2 or 3 pictures to prove it was in fact not a series of hallucinations. Turns out you don’t get used to it, you just endure.

30 Years ago was our CES: Commodore had the reputation of showing something new every CES and this was a time when a Home Computer meant a Consumer Computer. I have written before about how we endeavored to make sure other’s failures didn’t become ours and we did in fact make it, just in time, to the ’85 CES with what became our flagship computer, at least for the next 4 days.

## To the Very Last Minute

When I say made it just in time I am counting people hand carrying the last ten or so homebrewed and MOS cooked 80 column chips either the night before or that very morning. The C128 computers where waiting lined up and open in the room seen below; cases agape much like a row of baby birds waiting on whatever engorgement MOS had come up with for us as the seconds counted down.

And then finally we stood on the second floor of our booth (yes they built a 2 story structure for us in a couple of hours the night before) surveying the now working computers; C128’s and the never released LCD machine, when the last “issue” before the doors opened arrived; a Marketing person (panting) telling us of “yet another C128 failure” though she couldn’t actually point to any previous computers that had failed. We wouldn’t let her continue with her complaint until she retracted the previous general statement of failure, more on principle than actual meanness.

As with most highly technical in-the-field fixes this one was something to remember. My last act of “the ’85 CES show” became the simple motion of walking up to the “failed” computer station and pressing the key changing the C128 back to 40 column mode, especially important since it only had a 40 column monitor attached to it.

## End of Line

Then something happened: We were done. I felt sub-processes actually end that had been consuming both CPU and I/O for months, I was suddenly unencumbered by the next “must fix”. I didn’t have a next task to pop from the stack… the phrase “End of Line” came to mind.

I was 24, in Las Vegas and had just delivered one of the major products for the best computer company in the world to the only show that mattered to us. I started walking towards the door with the uncommonly bright Las Vegas sun streaming through the windows. There were lines of people around the block waiting to enter, but the exit was completely unobstructed.

I buried myself in Las Vegas in a way that only youth, testosterone, and adrenaline can enable.

## Making the Rounds

I won’t report here much of what all was done over the next days as I understand that for some things the statute of limitations never truly runs out, but inspired by [Mike’s] reporting of visiting the suites of the companies I will relate one small tale here: I had grabbed my best friend and fellow hardware designer who was the father of the 1581 disk drive, also successfully released on this day, and headed out. With the 6’8” [Greg Berlin] (grandson of the designer of the Curtis Wright P-40 Warhawk) in tow we started hitting the floors of the local hotels looking for the suites of the “important” companies that never managed to personally invite us. We had a secret weapon that opened doors as if bribed; not in Greg’s towering presence but in the simple phrase: “we’re from Commodore”.

Doors fully opened that had previously opened only 12-14 inches only to stop on the shoe of the doorman, and 5.25” floppies were stuffed in our pockets like the \$20 bills of a VIP trying to impress his date. The suite that comes to mind was that of Electronic Arts (EA). With backslaps and copies of this year’s (and a few of last year’s) C64 game floppies shoved in our pockets we were welcomed like old friends; appointments were made and more than a couple of chugging contests were held. They lost or at least didn’t better us as we were young and full of testosterone.

As we made ready to leave the good folk of EA, after making sure that we would swing by their booth the next day (we did), they asked if there was anything they could get for us. This may sound like a strange or gratuitous question but I had already spied the case of Michelob (a beer from the early days of 1 micron silicon) and was pointing to it before the question was fully uttered. EA grabbed the case with no hesitation as I turned to face the door so he could set the case of teardrop shaped bottles on my shoulder for me.

Back out into Las Vegas we went with Electronic Art’s beer on my shoulder… It was a good CES.