The 8-Bit Microcontroller and Beyond: An Interview with Tam Hanna
If you want to build Internet of Things applications, you must understand the 8-bit microcontroller. Tam Hanna, author of Microcontroller Basics with PIC, is an excellent resource. He recently shared his thoughts about MCUs and his current electronics projects.
If you want to build Internet of Things applications, you must understand the 8-bit microcontroller. Tam Hanna, author of Microcontroller Basics with PIC (Elektor 2020), is an excellent resource. He recently told us about his new book, his interest in the 8-bit microcontroller, and a few his of current electronics projects.
A New Book on MCU Basics
Elektor: Your new book, Microcontroller Basics with PIC1, is intended to help readers understand and program an 8-bit microcontroller. Tell us why you chose to focus on this topic?
Tam Hanna: Because 8-bit controllers are a fascinating window into the world of microcontroller (MCU) and microprocessor electronics. From a technological point, this is plain and simple — if you understand what happens in an 8-bit MCU, that 400p architecture description of the RISC-V MCU is easier to grok. When I started my engineering career, I had nothing except for enemies. The Elektronik – gar nicht schwer series (English: Starting Electronics; Ed.) was tremendously valuable in giving me the ability to learn more quickly, and I am honored to give back, now that I am in a position to do so.
In many ways, the situation facing young engineers today is different. The availability of systems like Python makes getting working systems simple. The Arduino, love it or hate it, insulates you from the underlying hardware. However, in my practical studies, I meet people who run into a wall. Their problem usually is a basic understanding of basic concepts of electronics. A primitive 8-bit microcontroller can be understood completely on an assembly level. This knowledge can then transfer to advanced controller architectures. Given that I still use the PIC a lot commercially, I felt like writing a book is now in order.
Elektor: Who is your target audience for this book? Must a reader be a C programming expert?
Hanna: To be honest, I am not concerned about C programming skills. C has a bad reputation because it is easy to hurt yourself with it. But, like with a Tu-22, problems only crop up if you do stupid or aggressive things. (The TU-22 supersonic bomber was prone to control reversal when flown aggressively.)
I am more concerned about the level of electrical engineering knowledge needed. If you don’t at least know the basics of digital electronics, and also understand Ohm’s law, you will have problems. Ideally, a reader should have read both the DC and the digital electronics books from the same series.
Elektor: What did you enjoy the most about writing Microcontroller Basics with PIC?
Hanna: When I first signed up with SourceForge many moons ago, the site asked me to run through a self-evaluation questionnaire. One of the highest leverage degrees of proficiency was having to write a book about it. In a way, writing this book gave me an ability to sort the knowledge I have collected in my long and sordid career. Plus, of course, the ability of being able to give back a bit of my experience to help others.
Electrical engineering has always been my passion, so working on the text and finding cool examples was an interesting challenge. Being able to help out, especially with a great team, is a great honor.
Elektor: What was the most challenging part of writing the book?
Hanna: Forgive me for sounding cheesy, but this is a personal question and I am going to give a personal answer. The biggest problem I faced was knowing when to stop. While writing this book, I felt the weight of the next generation of cadets on my back. I was thinking of a younger version of myself, sitting in his lab, trying to learn more skills to get that job which lets him break free. There are so many helpful things I could tell him, not just about microcontrollers, but also about general electrical engineering and test equipment, and only limited time. This is one place where I really have to thank my editor. He did a great job at limiting my work and ensuring that a version of the book would actually become available to the reader so that he can profit from it. And, of course, there always is the hope for a second expanded edition.The 8-Bit Microcontroller
Elektor: Intel introduced the MCS-51 four decades ago. Why is the 8-bit microcontroller still relevant?
Hanna: On the risk of sounding like a luddite, there is a strange sense of technology infatuation, especially among novice engineers. When I started my career, I had the pleasure of meeting legendary Sir Bilal Musa from Generali Insurances. He shocked me by telling me that he would never use a product’s first generation — whether airplane, whether IT system. This idea has proven itself true in many cases, one example being the Yakovlev Yak-42.
I understand that 32-bit controllers are getting cheaper by the minute. But do you really, always, need the 32-bit performance? Look at what happened when Java went 64bit — in many cases, the longer pointers caused the total system performance to degrade. Especially when working on a low-power system, having to feed 32 memory cells instead of eight cells to store one pointer makes a difference.
Elektor: So, the 8-bit microcontroller is still relevant. Can you now tell us what you like about the PIC family of microcontrollers?
Hanna: One word: simplicity. It is not a coincidence that Massimo Banzi picked the AVR for the Arduino Uno — an 8- bit microcontroller, but optimized for the needs of C compilers. The PIC, on the other hand, was developed from the get-go as a product intended to be programmed by hand. This makes its internal architecture ideally suited as a teaching architecture.
Due to the extremely wide spread of the product, the ecosystem is very mature. Programming devices are dirt cheap. Most PICs are available in DIP housing. And, additionally, as PCs got faster and compiler technology got more advanced, Microchip Technology invested a lot of effort into making the C programming experience almost perfect.
Elektor: Some engineers will say an 8-bit microcontroller is hard to program with C. Do you agree or disagree?
Hanna: Some people say that transporting cargo with a Tu-144 is difficult, and that this makes this supersonic aircraft a universally bad and utterly useless design. No tool can satisfy everybody. If you want to run a complex algorithm, an 8-bit microcontroller probably is not ideal. If you enjoy allocating large amount of memory, you also won’t like the experience.
But, let us be honest with one another. For many, if not most jobs, the task at hand is quite simple. In this case, a small C routine is easier to handle than Assembler. If you find yourself banging your head against a wall all the time, switching to a more powerful controller or creating a combinatorial process computer should be a natural choice.
On the other hand, my view, of course, is jaded. Just look at the Palm VII. I actually programmed that thing.
A New Book on MCU Basics
Elektor: Your new book, Microcontroller Basics with PIC1, is intended to help readers understand and program an 8-bit microcontroller. Tell us why you chose to focus on this topic?Tam Hanna: Because 8-bit controllers are a fascinating window into the world of microcontroller (MCU) and microprocessor electronics. From a technological point, this is plain and simple — if you understand what happens in an 8-bit MCU, that 400p architecture description of the RISC-V MCU is easier to grok. When I started my engineering career, I had nothing except for enemies. The Elektronik – gar nicht schwer series (English: Starting Electronics; Ed.) was tremendously valuable in giving me the ability to learn more quickly, and I am honored to give back, now that I am in a position to do so.
In many ways, the situation facing young engineers today is different. The availability of systems like Python makes getting working systems simple. The Arduino, love it or hate it, insulates you from the underlying hardware. However, in my practical studies, I meet people who run into a wall. Their problem usually is a basic understanding of basic concepts of electronics. A primitive 8-bit microcontroller can be understood completely on an assembly level. This knowledge can then transfer to advanced controller architectures. Given that I still use the PIC a lot commercially, I felt like writing a book is now in order.
Elektor: Who is your target audience for this book? Must a reader be a C programming expert?
Hanna: To be honest, I am not concerned about C programming skills. C has a bad reputation because it is easy to hurt yourself with it. But, like with a Tu-22, problems only crop up if you do stupid or aggressive things. (The TU-22 supersonic bomber was prone to control reversal when flown aggressively.)
I am more concerned about the level of electrical engineering knowledge needed. If you don’t at least know the basics of digital electronics, and also understand Ohm’s law, you will have problems. Ideally, a reader should have read both the DC and the digital electronics books from the same series.
Elektor: What did you enjoy the most about writing Microcontroller Basics with PIC?
Hanna: When I first signed up with SourceForge many moons ago, the site asked me to run through a self-evaluation questionnaire. One of the highest leverage degrees of proficiency was having to write a book about it. In a way, writing this book gave me an ability to sort the knowledge I have collected in my long and sordid career. Plus, of course, the ability of being able to give back a bit of my experience to help others.
Electrical engineering has always been my passion, so working on the text and finding cool examples was an interesting challenge. Being able to help out, especially with a great team, is a great honor.
Elektor: What was the most challenging part of writing the book?
Hanna: Forgive me for sounding cheesy, but this is a personal question and I am going to give a personal answer. The biggest problem I faced was knowing when to stop. While writing this book, I felt the weight of the next generation of cadets on my back. I was thinking of a younger version of myself, sitting in his lab, trying to learn more skills to get that job which lets him break free. There are so many helpful things I could tell him, not just about microcontrollers, but also about general electrical engineering and test equipment, and only limited time. This is one place where I really have to thank my editor. He did a great job at limiting my work and ensuring that a version of the book would actually become available to the reader so that he can profit from it. And, of course, there always is the hope for a second expanded edition.
The 8-Bit Microcontroller
Elektor: Intel introduced the MCS-51 four decades ago. Why is the 8-bit microcontroller still relevant?Hanna: On the risk of sounding like a luddite, there is a strange sense of technology infatuation, especially among novice engineers. When I started my career, I had the pleasure of meeting legendary Sir Bilal Musa from Generali Insurances. He shocked me by telling me that he would never use a product’s first generation — whether airplane, whether IT system. This idea has proven itself true in many cases, one example being the Yakovlev Yak-42.
I understand that 32-bit controllers are getting cheaper by the minute. But do you really, always, need the 32-bit performance? Look at what happened when Java went 64bit — in many cases, the longer pointers caused the total system performance to degrade. Especially when working on a low-power system, having to feed 32 memory cells instead of eight cells to store one pointer makes a difference.
Elektor: So, the 8-bit microcontroller is still relevant. Can you now tell us what you like about the PIC family of microcontrollers?
Hanna: One word: simplicity. It is not a coincidence that Massimo Banzi picked the AVR for the Arduino Uno — an 8- bit microcontroller, but optimized for the needs of C compilers. The PIC, on the other hand, was developed from the get-go as a product intended to be programmed by hand. This makes its internal architecture ideally suited as a teaching architecture.
Due to the extremely wide spread of the product, the ecosystem is very mature. Programming devices are dirt cheap. Most PICs are available in DIP housing. And, additionally, as PCs got faster and compiler technology got more advanced, Microchip Technology invested a lot of effort into making the C programming experience almost perfect.
Elektor: Some engineers will say an 8-bit microcontroller is hard to program with C. Do you agree or disagree?
Hanna: Some people say that transporting cargo with a Tu-144 is difficult, and that this makes this supersonic aircraft a universally bad and utterly useless design. No tool can satisfy everybody. If you want to run a complex algorithm, an 8-bit microcontroller probably is not ideal. If you enjoy allocating large amount of memory, you also won’t like the experience.
But, let us be honest with one another. For many, if not most jobs, the task at hand is quite simple. In this case, a small C routine is easier to handle than Assembler. If you find yourself banging your head against a wall all the time, switching to a more powerful controller or creating a combinatorial process computer should be a natural choice.
On the other hand, my view, of course, is jaded. Just look at the Palm VII. I actually programmed that thing.