MAX7219 I 8X8 LED DISPLAY

Rasprava o PIC mikrokontrolerima, PIC projekti i drugo vezano za PIC-eve...

Moderators: pedja089, stojke369, [eDo], trax

febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: MAX7219 I 8X8 LED DISPLAY

Post by febo26 »

Pedja da li si mislio na ovo: na ovaj nacin mogu kontrolirati pojedinu diodu na displeju ( to je upis za jedan max7219 chip)

prikaz displeja:

ako napisem da je Y=1 i X=%00000001 onda mi svijetli dolje desno prva dioda

87654321

00000000 ----255
00000000
00000000
00000000
00000000
00000000
00000000
00000001 -----1
----------------------------------------------------------------------------------------------------
ako napisem da je Y=1 i X=%11111111 onda mi svijetli cijeli prvi desni red

87654321

00000001 ----255
00000001
00000001
00000001
00000001
00000001
00000001
00000001 -----1
---------------------------------------------------------------------------------------------------
ako napisem da je Y=2 i X=%11111111 onda mi svijetli ova kombinacija
87654321

00000010 ----255
00000010
00000010
00000010
00000010
00000010
00000010
00000010 -----1


primjer koda s kojim to radim

Code: Select all

'****************************************************************
'*  Name    : UNTITLED.BAS                                      *
'*  Author  : ZELJKO FERIC                                      *
'*  Notice  : Copyright (c) 2014 [select VIEW...EDITOR OPTIONS] *
'*          : All Rights Reserved                               *
'*  Date    : 13.10.2014                                        *
'*  Version : 1.0                                               *
'*  Notes   :                                                   *
'*          :                                                   *
'****************************************************************
'PIC16F877A
	
 Define	OSC	4		' Set Xtal Frequency
   TRISA = %00111111    'port a je cijeli ulazni
TRISB = %00000000
TRISC = %00000000
TRISD = %00000000
TRISE = %1111
ADCON1 = 7	   ' PORTA i PORTE su digitalni  ISKLJUCI KOMPARATORE I ANALOGNE ULAZE



include "modedefs.bas"

'-----VARIABLES-----
ADDRESS var word 'variable address for display
DATAREG var word 'variable data register for display
Y VAR BYTE  'okomice
X var BYTE  'sadrzaj okomice


'----- symbolos ------
SYMBOL CLK = PORTB.0
SYMBOL DAT = PORTB.1
SYMBOL LOAD = PORTB.2

'-----PIN SETUPS-----
low dat 'data pin for MAX7219 (1)
low clk 'clock pin for MAX7219 (13)
low load 'load pin for MAX7219 (12)




'-----MAX7219 SETUP-----
ADDRESS = $0C : DATAREG = $01 : gosub MaxWrite ' NO SHUT, NORMAL OPERATION
ADDRESS = $09 : DATAREG = $00 : gosub MaxWrite ' COMBINACION BINARIA, NO DECODE
ADDRESS = $0A : DATAREG = $09 : gosub MaxWrite ' INTENSIDAD DE LEDS 1(MIN) A F(MAX)
ADDRESS = $0B : DATAREG = $07 : gosub MaxWrite ' SCAN LIMIT NUMERO DE DIGITOS
ADDRESS = $0F : DATAREG = $00 : gosub MaxWrite
GOSUB brisi_display

main:
y=1
X=%11111111
ADDRESS = y
DATAREG = x 
GOSUB MAXWRITE
PAUSE 2000
gosub brisi_display
pause 500
goto main




MaxWrite:
shiftout DAT,CLK,MSBFIRST,[ADDRESS,DATAREG] 'Shift out the data to the 'MAX7219 'first the address, then data.
pulsout LOAD,1 'load the data into the MAX7219
return


brisi_display:
for Y = 1 to 8 'write $0F (blank) to all digits
ADDRESS = Y : DATAREG = $00 
gosub MaxWrite
next Y
return
User avatar
pedja089
Administrator sajta
Administrator sajta
Posts: 7877
Joined: 20-02-2007, 14:50
Location: Beočin -Srbija

Re: MAX7219 I 8X8 LED DISPLAY

Post by pedja089 »

Tako nesto...

Code: Select all

Displej var byte[8]
displej[0]=%10101010
displej[1]=%01010101
displej[2]=%10101010
displej[3]=%01010101
displej[4]=%10101010
displej[5]=%01010101
MAIN:
GOSUB brisi_display
PAUSE 1000
GOSUB Prikazi_Niz
PAUSE 1000
GOTO MAIN

Prikazi_Niz:
for Y = 0 to 7 'write $0F (blank) to all digits
ADDRESS = Y+1 : DATAREG = Displej[i]
gosub MaxWrite
next Y
return
Probaj ovaj kod, ako na displeju dobijes sahovsku tablu, onda dalje lako mozemo... Prvo napraviti shiftovanje, pa dodavanje novih karaktera...
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: MAX7219 I 8X8 LED DISPLAY

