Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

ghosting in column scanned led array

Status
Not open for further replies.

justDIY

Active Member
I have a 5x7 array that I'm scanning (strobing?) one column at a time (5 columns, 7 rows). Unless I scan the columns very slowly, I have adjacent leds also illuminating. At moderate speed, such as 1ms per column, the adjacent leds (that should be completely off) are dimly visible. At 400uS per column, they're almost as bright as the leds that should be on.

You can see the schematic and board layout here:
**broken link removed**
https://projects.dimension-x.net/archives/101

I'm trying out a new high level language "mikrobasic". so far I like it a lot better than proton, but it takes a little getting used to.

Here is the code with which I update the led display:

ledrow is a symbol for porta, ledcol is a symbol for portb, mydelay is current defined as "1" (milliseconds)
Code:
sub procedure DisplayChar()
        X = 0
        While X < 5
           LEDROW = 255 XOR MyChar[x]     ' load a row with data
           MyCol = 1 << X                 ' select a column
           LEDCOL = 255 XOR MyCol         ' light up the column
           Delay_MS(MyDelay)
           Inc(X)                         ' next column
        Wend
end sub

the pic is a 16f737, running at 8mhz on the internal osc.

the matrix is anode column, cathode row. the pic sinks current, and the anodes are driven by five p-ch mosfets

any ideas on stopping the ghosting, or at least what's causing it?
 
It's your code. You are changing Row data before setting up Column data and thus ghosting data between columns. You need to do something like this:

Code:
sub procedure DisplayChar()
        X = 0
        While X < 5
           LEDCOL = OFF 'Turn off ALL columns
           Delay_MS(MaybeDelayLongEnoughToAllowLEDCOL_toActuallyTurnOff)
           LEDROW = 255 XOR MyChar[x]     ' load a row with data
           MyCol = 1 << X                 ' select a column
           LEDCOL = 255 XOR MyCol         ' light up the column
           Delay_MS(MyDelay)
           Inc(X)                         ' next column
        Wend
end sub
 
kchriste said:
It's your code. You are changing Row data before setting up Column data and thus ghosting data between columns.


Thanks kchriste, that did the trick! I used the Inc function (which compiles to 2 or 3 assembler instructions) to provide enough delay for the transistors to actually shut down.

For future reference, here is the revised code:
Code:
sub procedure DisplayChar()
        X = 0
        While X < 5
           LEDROW = 255 XOR MyChar[x]     ' load a row with data
           MyCol = 1 << X                 ' select a column
           LEDCOL = 255 XOR MyCol         ' light up the column
           Delay_US(200)                  ' light column for 200 microseconds
           LEDCOL = 255                   ' prep for next dataset, shut down column drivers
           Inc(X)                         ' next column
        Wend
end sub
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top