PDA

View Full Version : weird problem with dot matrix and shift register



Ahmadabuomar
- 6th November 2010, 14:39
Hi everyone,

I m trying to drive 8x8 dot matrix and i m facing a weird problem.

when i try to display simple pattern like this
4917

i got

4918

if you notice, the third and eight rows is supposed to be OFF but they are not. instead, they are ON with a little brightness than the second and the seventh ( ON rows )

i tried to figure out whats the problem. is there any reason that the shift register used to sink column currents isnt able to change its state instantly from logic 1 to logic 0 ? is there some capacitance related to its latch function ?

** i used hef4094 to sink columns current and it receives its data serially from PIC16f84
** i used 8 transistors to source current to rows. they are connected to portb


this is the code i used



INCLUDE "MODEDEFS.BAS"
TRISB = 0
TRISA = 0

SYMBOL STRB = PORTA.0
SYMBOL DAT = PORTA.1
SYMBOL CLK = PORTA.2
SYMBOL EN = PORTA.3
TEMP VAR BYTE
CNTR1 VAR BYTE
CNTR2 VAR BYTE
COL VAR BYTE
ROW VAR BYTE
COLVAR VAR BYTE[8]
ROWVAR VAR BYTE[8]
PORTB = 0
PORTA = 0
CNTR1 = 0
CNTR2 = 0
EN = 1

start:
COLVAR[0] = %11000000:COLVAR[1]=%11000000:COLVAR[2]=0:COLVAR[3]=0
COLVAR[4] = 0:COLVAR[5] = 0:COLVAR[6] = %11000000:COLVAR[7] = 0

MAIN:

FOR CNTR2 = 0 TO 100
PORTB = 1
FOR CNTR1 = 0 TO 7
STRB = 0
COL = COLVAR[CNTR1]^255
SHIFTOUT DAT,CLK,0,[COL]
SHIFTOUT DAT,CLK,0,[COL]
STRB = 1

PAUSE 2
PORTB = PORTB *2

NEXT CNTR1
NEXT CNTR2
'FOR CNTR1 = 0 TO 7
'COLVAR[CNTR1] = COLVAR[CNTR1]<<1
'NEXT CNTR1

GOTO MAIN

Ahmadabuomar
- 6th November 2010, 14:51
to summerize the problem here is what is happening

* i m loading column data to shift register then latch it
* i m scanning the rows each for 1 ms

* when moving from a row that has a pattern e.g. (11000000) to the next row with
pattern ( 00 00 00 00 ) , the bits that were at logic 1 in the previous state dont turn off to logic zero!! instead they are in intermediate state ( i.e. maybe 2.5 volts instead of zero)
so they still ON but with little brightness

this problem happens whenever a bit is turned of in the next scan ( i.e. whenever a bit that was 1 turned to be 0 in the next row)

thats weird.

Darrel Taylor
- 6th November 2010, 16:42
I think you just need to "Blank" the rows before changing the Column data, then turn the next row on.

Try it like this ...

FOR CNTR2 = 0 TO 100
FOR CNTR1 = 0 TO 7
STRB = 0
COL = COLVAR[CNTR1]^255
SHIFTOUT DAT,CLK,0,[COL]
PORTB = 0 ; blank all Rows
STRB = 1 ; latch the data
PORTB = DCD CNTR1 ; turn on next Row

PAUSE 2
NEXT CNTR1
NEXT CNTR2

Ahmadabuomar
- 6th November 2010, 17:13
Darrel,

thx alot for helping, it worked really well.

i always wished to thank you in person. cuz from 3 years i enter this forum as a visitor and i always see ur post. you always find the solution. thx much Darrel.

still i have a problem i didnt mention. the first row always doesnt give full brightness when it is on. i suppose this relates to the previous problem. i will try to work it out.

thx again Darrel.

BW

Darrel Taylor
- 6th November 2010, 17:40
Thanks Ahmadabuomar, and your welcome.

First row's dimmer than the others ... ok.
Let's try moving the "blanking", so that all the rows are ON the same amount of time.
It should actually dim the other 7 rows to what the first one was.


FOR CNTR2 = 0 TO 100
FOR CNTR1 = 0 TO 7
STRB = 0
COL = COLVAR[CNTR1]^255
SHIFTOUT DAT,CLK,0,[COL]

STRB = 1 ; latch the data
PORTB = DCD CNTR1 ; turn on the Row
PAUSE 2 ; LED ON time
PORTB = 0 ; blank all Rows

NEXT CNTR1
NEXT CNTR2

Ahmadabuomar
- 6th November 2010, 19:00
Hi Darrel,

in fact, row 1 problem was not related to software!! after i tried your last code. i found nothing changed.

I then checked all npn transistors used in rows. i found the transistor on portb.0 is not working properly !! i changed the transistor and the problem was solved.

all portb transistors were bc337 25 npn transistors except portb.0 that was bc337 40

i dont know if 40 is different than 25 !! but i think the transistor itself is not working

thx Darrel for your help

BW