News:

Let's find out together what makes a PIC Tick!

Main Menu

Matrix 8x8 proteus simulation

Started by Pepe, Aug 28, 2022, 01:11 AM

Previous topic - Next topic

John Lawton

Thanks Atomix, amazingly cheap. I'll have to think of an application for them...

John

Pepe

#22
I hope you find it useful, after a few hours of work. Vertical scrolling is added

joesaliba

@Pepe you are best for code for displays.

I saw this library for the MAX7219 for another kind of MCU's and is amazing: - https://majicdesigns.github.io/MD_MAX72XX/page_parola.html

Joe

Maxi

#24
Quote from: Pepe on Nov 21, 2022, 09:04 PMI hope you find it useful, after a few hours of work. Vertical scrolling is added


@Pepe thank you very much
you work for this lot of time.

but have a simple and funny problem now
numbers show mirroring (inverse)

edit:
pepe, can we change this? have any software like font editor?

pepe1.jpg

Pepe

Which library do I use, to correct it, since I don't have hardware to test.

Maxi

This library show mirroring pepe

Symbol max7219_reg_noop        0x00
Symbol max7219_reg_digit0      0x01
Symbol max7219_reg_digit1      0x02
Symbol max7219_reg_digit2      0x03
Symbol max7219_reg_digit3      0x04
Symbol max7219_reg_digit4      0x05
Symbol max7219_reg_digit5      0x06
Symbol max7219_reg_digit6      0x07
Symbol max7219_reg_digit7      0x08
Symbol max7219_reg_decodeMode  0x09
Symbol max7219_reg_intensity   0x0a
Symbol max7219_reg_scanLimit   0x0b
Symbol max7219_reg_shutdown    0x0c
Symbol max7219_reg_displayTest 0x0f

Dim buffer[8] As Byte
Dim buff[8] As Byte
Dim row As Byte

GoTo main:

Proc init()

 High clk

 setCommand(max7219_reg_scanLimit, 0x07)     
 setCommand(max7219_reg_decodeMode, 0x00)  ' using an led matrix (not digits)
 setCommand(max7219_reg_shutdown, 0x01)    ' not in shutdown mode
 setCommand(max7219_reg_displayTest, 0x00) ' no display test
   
 Clear_Disp() ' empty registers, turn all LEDs off
                    
 setIntensity(0x0f)   ' the first 0x0f is the value you can set
EndProc

Proc setIntensity(intensity As Byte)
    setCommand(max7219_reg_intensity, intensity)
EndProc

Proc Clear_Disp()
Dim ix As Byte
 For ix = 0 To 7
  buffer[ix] = 0
  buff[ix] = 0
  spiTransfer(0, ix+1,0)
  Next 
EndProc


Proc setCommand(command As Byte, value As Byte)
  spiTransfer(0, command,value)
EndProc

Proc spiTransfer(addr As Byte,opcode As Byte,dat As Byte)
    'Create an array with the data To shift out
Dim offset As Byte = addr * 2
Dim spidata[2] As Byte
Dim it As Byte
    Clear spidata
    'put our Device data into the array
    spidata[offset+1] = opcode
    spidata[offset] = dat
    'Enable the Line
    Low cs
    'Now shift out the data
    For it = 2 To 1 Step -1
       SHOut dout,clk,MsbFirst,[spidata[it-1]]
    Next   
    'latch the data onto the display
    High cs
EndProc

Proc up(num As Byte,time As Word)
Dim ix As Byte
Dim iy As Byte

 If num < 9 Then

  For iy = 0 To 7

    For ix = 0 To 6    
     buffer[ix]=buffer[ix+1]
    Next
   
    buffer[7]= CRead numbers + num * 8 + 8 + iy
 
    For ix = 0 To 7
     setCol(ix,buffer[ix])
    Next
   
    DelayMS time

  Next

 End If
EndProc

