Hi all,
I have a feeling that I'm being incredibly dumb, but I am playing with multiplexing with one of these and I think I'm powering it wrong, but it's working
I understand Multiplexing and I know that others have created programs and posted schematics and code for this display but I want to learn rather than just copy someone elses code.
I've boiled down the code to a simple sequence which counts the rightmost digit from 0 through to 9 and round again on a 1 second interval. This works fine, but let me explain what is confusing me.
The display is a common anode, so for each digit I must provide a v+ on the common anode and set the cathodes in the pattern I want. As I'm only currently playing with one digit (c.3) I don't need to cycle through the other digits currently.
the b port pins are connected to the lettered cathodes of the display, and c.0 - c.3 are the common anodes from right to left (as the symbols show) with 470ohm resistors.
However, as I need to set the cathodes to the particular display pattern I require, I am using 'let pinsB = %00000110' etc.
However looking at it now, by setting each bit to 1, aren't I setting that pin high?
I know I'm using multiple IF statements here, but I wanted to boil it down to code I understood perfectly, because I had other strange things happen with select...case at 3am last night
Surely as I'm actually setting the bits I want lit to 1, aren't I setting that high, when I should be setting it low as it is the cathode?
Many thanks in advance,
Morrolan
I have a feeling that I'm being incredibly dumb, but I am playing with multiplexing with one of these and I think I'm powering it wrong, but it's working
I understand Multiplexing and I know that others have created programs and posted schematics and code for this display but I want to learn rather than just copy someone elses code.
I've boiled down the code to a simple sequence which counts the rightmost digit from 0 through to 9 and round again on a 1 second interval. This works fine, but let me explain what is confusing me.
The display is a common anode, so for each digit I must provide a v+ on the common anode and set the cathodes in the pattern I want. As I'm only currently playing with one digit (c.3) I don't need to cycle through the other digits currently.
the b port pins are connected to the lettered cathodes of the display, and c.0 - c.3 are the common anodes from right to left (as the symbols show) with 470ohm resistors.
However, as I need to set the cathodes to the particular display pattern I require, I am using 'let pinsB = %00000110' etc.
However looking at it now, by setting each bit to 1, aren't I setting that pin high?
I know I'm using multiple IF statements here, but I wanted to boil it down to code I understood perfectly, because I had other strange things happen with select...case at 3am last night
Code:
#picaxe 28x2
#no_data
#no_table
let dirsB = %11111111
let pinsB = %00000000
let dirsC = %00111000
let adcsetup = 0
' symbols
symbol digA = b.0
symbol digB = b.1
symbol digC = b.2
symbol digD = b.3
symbol digE = b.4
symbol digF = b.5
symbol digG = b.6
symbol digColon = c.7
symbol digDecimal = c.6
symbol dig1Cathode = c.0
symbol dig2Cathode = c.1
symbol dig3Cathode = c.2
symbol dig4Cathode = c.3
symbol digValue = b0
high digColon
low digDecimal
digValue = 0
do
if digValue = 0 then
let pinsB = %00111111
elseif digValue = 1 then
let pinsB = %00000110
elseif digValue = 2 then
let pinsB = %01011011
elseif digValue = 3 then
let pinsB = %01001111
elseif digValue = 4 then
let pinsB = %01100110
elseif digValue = 5 then
let pinsB = %01101101
elseif digValue = 6 then
let pinsB = %01111101
elseif digValue = 7 then
let pinsB = %00000111
elseif digValue = 8 then
let pinsB = %011111111
elseif digValue = 9 then
let pinsB = %01100111
endif
digValue = digValue + 1
if digValue 9 then
digValue = 0
endif
pause 1000
loop
end
Many thanks in advance,
Morrolan
Last edited: