Close

Seeing the invisible

A project log for Snake on 7-segment displays

Might be very hard to play, but will look awesome!

hari-wigunaHari Wiguna 08/15/2019 at 04:212 Comments

I decided to go with the five rows of eight digits.

So, each row is shifted through eight shift registers and shows up as 64 segments (counting the decimal points).

This is what five rows of 64 bits look like on the scope.

Yellow is the clock, blue is the data, and purple is the latch that is triggered as we switch rows.

Zooming into the first row, lowest bit is high while the other bits are low because on first row we set leftmost digit to 1.

zooming back out, after all 64 bits, you can see the "2" of the next row.

You can see that this time, second bit is high, while the other bits are low.

Subsequent rows are similar and on row 5, you can see the 0xFF as last 8 bits being shifted out.

I wonder how many people read this.  Oh well, it was rewarding to see the bits set in a #MicroPython array refreshed by an independent timer so we're free to implement the snake without worrying about updating the display.

Shift register code to do this test is on github.

Discussions

Gerben wrote 08/15/2019 at 15:51 point

I too like the independent timer for display updating. I use it all the time. The main code just sets which leds need to be on, and the timer does the updating.

I tend to the the latching at the beginning of the timer interrupt, so the timing is always exactly the same. (Since your code doesn't have any if-statement is always takes the same amount of timer, so in your case, there's no need for that.)

  Are you sure? yes | no

Hari Wiguna wrote 08/20/2019 at 01:44 point

Latching at the beginning of the interrupt for consistent refresh is a great idea! Thanks Gerben!

  Are you sure? yes | no