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.
Fill the pattern.

mikroBasic PRO PIC Code.


Code - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
program matrix
 
' Declarations section 
dim i as byte        ' inner loop
dim j as byte        ' outer loop
 
const pattern as byte[30] = (0x3e,0x41,0x41,0x41,0x3e,0x00,) 'letter o for scrolling pattern
 
Sub procedure Reset_Col()
   porta.f1 = 1             'reset 4017 when i>5
   porta.f1 = 0
end Sub
 
Sub procedure advance_Col()
   porta.f0 = 1                 '4017 clock advance
   porta.f0 = 0
end Sub
 
main:
'   Main program
   TRISA = 0
   TRISB = 0
   PORTB = 0
   
   WHILE True
 
      for j = 0 to 4      'patterns for scrolling
 
         Reset_col()           'reset 4017 t0 q0
 
      for i = 0 to 5       '6 bytes per pattern
         portb = 0      'clear matrix display for flickr and previous pattern
         PORTB= pattern[jx6+i]  'load pattern to portb based on (i & j)'s values
 
         advance_Col()      'advance 4017 clock
 
      next i             'next value of i
      next j                 'next pattern
 
   WEND
   
end.

 
Oops, sorry there was a typo...:-?

[j x 6 + i] should read as [j * 6 + i]

Allen
 
Last edited:

Thanks @allen and @majik. I was offline yesterday.i will test the code and give a feedback.thanks
 

I have compiled the code. It is not working.
 

How do you arive at the formula [jx6+i]? Thanks
 

How do you arive at the formula [jx6+i]? Thanks

Code:
[code 1]
[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

if mikro basic supports 2-dimension arrays, then it becomes

Code:
[code 2]

pattern[j,i]= $3e,$41,$41,$41,$3e,$00 //here j=0,i=0-5
pattern[j,i]= $41,$41,$41,$3e,$00,$3e //here j=1,i=0-5
pattern[j,i]= $41,$41,$3e,$00,$3e,$41 //here j=2,i=0-5
pattern[j,i]= $41,$3e,$00,$3e,$41,$41 //here j=3,i=0-5
pattern[j,i]= $3e,$00,$3e,$41,$41,$41 //here j=4,i=0-5

pattern[0,0..5]=  $3e,$41,$41,$41,$3e,$00
pattern[1,0..5]=  $41,$41,$41,$3e,$00,$3e
pattern[2,0..5]=  $41,$41,$3e,$00,$3e,$41
pattern[3,0..5]=  $41,$3e,$00,$3e,$41,$41
pattern[4,0..5]=  $3e,$00,$3e,$41,$41,$41

Then your program would be

Code:
WHILE True
 
      for j = 0 to 4      'patterns for scrolling
 
         Reset_col()           'reset 4017 t0 q0
 
      for i = 0 to 5       '6 bytes per pattern
         portb = 0      
         PORTB= pattern[j , i] 
 
         advance_Col()      'advance 4017 clock
 
      next i             'next value of i
      next j                 'next pattern
 
   WEND

If you substitute [j * 6 + i] into the 2-D array you'll get the one-dimension array supported by your BASIC compiler in [code 1].

Allen
 
Thanks allen. I will try the code again. Thanks for your time
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top