Post by febo26 »

nece iskompajlirati pokaze gresku u ovom redu

ADDRESS = Y+1 : DATAREG = Displej

Bad array expression

da li fali neka FOR petlja u tvom kodu

Moram ici bebaca zeni pomoc okupati,vracam se za pola sata za komp
User avatar
pedja089
Administrator sajta
Administrator sajta
Posts: 7877
Joined: 20-02-2007, 14:50
Location: Beočin -Srbija

Re: MAX7219 I 8X8 LED DISPLAY

Post by pedja089 »

Nisam pisao ceo kod. Nego sam samo napisao sta bi trebao ubaciti u onaj sto si vec testirao...
Ajd probaj sad sa ovim...

Code: Select all

    Define   OSC   4      ' Set Xtal Frequency
    TRISA = %00111111    'port a je cijeli ulazni
    TRISB = %00000000
    TRISC = %00000000
    TRISD = %00000000
    TRISE = %1111
    ADCON1 = 7      ' PORTA i PORTE su digitalni  ISKLJUCI KOMPARATORE I ANALOGNE ULAZE

    include "modedefs.bas"

    '-----VARIABLES-----
    ADDRESS var word 'variable address for display
    DATAREG var word 'variable data register for display
    Y VAR BYTE  'okomice
    X var BYTE  'sadrzaj okomice

    '----- symbolos ------
    SYMBOL CLK = PORTB.0
    SYMBOL DAT = PORTB.1
    SYMBOL LOAD = PORTB.2

    '-----PIN SETUPS-----
    low dat 'data pin for MAX7219 (1)
    low clk 'clock pin for MAX7219 (13)
    low load 'load pin for MAX7219 (12)

    '-----MAX7219 SETUP-----
    ADDRESS = $0C : DATAREG = $01 : gosub MaxWrite ' NO SHUT, NORMAL OPERATION
    ADDRESS = $09 : DATAREG = $00 : gosub MaxWrite ' COMBINACION BINARIA, NO DECODE
    ADDRESS = $0A : DATAREG = $09 : gosub MaxWrite ' INTENSIDAD DE LEDS 1(MIN) A F(MAX)
    ADDRESS = $0B : DATAREG = $07 : gosub MaxWrite ' SCAN LIMIT NUMERO DE DIGITOS
    ADDRESS = $0F : DATAREG = $00 : gosub MaxWrite
    GOSUB brisi_display

Displej var byte[8]
displej[0]=%10101010
displej[1]=%01010101
displej[2]=%10101010
displej[3]=%01010101
displej[4]=%10101010
displej[5]=%01010101

    main:
 GOSUB brisi_display
PAUSE 1000
GOSUB Prikazi_Niz
PAUSE 1000
    goto main

Prikazi_Niz:
for Y = 0 to 7 'write $0F (blank) to all digits
ADDRESS = Y+1 : DATAREG = Displej[i]
gosub MaxWrite
next Y
return



    MaxWrite:
    shiftout DAT,CLK,MSBFIRST,[ADDRESS,DATAREG] 'Shift out the data to the 'MAX7219 'first the address, then data.
    pulsout LOAD,1 'load the data into the MAX7219
    return


    brisi_display:
    for Y = 1 to 8 'write $0F (blank) to all digits
    ADDRESS = Y : DATAREG = $00
    gosub MaxWrite
    next Y
    return
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: MAX7219 I 8X8 LED DISPLAY

Post by febo26 »

Code: Select all

'****************************************************************
'*  Name    : UNTITLED.BAS                                      *
'*  Author  : ZELJKO FERIC                                      *
'*  Notice  : Copyright (c) 2014 [select VIEW...EDITOR OPTIONS] *
'*          : All Rights Reserved                               *
'*  Date    : 20.10.2014                                        *
'*  Version : 1.0                                               *
'*  Notes   :                                                   *
'*          :                                                   *
'****************************************************************
	 #CONFIG
__config _HS_OSC & _WDT_ON & _PWRTE_ON &_CP_ON  & _BODEN_OFF & _LVP_OFF

