Categories
C/C++

“I do not think that word…

I’ve often had discussions with programmers about the subtleties of the language. They believe they understand what a language keyword is supposed to do, and use it that way — but they’re often mistaken, or not fully informed.

I’ve started a list of C and C++ keywords that have subtle differences from the “common” understanding of their usage. I expect to add more: please add your suggestions below.

Categories
Electronics

All Hardware, Great and Small

I’ve been fascinated by assembly language since I first learned to program: get really close to the hardware! However, there was still a small gap between those opcodes and what the hardware actually did.

When I went to Uni, one of the courses I took was to design a (simulated) microprocessor and implement an opcode map. I loved it – but it still wasn’t real enough.

A few years ago I stumbled across James Newman’s work with his MegaProcessor – a “micro”processor that had been implemented using transistors and LEDs instead of integrated circuits. And it’s big. Really big. Ten meters (thirty feet) big.

One of its nicest features is that one of its RAM banks is built as an array, to provide a display of the bits that the RAM contains. But that means it’s a pixel-addressable display, so I couldn’t help myself…

I wrote a (configurable) program to run on the machine, and sent it to James. He was kind enough to confirm that it worked on the real hardware – and even YouTube a couple of different runs:

A quick test to show the program worked
The smallest cell size for the maze, given the “screen” dimensions
Categories
C/C++

Pointers in C & C++

A long (long!) time ago I answered a question on Stack Exchange, but it is still applicable today:

Many programmers have a disjoint between a pointer and an array. Here’s an explanation.

Categories
Electronics

Power over Ethernet

I’ve been working on PoE projects recently. The most important thing: getting a circuit done and tested that can be incorporated into a variety of projects.

I found Silvertel’s PoE modules, and really like their smallest, the AG99xx range. So, I had to put one into a project. First up: curtains!

This project was easy because there was no data: I just needed a raw power delivery system.

Categories
C/C++

C/C++ function pointers

A while ago I edited the Wikipedia article on function pointers to explain an alternate syntax that I’ve used for years, but no-one else seems to. My way seems to me to be much clearer and more concise than the “canonical” one described in all the text books—so why isn’t everyone using it?

I’ve just assumed that it was lack of knowledge, so I’ve posted about C/C++ function pointers directly here.

Categories
C/C++

C/C++ struct bit fields: a proposal

I wrote a series of articles about struct bit fields: how they’re not used; how they are used; their limitations, both architecturally and as implemented by the compiler; and hardware considerations.

And those articles offer solutions for the various deficiencies that apparently cause many programmers to not use them, citing (especially) code portability as a concern.

But there is one “killer” scenario (in the bad sense) that makes struct bit fields practically impossible to use in that case. So I wrote a C/C++ language proposal to fix it!

Categories
Electronics

I’ve been published!

My SAE J1772 Tester has been featured in DIYode, an Australian electronics enthusiast magazine.