Programmable Logic: Build Yourself A CPLD Module

A Complex Programmable Logic Device (CPLD) is a great piece of hardware to have in your repertoire. As its name implies, you can program these chips to serve the logic functions you need. This might be replacing an obsolete chip, or maybe just a way to learn and try different techniques. What better way to learn than to get your hands on a CPLD and give it a try?

I created a CPLD module with the intent of being able to plug it into lots of things including solderless breadboards, but I screwed up. It seems that the plugin space available on a solderless breadboard is 1.1”, I had made the footprint 1” wide leaving no room for a row of wires on both sides. Duh.

But let me back up and show more about what I’m doing , I wanted to make a programmable piece of logic that could be built as a kit one could easily solder at home, could be programmed in-circuit, and could work at 3.3 or 5 volts.

Image5bTo implement an easily solderable kit I went with an older CPLD part that also has 3.3v and 5v versions that will maintain its programming regardless of power. The logic itself is a CPLD IC from the Altera Max family with two versions that fit the board with either 32 or 64 macrocells. A macrocell is the basic logic building block and it is programmed with logic “terms” and then interconnected to other macrocells through a programmable interconnect.

Continue reading “Programmable Logic: Build Yourself A CPLD Module” →

Hacking When It Counts: Surviving The Burma Death Railway

In the early days of World War II, the Japanese army invaded Burma (now Myanmar) and forced an end to British colonial rule there. Occupying Burma required troops and massive amounts of materiel, though, and the Japanese navy was taking a beating on the 2,000 mile sea route around the Malay Peninsula. And so it was decided that a railway connecting Thailand and Burma would be constructed through dense tropical jungle over hilly terrain with hundreds of rivers, including the Kwae Noi River, made famous by the Hollywood treatment of the story in The Bridge on the River Kwai. The real story of what came to be known as the Burma Death Railway is far grislier than any movie could make it, and the ways that the prisoners who built it managed to stay alive is a fascinating case study in making do with what you’ve got and finding solutions that save lives.

Nutrition from Next-to Nothing

AWM_P00761_011-540
POWs in camp. [Source: The Thai-Burma Railway and Hellfire Pass]
Labor for the massive project was to come from the ultimate spoil of war – slaves. About 250,000 to 300,000 slaves were used to build the Burma-Siam Railway. Among them were about 60,000 Allied prisoners of war, primarily Australian, Dutch, British and American. POWs were singled out for especially brutal treatment by the Japanese and Korean guards, with punishment meted out with rifle butt and bamboo pole.

With the POWs was Doctor Henri Hekking, who had been born and raised in the former Dutch East Indies colony of Java (now Indonesia). He had spent his early years with his grandmother, a master herbalist who served as “doctor” for the native villagers. Inspired by his oma’s skill and convinced that the cure for any endemic disease can be found in the plants in the area, Dr. Hekking returned to Java as an officer in the Dutch army after completing medical school in the Netherlands.

After his capture by the Japanese, Dr. Hekking did everything he could to help his fellow POWs despite the complete lack of medical supplies, all the while suffering from the same miserable treatment. Hekking realized early on that the starvation rations the POWs endured were the main cause of disease in the camps; a cup of boiled white rice doesn’t provide much energy for men building a railway by hand in jungle heat, and provides none of the B vitamins needed by the body.

Continue reading “Hacking When It Counts: Surviving The Burma Death Railway” →

We Didn’t Know The Sun Could Do Digital

You don’t get much more old school than a sundial, and more new school than 3D printing. So, it is nice to see these two combined in this impressive project: the 3D printed digital sundial. We have seen a few sundial projects before, ranging from LED variants to 3D printed ones, but this one from [Julldozer] takes it to a new level.

In the video, he carefully explains how he designed the sundial. Rather than simply create it as a static 3D model, he used OpenSCAD to build it algorithmically, using the program to create the matrix for each of the numbers he wanted the sundial to show, then to combine these at the appropriate angle into a single, 3D printable model. He has open-sourced the project, releasing the OpenSCAD script for anyone who wants to tinker or build their own. It is an extremely impressive project, and there is more to come: this is the first in a new podcast series called Mojoptix from [Julldozer] that will cover similar projects. We will definitely be keeping an eye on this series.

Continue reading “We Didn’t Know The Sun Could Do Digital” →

This Is Not Your Father’s FORTRAN

I learned to program FORTRAN IV in the spring of 1968 while working as an engineering technician in water resources. One of the engineers knew of my interest in computers and asked if I would like to learn FORTRAN. He needed to calculate the biological oxygen demand in streams but didn’t have any interest in programming. I jumped at the chance.

415I2ZfVyqL._SX258_BO1,204,203,200_This was the days of big iron when the term computer meant a room full of heavily air-conditioned equipment. The State University of New York at Buffalo had an IBM 704 but they soon upgraded to a CDC 6400. To help pay for it they were inviting people to attend a seminar on FORTRAN so they could use the system. My job was with a small State of NY office and getting approval for me to attend was surprisingly easy.

Off I went for 6 weeks of training on one night a week. I still have my black “A Guide to Fortran IV Programming” by [Daniel McCracken]. For years, this was the FORTRAN bible, commonly referred to as just “McCracken”.

The programming went well and somewhere out there is a very old paper with a reference to the results it generated about the Chadakoin River flowing through Jamestown, NY.