#ENDCONFIG
     include "modedefs.bas"
    
    Define	OSC	20		' Set Xtal Frequency
        TRISA = %00111111    'port a je cijeli ulazni
        TRISB = %00000000
        TRISC = %00000000
        TRISD = %00000000
        TRISE = %1111
        ADCON1 = 7      ' PORTA i PORTE su digitalni  ISKLJUCI KOMPARATORE I ANALOGNE ULAZE

       

        '-----VARIABLES-----
        ADDRESS var word 'variable address for display
        DATAREG var word 'variable data register for display
        Y VAR BYTE  'okomice

       
        '----- symbolos ------
        SYMBOL CLK = PORTB.0
        SYMBOL DAT = PORTB.1
        SYMBOL LOAD = PORTB.2

        '-----PIN SETUPS-----
        low dat 'data pin for MAX7219 (1)
        low clk 'clock pin for MAX7219 (13)
        low load 'load pin for MAX7219 (12)

        '-----MAX7219 SETUP-----
        ADDRESS = $0C : DATAREG = $01 : gosub MaxWrite ' NO SHUT, NORMAL OPERATION
        ADDRESS = $09 : DATAREG = $00 : gosub MaxWrite ' COMBINACION BINARIA, NO DECODE
        ADDRESS = $0A : DATAREG = $00 : gosub MaxWrite ' INTENSIDAD DE LEDS 1(MIN) A F(MAX)
        ADDRESS = $0B : DATAREG = $07 : gosub MaxWrite ' SCAN LIMIT NUMERO DE DIGITOS
        ADDRESS = $0F : DATAREG = $00 : gosub MaxWrite
        GOSUB brisi_display




    Displej var byte[8]
    displej[0]=%10101010
    displej[1]=%01010101
    displej[2]=%10101010
    displej[3]=%01010101
    displej[4]=%10101010
    displej[5]=%01010101
    displej[6]=%10101010
    displej[7]=%01010101

        main:
     GOSUB brisi_display
    PAUSE 1000
    GOSUB Prikazi_Niz
    PAUSE 1000
        goto main

    Prikazi_Niz:
    for Y =0 to 7
    ADDRESS = Y+1 
    DATAREG = displej[y]
    gosub MaxWrite
    next Y
    return
    



        MaxWrite:
        shiftout DAT,CLK,MSBFIRST,[ADDRESS,DATAREG] 'Shift out the data to the 'MAX7219 'first the address, then data.
        pulsout LOAD,1 'load the data into the MAX7219
        return


        brisi_display:
        for Y = 1 to 8 'write $0F (blank) to all digits
        ADDRESS = Y : DATAREG = $00
        gosub MaxWrite
        next Y
        return
da bi dobio sahovnicu morao sam nadopisati dva reda u ovoj tabeli
Displej var byte[8]
displej[0]=%10101010
displej[1]=%01010101
displej[2]=%10101010
displej[3]=%01010101
displej[4]=%10101010
displej[5]=%01010101
displej[6]=%10101010
displej[7]=%01010101



i "pokazi niz"prepravljen je u ovaj oblik i sada imam sahovnicu koja se pali i gasi u ritmu jedne sekunde
kako je u main-u duga pauza tako brzo on blica


Prikazi_Niz:
for Y =0 to 7
ADDRESS = Y+1
DATAREG = displej[y]
gosub MaxWrite
next Y
return
User avatar
pedja089
Administrator sajta
Administrator sajta
Posts: 7877
Joined: 20-02-2007, 14:50
Location: Beočin -Srbija

Re: MAX7219 I 8X8 LED DISPLAY

Post by pedja089 »

To je ok sad...
Sledece probaj napraviti ono siftovanje sto sam vec negde pisao.

Code: Select all

PomeriNiz:
For i=0 to 6
Displej[i]=displej[i+1]
next i
Displej[7]=0'Ovo bi trebao biti novi red koji ce da izadje sa desne strane, ali dok ne proradi siftovanje neka ga 0.
Dodaj ovo gore u prethodni kod, i izmeni main u ovo

Code: Select all

        main:
         GOSUB PomeriNiz
         GOSUB Prikazi_Niz
         PAUSE 1000
        goto main
Sada bi se trebala slika pomeriti svake sekunde za 1 red ulevo.
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: MAX7219 I 8X8 LED DISPLAY

Post by febo26 »

radi. slika se pomjera s desne strane na lijevo
User avatar
pedja089
Administrator sajta
Administrator sajta
Posts: 7877
Joined: 20-02-2007, 14:50
Location: Beočin -Srbija

Re: MAX7219 I 8X8 LED DISPLAY

Post by pedja089 »

E sad treba upariti onaj include sa ovim programom i to je to :ohno:
Na kraj onog koda dodaj ovo:

Code: Select all

