7 seg

28 views
Skip to first unread message

Paul

unread,
Dec 15, 2015, 10:49:06 AM12/15/15
to lightsh...@googlegroups.com
saw a guy on youtube who was building large 7 segment displays. I thought "OOOOOH" I need to do that. so I think that will be my next project. I was mainly thinking giant 7 segment displays in the yard as a count-down for the start of a show or in-between songs. 
I don't want to dedicate my large SSRs to this so will likely go with mosfets (or whatever I have) to run it.

to that end have any of you seen a method with the GPIO on the Pi to bit shift the IO?
Way back when I was building things with SX microcontrollers and you could take a byte and mask the values and then shift it to the IO register. Would be so much easier and faster then having to control single pins for on/off.
It also allows you to predefine values for a display and all you have to do is write them.
For example a 7-segment display:

------1------
|            |
0           3
|            |
-----2------
|            |
4            5
|            |
------6-----

so if I wanted to make a 0, I need to turn on 0,1,3,4,5,6, so I can first predefine a 0 as 0x7B and then write a 7B to output to turn those pins on.
an 8 is all pins on, so 01111111 = 0x7F  making a 1 is just 3 and 5 on so: 00101000 = 0x28 and so on.
If something like this is possible, it makes it really easy to change the display as you can use bitwise operators to shift right and left. At the same time, I've not seen anything about this in the dox for wiringpi so it may not be possible

cheers!
Paul

Tom Enos

unread,
Dec 18, 2015, 12:53:03 AM12/18/15
to LightShow Pi Developers
if you use the hardware_controller it is really simple

 
 
import hardware_controller as hc
cm = hc.cm

d = {0:[0,1,3,4,5,6], 
      1:[3,5], 
      2:[1,2,3,4,6], 
      3:[1,2,3,5,6],
      4:[0,2,3,5],
      5:[0,1,2,5,6],
      6:[0,1,2,4,5,6],
      7:[1,3,5],
      8:[0,1,2,3,4,5,6],
      9:[0,1,2,3,5,6]}

def num_seg(digit):
    for pin in range(len(cm.hardware.gpio_len)):
        hc.set_light(pin, 0, int(pin in d[digit]))

Kevin Lustic

unread,
Jan 4, 2016, 6:53:35 PM1/4/16
to LightShow Pi Developers
I see there's some sort of shift functionality in wiringpi? I haven't checked whether this is implemented in the Python library...
http://wiringpi.com/reference/shift-library/
Reply all
Reply to author
Forward
0 new messages