9
galena
5y

So my MCU teacher said I should use a long ass ternary to determine which pins should be set high for a given number on a seven segment display. Cause the display was on a single 8-bit port on the mcu I decided to generate a bitmask with a switch statement and set the port directly.

Comments
  • 4
    His argument was, that if the pins change to a differen or multiple ports I would need to change more code. Yeah, but its a good idea to design the hardware to use a single port. And with good documentation the changes can be made easily.
  • 5
    You're right of course, that's how you do it. If the HW designer puts such correlated pins on different ports, he needs a smack in his face.
  • 4
    *imagines a Marvel Cinematic Universe prof*
Add Comment