SendChar:                                      
    SELECT CASE Char                         
    Case 32                   
    	FC(0)=$00:FC(1)=$00:FC(2)=$00:FC(3)=$00:FC(4)=$00 ' // sp
    Case 33                   
    	FC(0)=$00:FC(1)=$00:FC(2)=$2f:FC(3)=$00:FC(4)=$00 ' // !
    Case 34                   
    	FC(0)=$00:FC(1)=$07:FC(2)=$00:FC(3)=$07:FC(4)=$00 ' // " (shown as \ in Lookdown table)
    Case 35                   
    	FC(0)=$14:FC(1)=$7f:FC(2)=$14:FC(3)=$7f:FC(4)=$14 ' // #
    Case 36                   
    	FC(0)=$24:FC(1)=$2a:FC(2)=$7f:FC(3)=$2a:FC(4)=$12 ' // $
    Case 37                   
    	FC(0)=$c4:FC(1)=$c8:FC(2)=$10:FC(3)=$26:FC(4)=$46 ' // %
    Case 38                   
    	FC(0)=$36:FC(1)=$49:FC(2)=$55:FC(3)=$22:FC(4)=$50 ' // &
    Case 39                   
    	FC(0)=$00:FC(1)=$05:FC(2)=$03:FC(3)=$00:FC(4)=$00 ' // '
    Case 40                   
    	FC(0)=$00:FC(1)=$1c:FC(2)=$22:FC(3)=$41:FC(4)=$00 ' // (
    Case 41                   
    	FC(0)=$00:FC(1)=$41:FC(2)=$22:FC(3)=$1c:FC(4)=$00 ' // )
    Case 42                   
    	FC(0)=$14:FC(1)=$08:FC(2)=$3E:FC(3)=$08:FC(4)=$14 ' // *
    Case 43                   
    	FC(0)=$08:FC(1)=$08:FC(2)=$3E:FC(3)=$08:FC(4)=$08 ' // +
    Case 44                   
    	FC(0)=$00:FC(1)=$00:FC(2)=$50:FC(3)=$30:FC(4)=$00 ' // ,
    Case 45                   
    	FC(0)=$10:FC(1)=$10:FC(2)=$10:FC(3)=$10:FC(4)=$10 ' // -
    Case 46                   
    	FC(0)=$00:FC(1)=$60:FC(2)=$60:FC(3)=$00:FC(4)=$00 ' // .
    Case 47                   
    	FC(0)=$20:FC(1)=$10:FC(2)=$08:FC(3)=$04:FC(4)=$02 ' // /
    Case 48                   
    	FC(0)=$3E:FC(1)=$51:FC(2)=$49:FC(3)=$45:FC(4)=$3E ' // 0
    Case 49                   
    	FC(0)=$00:FC(1)=$42:FC(2)=$7F:FC(3)=$40:FC(4)=$00 ' // 1
    Case 50                   
    	FC(0)=$42:FC(1)=$61:FC(2)=$51:FC(3)=$49:FC(4)=$46 ' // 2
    Case 51                   
    	FC(0)=$21:FC(1)=$41:FC(2)=$45:FC(3)=$4B:FC(4)=$31 ' // 3
    Case 52                   
    	FC(0)=$18:FC(1)=$14:FC(2)=$12:FC(3)=$7F:FC(4)=$10 ' // 4
    Case 53                   
    	FC(0)=$27:FC(1)=$45:FC(2)=$45:FC(3)=$45:FC(4)=$39 ' // 5
    Case 54                   
    	FC(0)=$3C:FC(1)=$4A:FC(2)=$49:FC(3)=$49:FC(4)=$30 ' // 6
    Case 55                   
    	FC(0)=$01:FC(1)=$71:FC(2)=$09:FC(3)=$05:FC(4)=$03 ' // 7
    Case 56                   
    	FC(0)=$36:FC(1)=$49:FC(2)=$49:FC(3)=$49:FC(4)=$36 ' // 8
    Case 57                   
    	FC(0)=$06:FC(1)=$49:FC(2)=$49:FC(3)=$29:FC(4)=$1E ' // 9
    Case 58                   
    	FC(0)=$00:FC(1)=$36:FC(2)=$36:FC(3)=$00:FC(4)=$00 ' // :
    Case 59                   
    	FC(0)=$00:FC(1)=$56:FC(2)=$36:FC(3)=$00:FC(4)=$00 ' // ";"
    Case 60                   
    	FC(0)=$08:FC(1)=$14:FC(2)=$22:FC(3)=$41:FC(4)=$00 ' // <
    Case 61                   
    	FC(0)=$14:FC(1)=$14:FC(2)=$14:FC(3)=$14:FC(4)=$14 ' // =
    Case 62                   
    	FC(0)=$00:FC(1)=$41:FC(2)=$22:FC(3)=$14:FC(4)=$08 ' // >
    Case 63                   
    	FC(0)=$02:FC(1)=$01:FC(2)=$51:FC(3)=$09:FC(4)=$06 ' // ?
    Case 64                   
    	FC(0)=$32:FC(1)=$49:FC(2)=$59:FC(3)=$51:FC(4)=$3E ' // @
    Case 65                   
    	FC(0)=$7E:FC(1)=$11:FC(2)=$11:FC(3)=$11:FC(4)=$7E ' // A
    Case 66                   
    	FC(0)=$7F:FC(1)=$49:FC(2)=$49:FC(3)=$49:FC(4)=$36 ' // B
    Case 67                   
    	FC(0)=$3E:FC(1)=$41:FC(2)=$41:FC(3)=$41:FC(4)=$22 ' // C
    Case 68                   
    	FC(0)=$7F:FC(1)=$41:FC(2)=$41:FC(3)=$22:FC(4)=$1C ' // D
    Case 69                   
    	FC(0)=$7F:FC(1)=$49:FC(2)=$49:FC(3)=$49:FC(4)=$41 ' // E
    Case 70                   
    	FC(0)=$7F:FC(1)=$09:FC(2)=$09:FC(3)=$09:FC(4)=$01 ' // F
    Case 71                   
    	FC(0)=$3E:FC(1)=$41:FC(2)=$49:FC(3)=$49:FC(4)=$7A ' // G
    Case 72                   
    	FC(0)=$7F:FC(1)=$08:FC(2)=$08:FC(3)=$08:FC(4)=$7F ' // H
    Case 73                   
    	FC(0)=$00:FC(1)=$41:FC(2)=$7F:FC(3)=$41:FC(4)=$00 ' // I
    Case 74                   
    	FC(0)=$20:FC(1)=$40:FC(2)=$41:FC(3)=$3F:FC(4)=$01 ' // J
    Case 75                   
    	FC(0)=$7F:FC(1)=$08:FC(2)=$14:FC(3)=$22:FC(4)=$41 ' // K
    Case 76                   
    	FC(0)=$7F:FC(1)=$40:FC(2)=$40:FC(3)=$40:FC(4)=$40 ' // L
    Case 77                   
    	FC(0)=$7F:FC(1)=$02:FC(2)=$0C:FC(3)=$02:FC(4)=$7F ' // M
    Case 78                   
    	FC(0)=$7F:FC(1)=$04:FC(2)=$08:FC(3)=$10:FC(4)=$7F ' // N
    Case 79                   
    	FC(0)=$3E:FC(1)=$41:FC(2)=$41:FC(3)=$41:FC(4)=$3E ' // O
    Case 80                   
    	FC(0)=$7F:FC(1)=$09:FC(2)=$09:FC(3)=$09:FC(4)=$06 ' // P
    Case 81                   
    	FC(0)=$3E:FC(1)=$41:FC(2)=$51:FC(3)=$21:FC(4)=$5E ' // Q
    Case 82                   
    	FC(0)=$7F:FC(1)=$09:FC(2)=$19:FC(3)=$29:FC(4)=$46 ' // R
    Case 83                   
    	FC(0)=$46:FC(1)=$49:FC(2)=$49:FC(3)=$49:FC(4)=$31 ' // S
    Case 84                   
    	FC(0)=$01:FC(1)=$01:FC(2)=$7F:FC(3)=$01:FC(4)=$01 ' // T
    Case 85                   
    	FC(0)=$3F:FC(1)=$40:FC(2)=$40:FC(3)=$40:FC(4)=$3F ' // U
    Case 86                   
    	FC(0)=$1F:FC(1)=$20:FC(2)=$40:FC(3)=$20:FC(4)=$1F ' // V
    Case 87                   
    	FC(0)=$3F:FC(1)=$40:FC(2)=$38:FC(3)=$40:FC(4)=$3F ' // W
    Case 88                   
    	FC(0)=$63:FC(1)=$14:FC(2)=$08:FC(3)=$14:FC(4)=$63 ' // X
    Case 89                   
    	FC(0)=$07:FC(1)=$08:FC(2)=$70:FC(3)=$08:FC(4)=$07 ' // Y
    Case 90                   
    	FC(0)=$61:FC(1)=$51:FC(2)=$49:FC(3)=$45:FC(4)=$43 ' // Z
    Case 91                   
    	FC(0)=$00:FC(1)=$7F:FC(2)=$41:FC(3)=$41:FC(4)=$00 ' // [
    Case 92                   
        FC(0)=$02:FC(1)=$04:FC(2)=$08:FC(3)=$10:FC(4)=$20 ' // \  (we are using this for Case 34 " above)
    Case 93                   
    	FC(0)=$00:FC(1)=$41:FC(2)=$41:FC(3)=$7F:FC(4)=$00 ' // ]
    Case 94                   
    	FC(0)=$04:FC(1)=$02:FC(2)=$01:FC(3)=$02:FC(4)=$04 ' // ^
    Case 95                   
    	FC(0)=$40:FC(1)=$40:FC(2)=$40:FC(3)=$40:FC(4)=$40 ' // _
    Case 96                   
