Zero Solutions

It’s a new week and a new project! I have been on my toes getting my three labs and homework done during the week while working 24 hours on the weekends but whatever keeps me on the path to engineering is worth it! I was inspired to write a post today because I figured something out that has puzzled me since I worked in New York last winter.

Since I am taking a course explicitly about wiring up a microcontroller, I naturally wish I could spend my entire week doing those labs. While that is becoming the trend, there are plenty of other things to keep me busy! This week’s lab started off somewhat frustratingly. We were supposed to be checking our button array code against an OLED screen. It just so happens that my brand new OLED does not work and it took until today to convince the professor of that. I am not the only student with a defective unit, but he thankfully traded me his working one while explaining that he had no extras…

My realization came from reading the textbook that my professor wrote. In order to understand how to flip the right bits in the right registers, we are researching data representation. Computers operate in zeroes and ones (binary), whereas we count in tens (decimal). A byte is a common organization of eight bits (the binary zeroes or ones), so other counting bases are used to accommodate that. We count in base ten, but hexadecimal (base 16) is commonly used in computing because it is two bytes long. Something I did not take into account is that octal (base 8) is also commonly used.

In my Seven Segment Display project, I was flummoxed by the fact that the numbers I fed the display could not have a preceding zero or they would come out completely wrong. I made sure my connections were to where they should go; numerical digits were being outputted, so that was not the likely culprit. I went through all of my code, line by line, and considered what I intended to do versus what I may actually be doing. In the end, I decided it was not an efficient use of time because I could not find the error. In that project, I did have to represent binary with the prefix 0b and hexadecimal with the prefix 0x. What I did not know until today is that octal is also a common base that the compiler supports. It is represented simply with a preceding 0.

Leave a comment