Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Problem with led dot matrix display

Status
Not open for further replies.

shegzzyy

Full Member level 2
Full Member level 2
Joined
Apr 28, 2013
Messages
132
Helped
12
Reputation
24
Reaction score
12
Trophy points
1,298
Activity points
2,016
I am new to basic programming. I am using mikrobasic 7.2. I am having problem displaying letters on a 5x8 (8x8)matrix display in proteus 7.9. I have attched my code and dsn files.
 

Attachments

  • matrix_5x7.rar
    92.2 KB · Views: 146

I used colum scanning using 4017 to scan the matrix display but the letter is not showing properly.please anybody to help me solve the problem.thanks
 

Post your code . Let me see where the Error comes from.
 

My code is up there in the rar file of my first post
 

What Compiler are you using ? PIC Basic Pro or mikroBasic old version ?

Edit: It seems you are using mikroBasic old version but you have not posted the .bas file.
 

@milan.rajik. I am using the old mikrobasic v7.2. I posted the .pbas and the .pbp file.they are all inside the rar file.thanks for your time
 

I can't solve your problem because I don't understand your requirement but I can write a code which displays say letter A on 8X8 matrix or 5X7 matrix.

Say you want to display A on 8X8 matrix then you will have 8 values for rows and cols has to be scanned. You place row1 data and then turn On and OFF all the cols once. Then you place row 2 data and then turn ON OFF all cols. Like this you do for all rows and then repeat the whole process. If you have any other code other than matrix display then you have to use timer interrupt for the matrix display code.
 

I checked your hardware wiring and I think it should work. I load the .hex file and I am getting a vertical line of 5 dots in the centre of the display. I try to open the PICbasic files but I dont have mikrobasic compiler so it cant be opened. I have pbp but the program listing doesnt help at all, all the procedure details are not shown.

I also tried to check the .lst and .asm but it was tedious. I put a scope on the trace and the timing looks OK. The time to display the digit "0" takes about 40mS on the PIC running at 1 MHz. So it should display 25 times per second. So I think the problem must be in the mikrobasic source code.

Please post the source in "code tags" so those that dont have the basic compiler can help you....;-)

Allen
 

Attachments

  • matrix.PNG
    matrix.PNG
    45.2 KB · Views: 157
  • matrix_scope.PNG
    matrix_scope.PNG
    102.3 KB · Views: 121
Last edited:

I checked your hardware wiring and I think it should work. I load the .hex file and I am getting a vertical line of 5 dots in the centre of the display. I try to open the PICbasic files but I dont have mikrobasic compiler so it cant be opened. I have pbp but the program listing doesnt help at all, all the procedure details are not shown.

I also tried to check the .lst and .asm but it was tedious. I put a scope on the trace and the timing looks OK. The time to display the digit "0" takes about 40mS on the PIC running at 1 MHz. So it should display 25 times per second. So I think the problem must be in the mikrobasic source code.

Please post the source in "code tags" so those that dont have the basic compiler can help you....;-)

Allen

thanks very much.the source code is in the .pbas file.you can open it with notepad or any text editor. I would have loved to post the code directly but internet connection is very slow.thanks
 

Here is the source code. Thanks
 

Attachments

  • MATRIX_PBAS.zip
    650 bytes · Views: 108

Not sure what's wrong with your program. But I used your program and rewrote it in PBP and it works. May be you can refer to my program and find out what's wrong with yours. I used 16F88 instead of 16F84.

Code:
'INCLUDE  "16F88.INC"
'device  pic16F88, xt_osc, wdt_on, mclr_on, lvp_off, protect_off

DEFINE  OSC 4   ;4 MHz

Segments    Var  PORTB
adv_clock   VAR  PORTA.0
reset_clock VAR  PORTA.1
i           VAR  Byte

   TRISB = $00         ' Set segment pins to output
   TRISA = $e0         ' Set digit pins to output
   CMCON = $07
   ANSEL = $00		   'ALL RA DIGITAL
   
mainloop:
  gosub reset_clk     ' Reset 4017 to Q0
  For i = 0 To 4      ' Loop through 4 digits
   ' Convert binary number to segments for LED
     Lookup i, [$3e, $41, $41, $41, $3e], Segments
     gosub adv_clk     ' step column
   Next i              ' Do next column

   GoTo mainloop       ' Do it forever