'    	FC(0)=$00:FC(1)=$01:FC(2)=$02:FC(3)=$04:FC(4)=$00 ' // ` 
        FC(0)=$02:FC(1)=$04:FC(2)=$08:FC(3)=$10:FC(4)=$20 ' // \ (shown as ` in Lookdown table)
    Case 97                   
    	FC(0)=$20:FC(1)=$54:FC(2)=$54:FC(3)=$54:FC(4)=$78 ' // a
    Case 98                   
    	FC(0)=$7F:FC(1)=$48:FC(2)=$44:FC(3)=$44:FC(4)=$38 ' // b
    Case 99                   
    	FC(0)=$38:FC(1)=$44:FC(2)=$44:FC(3)=$44:FC(4)=$20 ' // c
    Case 100                   
    	FC(0)=$38:FC(1)=$44:FC(2)=$44:FC(3)=$48:FC(4)=$7F ' // d
    Case 101                   
    	FC(0)=$38:FC(1)=$54:FC(2)=$54:FC(3)=$54:FC(4)=$18 ' // e
    Case 102                   
    	FC(0)=$08:FC(1)=$7E:FC(2)=$09:FC(3)=$01:FC(4)=$02 ' // f
    Case 103                   
    	FC(0)=$0C:FC(1)=$52:FC(2)=$52:FC(3)=$52:FC(4)=$3E ' // g
    Case 104                   
    	FC(0)=$7F:FC(1)=$08:FC(2)=$04:FC(3)=$04:FC(4)=$78 ' // h
    Case 105                   
    	FC(0)=$00:FC(1)=$44:FC(2)=$7D:FC(3)=$40:FC(4)=$00 ' // i
    Case 106                   
    	FC(0)=$20:FC(1)=$40:FC(2)=$44:FC(3)=$3D:FC(4)=$00 ' // j
    Case 107                   
    	FC(0)=$7F:FC(1)=$10:FC(2)=$28:FC(3)=$44:FC(4)=$00 ' // k
    Case 108                   
    	FC(0)=$00:FC(1)=$41:FC(2)=$7F:FC(3)=$40:FC(4)=$00 ' // l
    Case 109                   
    	FC(0)=$7C:FC(1)=$04:FC(2)=$18:FC(3)=$04:FC(4)=$78 ' // m
    Case 110                   
    	FC(0)=$7C:FC(1)=$08:FC(2)=$04:FC(3)=$04:FC(4)=$78 ' // n
    Case 111                   
    	FC(0)=$38:FC(1)=$44:FC(2)=$44:FC(3)=$44:FC(4)=$38 ' // o
    Case 112                   
    	FC(0)=$7C:FC(1)=$14:FC(2)=$14:FC(3)=$14:FC(4)=$08 ' // p
    Case 113                   
    	FC(0)=$08:FC(1)=$14:FC(2)=$14:FC(3)=$18:FC(4)=$7C ' // q
    Case 114                   
    	FC(0)=$7C:FC(1)=$08:FC(2)=$04:FC(3)=$04:FC(4)=$08 ' // r
    Case 115                   
    	FC(0)=$48:FC(1)=$54:FC(2)=$54:FC(3)=$54:FC(4)=$20 ' // s
    Case 116                   
    	FC(0)=$04:FC(1)=$3F:FC(2)=$44:FC(3)=$40:FC(4)=$20 ' // t
    Case 117                   
    	FC(0)=$3C:FC(1)=$40:FC(2)=$40:FC(3)=$20:FC(4)=$7C ' // u
    Case 118                   
    	FC(0)=$1C:FC(1)=$20:FC(2)=$40:FC(3)=$20:FC(4)=$1C ' // v
    Case 119                   
    	FC(0)=$3C:FC(1)=$40:FC(2)=$30:FC(3)=$40:FC(4)=$3C ' // w
    Case 120                    
    	FC(0)=$44:FC(1)=$28:FC(2)=$10:FC(3)=$28:FC(4)=$44 ' // x 
    Case 121                    
    	FC(0)=$0C:FC(1)=$50:FC(2)=$50:FC(3)=$50:FC(4)=$3C ' // y 
    Case 122                    
    	FC(0)=$44:FC(1)=$64:FC(2)=$54:FC(3)=$4C:FC(4)=$44 ' // z 
    case 123
