Each row of the matrix contains 8 LED's, which can just as easily be the 8 LED's of a 7-segment-plus-decimal-point display.that's what I did before asking, code examples are for led matrix and I did not see examples for 7-segment!
Sub Process_Globals
Public ClockPin As Pin
Public DataPin As Pin
Public LoadPin As Pin
End Sub
Private Sub AppStart
ClockPin.Initialize(8, ClockPin.MODE_OUTPUT)
DataPin.Initialize(10, DataPin.MODE_OUTPUT)
LoadPin.Initialize(9, LoadPin.MODE_OUTPUT)
End Sub
Agreed, but the driver chip takes care of all the background refresh, all you need to do is give it the bit pattern once. No timers or background CPU drain. Via 3 pins, rather than 11.A simple 7seg led driver is easy enough to create with a few transistors and resistors...
Still, you only need 7 (a to f) output pins plus 1 per display in pull down mode. This way no need for drivers
Sub SendByte(B as Byte)
Dim BitMask As Int = 0x01 'start at bit 0, shift each time around loop, to get data bits one-by-one
For BitNumber = 0 to 7
If Bit.And(B, BitMask) <> 0 Then
DataPin.DigitalWrite(True) 'bit is 1
Else
DataPin.DigitalWrite(False) 'bit is 0
End If
Sleep(1)
'cycle clock pin low to move bits in shift register(s) along by 1 bit
ClockPin.DigitalWrite(False)
Sleep(1)
ClockPin.DigitalWrite(True)
Sleep(1)
BitMask = BitMask + BitMask 'shift left for next bit
Next
End Sub
Sub SendBytes(B() As Byte)
For I = 0 to B.Length - 1
SendByte(B(I))
Next
'cycle load pin low to latch in shift register data
LoadPin.DigitalWrite(False)
Sleep(1)
LoadPin.DigitalWrite(True)
Sleep(1)
End Sub
Private Sub AppStart
ClockPin.Initialize(8, ClockPin.MODE_OUTPUT)
DataPin.Initialize(10, DataPin.MODE_OUTPUT)
LoadPin.Initialize(9, LoadPin.MODE_OUTPUT)
ClockPin.DigitalWrite(True) 'idle state
LoadPin.DigitalWrite(True) 'idle state
For I = 0x10 to 0xF0
SendBytes(Array As Byte(0xAA, I, I, 0x55)) 'test pattern - will look random, but if it is changing each second, then we are on the right track :-)
Sleep(1000)
Next
End Sub
This is what I was aiming for. And you might be right about the starting point; I just assumed that because the OP used the phrase "multiplexed common cathode" that they already understood the principals behind it, but... perhaps not.It would be a great learning experience to the OP to start from basic, and then advance
or should that be afternoon shift, in France?hand the baton over to the dayshift
Do you actually have a MAX7219 wired up toI want to driver 4 multiplexed com. cathode 7-segment display with MAX7219
Sounds good - Newton said something about standing on ye sholders of giants, ie not reinventing the wheel, so if rLedControl works, that's an extra hour or two you can spend at the pub insteadI think rLedControl 'setdigit' and 'setchar' methods will do the job.