reset_clk:
    high reset_clock 
    low reset_clock
    return

adv_clk:
    high adv_clock
    low adv_clock
    return
              
   END

Allen

P/S You might put the "delay_ms(2)" after "advance()" and see if it works.
 

Attachments

  • matrix_2.PNG
    matrix_2.PNG
    44 KB · Views: 131
Last edited:
I finally got it working by removing the delay in the for loop and leaving out q0 pin of 4017. Thanks to everyone. Here is the final code.
 

Attachments

  • matrix_5x7_final.rar
    26.7 KB · Views: 123

I'm glad you finally got it.

Allen

thanks allen. But how can i scroll a message on it? I need example in mikrobasic because i couldnt find any on the net. Thanks in advance.
 

Hi,

To be able to scroll you have to create an array with 30 elements like this:

Code:
[0..5]=  $3e,$41,$41,41,$3e,$00
[6..11]= $41,$41,$41,$3e,$00,$3e
[12..17]=$41,$41,$3e,$00,$3e,$41
[18..23]=$41,$3e,$00,$3e,$41,$41
[24..29]=$3e,$00,$3e,$41,$41,$41

The extra $00 is used as a blank column, so during scrolling the effect is clearer.

Set up 2 for/next loops. The inner loop would display 6 elements instead of 5 just like your original program. The outer loop of 5 would point to the 5 patterns above.

Let's say the outer loop is "For I" and inner loop is "For J", then the index for the array would be "I x 6 + J".

The 5 patterns would be displayed in turn to give the scrolling effect.

No change in hardware is needed.

Allen
 
Last edited:

Hi,

To be able to scroll you have to create an array with 30 elements like this:

Code:
[0..5]=  $3e,$41,$41,41,$3e,$00
[6..11]= $41,$41,$41,$3e,$00,$3e
[12..17]=$41,$41,$3e,$00,$3e,$41
[18..23]=$41,$3e,$00,$3e,$41,$41
[24..29]=$3e,$00,$3e,$41,$41,$41

The extra $00 is used as a blank column, so during scrolling the effect is clearer.

Set up 2 for/next loops. The inner loop would display 6 elements instead of 5 just like your original program. The outer loop of 5 would point to the 5 patterns above.

Let's say the outer loop is "For I" and inner loop is "For J", then the index for the array would be "I x 6 + J".

The 5 patterns would be displayed in turn to give the scrolling effect.

No change in hardware is needed.

Allen

Can you help me with some code snippet? I dont understand it. Thanks.
 

You may try this. But I don't have mikrobasic compiler to try it out on proteus.

Do some fine tuning yourself...

Code:
[COLOR=#ff0000][code  basic][/COLOR]
program MATRIX_5X7_3   'disp o on 8x8 dot matrix display
                        'colum scanning using 4017
                        'porta,0 is connected to 4017 clock pin
                        'porta,1 is connected to the 4017 reset pin
dim i as byte        ' inner loop
[COLOR=#ff0000]dim j as byte        ' outer loop[/COLOR] 

const pattern as [COLOR=#ff0000]byte[30] = (0x3e,0x41,0x41,0x41,0x3e,0x00,.........)[/COLOR] 'letter o for scrolling pattern

Sub procedure Reset_Col()

   porta.1 = 1             'reset 4017 when i>5
   porta.1 = 0
   end Sub

Sub procedure advance_Col()
   porta.0=1                 '4017 clock advance
   porta.0=0
   end Sub

main:

   TRISA    =0
   TRISB    =0
   PORTB    =0

while true

[COLOR=#ff0000]for j=0 to 4      'patterns for scrolling
[/COLOR]
   Reset_col()           'reset 4017 t0 q0

for i=0 to [COLOR=#ff0000]5       '6 bytes per pattern[/COLOR]
   portb =0      'clear matrix display for flickr and previous pattern
  [COLOR=#ff0000] PORTB= pattern[jx6+i]  'load pattern to portb based on (i & j)'s values[/COLOR]

   advance_Col()      'advance 4017 clock

next i             'next value of i
[COLOR=#ff0000]next j                 'next pattern[/COLOR]

wend
end.

Allen

- - - Updated - - -

Since you also know PIC assembly. I think you can get more ideas from these pages here.

**broken link removed**

It would be easy to convert them to basic if you take some efforts.

Allen
 
Last edited:

    V

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top