'        FC(0)=$00:FC(1)=$08:FC(2)=$36:FC(3)=$41:FC(4)=$00'  // {
    	FC(0)=$10:FC(1)=$24:FC(2)=$20:FC(3)=$24:FC(4)=$10 ' // Smily face (shown as { in Lookdown table)
    case 124
'        FC(0)=$00:FC(1)=$00:FC(2)=$7F:FC(3)=$00:FC(4)=$00 ' // |
    	FC(0)=$20:FC(1)=$40:FC(2)=$20:FC(3)=$10:FC(4)=$08 ' // Tick (shown as | in Lookdown table)
    case 125
'        FC(0)=$00:FC(1)=$41:FC(2)=$36:FC(3)=$08:FC(4)=$00'  // }    
    	FC(0)=$20:FC(1)=$14:FC(2)=$10:FC(3)=$14:FC(4)=$20 ' // Frown face (shown as } in Lookdown table)
    case 126
        FC(0)=$10:FC(1)=$08:FC(2)=$08:FC(3)=$10:FC(4)=$08'  // ~

    end SELECT
FOR CharLine=0 to 4
GOSUB PomeriNiz
Displej[7]=FC(CharLine)
GOSUB Prikazi_Niz
PAUSE BrzinaSkrolovanja
Next CharLine
    Return
 
