r/shittyprogramming • • Jun 28 '15

Embedded developer adventures

Post image
297 Upvotes

55 comments sorted by

View all comments

3

u/AranHase Jun 28 '15

Some time ago I had to implement a supervisor (a system that manages many others smaller systems) for a manufacturing plant on a PIC microcontroller. So, I did shitty programming. Lots and lots of if/else, and global vars, and lots of macros and everything in a single file. Here is some of it (github link].

So, why so shitty? Well, the supervisor logic was mapped into a graph with thousands of nodes. And the PIC I was using had very limited memory (can't recall exactly, but like 16KB), and it was divided into Data Memory and Instruction Code Memory. I could not fit the graph into Data Memory. So I had a plan, lets put the data into instruction code memory :) And there we go, lots of if/else.

It was so shitty that I had to write a Python program to code it for me (Link].

Well, it worked (Video In Action), but then again, I'm not very proud, and never touched embedded system again.

1

u/hardolaf Jun 28 '15

Bah casual. Real embedded programmers do everything by hand! (I'm kidding, they hire interns to do it for them).