Proc dwn(num As Byte,time As Word)
Dim ix As Byte
Dim iy As Byte
 If num > 0  Then
  For iy = 0 To 7
    For ix = 7 To 1 Step -1   
     buffer[ix]=buffer[ix-1]
    Next
    buffer[0]= CRead numbers + num * 8 - 1 - iy
    For ix = 0 To 7
     setCol(ix,buffer[ix])
    Next
    DelayMS time
  Next
 End If  

EndProc

Proc setCol(col As Byte,value As Byte)
Dim va As Bit
    For row = 0 To 7    
     Ror value
     va = STATUS.0
     setpoint(col,row,va)
    Next
EndProc


Proc setpoint(column As Byte,row As Byte,state As Bit)
Dim va As Byte
    Va = 1 << column
    If state = 0 Then
                      buff[row]=buff[row] & ~Va
                 Else
                      buff[row]=buff[row] | Va
    End If
    spiTransfer(0, row + 1,buff[row])
EndProc

Proc display(time As Word)
Dim ix As Byte
 For ix = 0 To 7
    setCol(ix,buffer[ix])
 Next
 DelayMS time

EndProc


Proc Print_Num(num As Byte)
Dim bFontcol As Byte

'
' Display a line of pixels from the character
'                  
     
     For bFontcol = 0 To 7
     buffer[bFontcol] = CRead numbers + num*8 + bFontcol
     Next

EndProc

numbers:
CData  $00, $3E, $51, $49, $45, $3E, $00, $00    '0
CData  $00, $00, $42, $7F, $40, $00, $00, $00    '1
CData  $00, $42, $61, $51, $49, $46, $00, $00    '2
CData  $00, $21, $41, $45, $4B, $31, $00, $00    '3
CData  $00, $18, $14, $12, $7F, $10, $00, $00    '4
CData  $00, $27, $45, $45, $45, $39, $00, $00    '5
CData  $00, $3C, $4A, $49, $49, $30, $00, $00    '6
CData  $00, $01, $71, $09, $05, $03, $00, $00    '7
CData  $00, $36, $49, $49, $49, $36, $00, $00    '8
CData  $00, $06, $49, $49, $49, $3E, $00, $00    '9

main:

Pepe

Try it now

Maxi


Oskar-svr

#29
Hello friend Metro, I leave you this program that generates the code for characters, I hope it works for you, greetingsCodeGraphics V2.0.zip

Pepe

Added view characters

rick.curl

Quote from: Oskar-svr on Nov 22, 2022, 04:47 PMHello friend Metro, I leave you this program that generates the code for characters, I hope it works for you, greetingsCodeGraphics V2.0.zip
Hi Oskar- Thanks for uploading this.  I tried to download it, but my computer tells me the zip file is invalid and cannot be opened.
Has anyone else successfully downloaded it?

-Rick

midali

I downloaded it, all are perfect . I think that you have zip exe out of date .

Oskar-svr

#33
The CodeGraphics.7z and CodeGraphics.7z file I hope there is no problem

Also here is a link of another program
http://www.mediafire.com/download/oksuiu05u5okvg1/cgram_picture.rar

JohnB

I purchased a YOUMILE MAX7219 board comprising 4 8x8 matrix displays from amazon.  Using @Pepe's libraries I get the characters rotated anticlockwise by 90 degrees and appearing in reverse order. i.e. the Left hand character is appearing on the far right display.

Do I have to create a new font set or is it possible to rotate them in code?

I have attached a cut down version of the library I am using as I only need a static display.
JohnB

Pepe

#35
probe this librarys

JohnB

I don't see any examples of rotated text, lots of shifting and scrolling no text rotated but I will take a further look.
JohnB

Pepe

Could you show a video of how the text appears on the screen since I do not have the same

JohnB

This what I am getting.  It should be showing 19.9 horizontally.  It's as if the matrix columns and rows have been reversed.
JohnB

Yasin

It's as if the assembly of the panels needs to rotate 90° to the left.  ;D