Main ispravi na ovo

Code: Select all

Main:
Char="J"
BrzinaSkrolovanja=1000
GOSUB SendChar
Char="a"
BrzinaSkrolovanja =0
GOSUB SendChar
Char=" "
BrzinaSkrolovanja=1000
GOSUB SendChar
Char=" "
BrzinaSkrolovanja=1000
GOSUB SendChar
Char=" "
BrzinaSkrolovanja=1000
GOSUB SendChar
Char=" "
BrzinaSkrolovanja=1000
GOSUB SendChar
GOTO Main
Treba da definises promenljive sve koje fale kao bajt, FC niz bajtova 5 clanova, BrzinaSkrolovanja kao word.
Kad to sve proradi, onda ostaje jos samo ubaciti one makroe za ispis po displeju...
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: MAX7219 I 8X8 LED DISPLAY

Post by febo26 »

Radi i to od prve je proradilo,slova idu s desna na lijevo jedino su zaljepljena jedno za drugo,negdje izmedju slova se mora ubacit razmak.idem nesto prigrist pa nastavak slijedi
User avatar
pedja089
Administrator sajta
Administrator sajta
Posts: 7877
Joined: 20-02-2007, 14:50
Location: Beočin -Srbija

Re: MAX7219 I 8X8 LED DISPLAY

Post by pedja089 »

Code: Select all

FOR CharLine=0 to 4
GOSUB PomeriNiz
Displej[7]=FC(CharLine)
GOSUB Prikazi_Niz
PAUSE BrzinaSkrolovanja
Next CharLine
Iznad toga dodaj

Code: Select all

GOSUB PomeriNiz
Displej[7]=0 ' Vertikalna prazna linija sa leve strane slova
GOSUB Prikazi_Niz
User avatar
pedja089
Administrator sajta
Administrator sajta
Posts: 7877
Joined: 20-02-2007, 14:50
Location: Beočin -Srbija

Re: MAX7219 I 8X8 LED DISPLAY

Post by pedja089 »

Sto se tice makroa za printanje fiksnog teksta

Code: Select all

ASM
PrintStr macro  Str
    local TheString, OverStr
    goto OverStr
TheString
    data  Str, 0
OverStr
    MOVE?CW  TheString, _Addr
    L?CALL   _StringOut
    endm
ENDASM

StringOut:
    Readcode Addr, Char           ' Get a character
    if Char = 0 then StringDone   ' Look for Null char, Stop if found
    Lcd_Data = Char
    
    gosub SendChar               ' puttext
    Addr = Addr + 1               ' Point to next character
    goto StringOut                ' Continue with rest of the string

  StringDone:
return
Sada bi trebao tekst isprintati sa
@ PrintStr "Pedja089:)"
Ovo isto dodaj na kraj prethodnog koda, a u main ubaci samo
@ PrintStr "Pedja089:)" i pause 1000
Za tekst iz memorije ili odnekud trece u Char ubacis slovo, i pozoves SendChar
Za ispis promenljivih, probaj sam malo eksperimentisati, ali fazon je slican ovome...
EDIT:
Ovde u kodu koliko vidim moze da radi samo ispis WORD promenljive... Vise se ni ne secam tacno zasto je tako uradjeno...
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: MAX7219 I 8X8 LED DISPLAY

Post by febo26 »

sad imam razmak izmedju slova , makro ne radi
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: MAX7219 I 8X8 LED DISPLAY

Post by febo26 »

@ PrintStr "Pedja089:)"

napise gresku:
ASM ERROR illegal character (")

probao sam i ovako s zarezom onda napise da je zarez greska

@ PrintStr ,"Pedja089:)"
User avatar
pedja089
Administrator sajta
Administrator sajta
Posts: 7877
Joined: 20-02-2007, 14:50
Location: Beočin -Srbija

Re: MAX7219 I 8X8 LED DISPLAY

Post by pedja089 »

Nemam pojma koju verziju PBP-a koristis, ali sa trojkom to prolazi bez problema.
Zaboravio sam napomenuti da se mora koristiti MPASM koji ide uz mplab, a ne onaj sto dolazi uz PBP ako je rec o verzijama manjim od 3.0
Drugi nacin ispisa bi bio ovako nesto:
For i=0 to 255
Char=0
LOOKUP i,["Pedja089"], Char
if char=0 then exit'Automatski detektuj kraj teksta, tako da ne moras svaki put brojati koliko tekst ima slova
GOSUB SendChar
Next i
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: MAX7219 I 8X8 LED DISPLAY

Post by febo26 »

Code: Select all

'****************************************************************
'*  Name    : UNTITLED.BAS                                      *
'*  Author  : ZELJKO FERIC                                      *
'*  Notice  : Copyright (c) 2014 [select VIEW...EDITOR OPTIONS] *
'*          : All Rights Reserved                               *
'*  Date    : 20.10.2014                                        *
'*  Version : 1.0                                               *
'*  Notes   :                                                   *
'*          :                                                   *
'****************************************************************
include "pedja_5.pbp"

main:
 @ PrintStr "Pedja089:)"
pause 1000
goto main

dok ovo napisem ovako onda ne javlja gresku ali ispisuje svako drugo slovo
Ispise samo ej09) tocno tim redosljedom