This is FORTRAN’s strength – scientific calculations. It’s name says it: FORmula TRANslation.

Origins and FORTRAN IV

[John W. Backus] suggested to IBM a language to replace assembly language. Development began in 1953 for the IBM 704 and the project reached fruition in 1957. Not only was it the first general purpose high-level language, just beating out COBOL and LISP, but its compiler optimized the code since it needed to compete head-on with assembly language. It was the C compiler of its day in that regard.

That was not the only reason it attained success. Reducing the number of punched cards needed for a program by a factor of 20 over assembly helped considerably.

In those days, you needed to use a key punch to create a deck of punch cards. To be really good you had to know how to create a programming card that would let you skip through the fields on a FORTRAN card, or how to edit a card by duplicating it and holding one of the cards in place while you typed in new characters. Because of my fascination with computers I’d taken a key punching and automation machines class in high school so I was all set.

Continue reading “This Is Not Your Father’s FORTRAN” →

Don’t Look Now, Nothing Will Happen –Zeno Of Elea

The Greek philosopher [Zeno of Elea] proposed that an arrow in flight was in fact not in motion and its visible movement is only an illusion. A simple example of this is to glance at an arrow in flight, doing this causes our mind to store a snapshot of a motionless arrow. [Zeno] further defended this argument by stating that if an object has to travel a finite distance to reach a destination then the finite distance can be divided in half and the object must first reach this halfway point before arriving at the destination. This process can be repeated an infinite number of times, creating an infinite number of points that the object must occupy before reaching the destination thus it can never arrive at the destination.

Whoa, that’s a bit heavy. Let’s take a second here to think about this and never arrive at the conclusion, shall we?

So what does a fancy mathematics parlor trick have to do with the fact that we have all seen an arrow arrive at its destination? Recent experiments conducted at Cornell University have in fact verified the Zeno Effect. Researchers were able to achieve this by having atoms suspended between lasers in temperatures ~1 nano degree above absolute zero so that the atoms arrange themselves in a lattice formation. As per usual in quantum mechanics when observed, the atoms had an equal possibility of being anywhere within the space of the lattice. However, when they were observed at high enough frequencies the atoms remain motionless, bringing the quantum evolution to a halt.

Killed By A Machine: The Therac-25

The Therac-25 was not a device anyone was happy to see. It was a radiation therapy machine. In layman’s terms it was a “cancer zapper”; a linear accelerator with a human as its target. Using X-rays or a beam of electrons, radiation therapy machines kill cancerous tissue, even deep inside the body. These room-sized medical devices would always cause some collateral damage to healthy tissue around the tumors. As with chemotherapy, the hope is that the net effect heals the patient more than it harms them. For six unfortunate patients in 1986 and 1987, the Therac-25 did the unthinkable: it exposed them to massive overdoses of radiation, killing four and leaving two others with lifelong injuries. During the investigation, it was determined that the root cause of the problem was twofold. Firstly, the software controlling the machine contained bugs which proved to be fatal. Secondly, the design of the machine relied on the controlling computer alone for safety. There were no hardware interlocks or supervisory circuits to ensure that software bugs couldn’t result in catastrophic failures.

The case of the Therac-25 has become one of the most well-known killer software bugs in history. Several universities use the case as a cautionary tale of what can go wrong, and how investigations can be lead astray. Much of this is due to the work of [Nancy Leveson], a software safety expert who exhaustively researched the incidents and resulting lawsuits. Much of the information published about the Therac (including this article) is based upon her research and 1993 paper with [Clark Turner] entitled “An Investigation of the Therac-25 Accidents”. [Nancy] has since published updated information in a second paper which is also included in her book.

Continue reading “Killed By A Machine: The Therac-25” →

Atmel Introduces Rad Hard Microcontrollers

The Internet is full of extremely clever people, and most of the time they don’t realize how stupid they actually are. Every time there’s a rocket launch, there’s usually a few cubesats tucked away under a fairing. These cubesats were designed and built by university students around the globe, so whenever a few of these cubesats go up, Internet armchair EEs inevitably cut these students down: “That microcontroller isn’t going to last in space. There’s too much radiation. It’ll be dead in a day,” they say. This argument disregards the fact that iPods work for months aboard the space station, Thinkpads work for years, and the fact that putting commercial-grade microcontrollers in low earth orbit has been done thousands of times before with mountains of data to back up the practice.

For every problem, imagined or not, there’s a solution. Now, finally, Atmel has released a rad tolerant AVR for space applications. It’s the ATmegaS128, the space-grade version of the ‘mega128. This chip is in a 64-lead ceramic package, has all the features you would expect from the ATmega128 and is, like any ‘mega128, Arduino compatible.

Atmel has an oddly large space-rated rad-hard portfolio, with space-grade FPGAs, memories, communications ICs, ASICs, memories, and now microcontrollers in their lineup.

While microcontrollers that aren’t radiation tolerant have gone up in cubesats and larger commercial birds over the years, the commercial-grade stuff is usually reserved for low Earth orbit stuff. For venturing more than a few hundred miles above the Earth, into the range of GPS satellites and to geosynchronous orbit 25,000 miles above, radiation shielding is needed.

Will you ever need a space-grade, rad-hard Arduino? Probably not. This new announcement is rather cool, though, and we can’t wait for the first space grade Arduino clone to show up in the Hackaday tips line.