include "pedja_5.pbp"
to je fajl koji smo danas skemijali
idem jos potrazit gresku mozda ju nadjem
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: MAX7219 I 8X8 LED DISPLAY

Post by febo26 »

picbasic pro 3.0.4.0
i MPSAM 5.43
User avatar
pedja089
Administrator sajta
Administrator sajta
Posts: 7877
Joined: 20-02-2007, 14:50
Location: Beočin -Srbija

Re: MAX7219 I 8X8 LED DISPLAY

Post by pedja089 »

Aha, izgleda makro mora stajati u nekom include file. Slabo sam radio sa njima. To nisam znao...
E sad zasto svako drugo slovo nisam siguran... A nemam ni vremena puno za kopati... Mislim da je to nesto oko READCODE naredbe, da ona cita 2 bajta, ili nesto slicno...
Mozes probati staviti promenljivu word u readcode, pa staviti da ti prikaze prvo jedan znak, pa drugi, ili nesto tako...

Mozes pogledati gore nacin sto sam dodao sa lookup komandom. Ona u sustini radi ovo sto je u makru napravljeno.

Code: Select all

StringOut:
    Readcode Addr, wordChar           ' Get a character
    Char =wordChar.byte0
    if Char = 0 then StringDone   ' Look for Null char, Stop if found
    gosub SendChar               ' puttext

    Char =wordChar.byte1
    if Char = 0 then StringDone   ' Look for Null char, Stop if found
    gosub SendChar               ' puttext

    Addr = Addr + 1               ' Point to next character
    goto StringOut                ' Continue with rest of the string

  StringDone:
return
Probaj to...
EDIT:
Nadam se da si video u onom include sto sam okacio da Addr treba da bude word...
Addr VAR WORD
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: MAX7219 I 8X8 LED DISPLAY

Post by febo26 »

Ono s LOOKUP radi bez greske. negdje je greska u makrou mada je ne vidim probao sam par kombinacija nije pomoglo
User avatar
pedja089
Administrator sajta
Administrator sajta
Posts: 7877
Joined: 20-02-2007, 14:50
Location: Beočin -Srbija

Re: MAX7219 I 8X8 LED DISPLAY

Post by pedja089 »

Za ispisivanje promenljive

Code: Select all

For i = 4 to 0 step -1
char= 48+ Promenljiva DIG i
gosub SendChar
NEXT i
Mozes probati naci na MELAB forumu primer za USER COMMAND koje su ubacene u pbp3, ali nisu bas lepo dokumntovane. Pa sa njima napraviti da lepo upakovane komande za ispis na displej.
Po meni samo kozmetika, nista drugo...
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: MAX7219 I 8X8 LED DISPLAY

Post by febo26 »

Za danas dosta kucanja po kompu,sutra slijedi novi izazov.Posto sada kompletni text scrollam po jednoj matrici
sada treba naci rjesenje kako taj cijeli text pomaknuti na jos dvije matrice

Code: Select all

PomeriNiz:
For i=0 to 6
 Displej[i]=displej[i+1]
next i
Displej[7]=0'Ovo bi trebao biti novi red koji ce da izadje sa desne strane, ali dok ne proradi siftovanje neka ga 0.


    Prikazi_Niz:
    for Y =0 to 7
    ADDRESS = Y+1 
    DATAREG = displej[y]
    gosub MaxWrite
    next Y
    return

        MaxWrite:
        shiftout DAT,CLK,MSBFIRST,[ADDRESS,DATAREG] 'Shift out the data to the 'MAX7219 'first the address, then data.
        pulsout LOAD,1 'load the data into the MAX7219
        return
posto se podaci salju serijski naredba za slanje bi trebala izgledati ovako:

shiftout DAT,CLK,MSBFIRST,[0,0,0,0,ADDRESS,DATAREG] podaci poslani skroz desnom displeju
shiftout DAT,CLK,MSBFIRST,[0,0,ADDRESS,DATAREG,0,0] podaci poslani srednjem displeju
shiftout DAT,CLK,MSBFIRST,[ADDRESS,DATAREG,0,0,0,0] podaci poslani lijevom displeju
Post Reply