MAX7219 I 8X8 LED DISPLAY

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

Moderators: pedja089, stojke369, [eDo], trax

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 »

Mislim da ne bi trebalo tako...
Nego adresa, pa 8 bajtova, pa sledeca adresa pa 8 bajtova i tako redom... Valjda...
Jer ovako ces ubaciti nule u registre koje ne pises.
Onda ti niz treba biti dug 24 bajta. U onom podprogramu za shiftovanje isto to moras promeniti.
Ili mozda kako si ti rekao, pa lechovati svaki posebno...
Mada mislim da je bolje ubaciti sve podatke pa onda zajednicki latch da bude, da bi se istovremeno svuda prikazali isti podatci. Da ne utice brzina pica na to da se prvo pojave na jednom pa drugom pa trecem...
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: MAX7219 I 8X8 LED DISPLAY

Post by febo26 »

Za sad nema pomaka,vrtim se u krug,nisam prokuzio kako poslati podatke s prvog displeja na drugi itd
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 »

Kreni opet od samog pocetka...
Napuni niz samo nekim podatcima, i probaj to prikazati koristeci sve latch pinove zajedno spojenim. Kad to uspes onda cemo dalje... Ne bi na odmet dosla i neka sema, da ne kopam po datasheetu...
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: MAX7219 I 8X8 LED DISPLAY

Post by febo26 »

To su ti moduli s ebaya
evo link za shemu
http://www.talkingelectronics.com/proje ... splay.html
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: MAX7219 I 8X8 LED DISPLAY

Post by febo26 »

ako spojim sva tri displeja u paralelu,
a LATCH (CS ili LOAD) su sa sva tri displeja spojena na PORTB.2 i s ovim kodom
onda mi se u isto vrijeme na sva tri displeja ispisuje isto slovo
Recimo slovo P krene s desne strane na sva tri displeja i putuje u lijevo, s tim da mi se na srednjem displeju znadu poduplati okomice dobim oblik podebljanog slova .
Prvi i treci displej nemaju tu manu

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.
return

    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


Ako promjenim MaxWrite u ovaj oblik

Code: Select all

MaxWrite:
        shiftout DAT,CLK,MSBFIRST,[0,0,0,0,ADDRESS,DATAREG] 'Shift out the data to the 'MAX7219 'first the address, then data ZA SKROZ DESNI DISPLEJ
        pulsout LOAD,1 'load the data into the MAX7219
       
        
         shiftout DAT,CLK,MSBFIRST,[0,0, ADDRESS,DATAREG,0,0] 'Shift out the data to the 'MAX7219 'first the address, then data. ZA SREDNJI DISPLEJ
        pulsout LOAD,1 'load the data into the MAX7219
        

         shiftout DAT,CLK,MSBFIRST,[ADDRESS,DATAREG,0,0,0,0] 'Shift out the data to the 'MAX7219 'first the address, then data. ZA LIJEVI DISPLEJ
        pulsout LOAD,1 'load the data into the MAX7219
        return
onda vise nemam efekt podebljanog slova na srednjem displeju.

ako sam ja dobro skuzio iz data sheeta
ako je ADRESS=0 I DATAREG=0 to znaci da daj chip ne izvrsava nikakvu radnju podaci kako su usli u njega tako i izadju van na iduci MAX u kaskadi.

[0,0,0,0,ADDRESS,DATAREG]

lijevi i srednji displej dobe za adresu i datareg NULU i oni miruju a treci displej dobi podatak za ispis.
Adresa ima vrijednost Y iz koda od 1do8 a data reg ima vrijednost displej[y]
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: MAX7219 I 8X8 LED DISPLAY

Post by febo26 »

Da li bi se mogao napraviti neki medjuspremnik (buffer) u koji bi se spremali podaci za kolone.
Posto imam tri displeja i svaki ima 8 kolona onda bi velicina buffera trebala biti za 24 kolone byte.
(23,.22,21,20.........................,8,7,6,5,4,3,2,1,0"

za svaki MAX7219 adresa se krece u rasponu od 1 do 8.
1 je prva adresa za vertikalu i u nju se prvu upisuju DATAREG podaci za odredjeni MAX7219.
8 je zadnja adresa i u nju ide zadnji podatak

Primjer kako sam ja to zamislio,
recimo da zelimo ispisat rijec "MIS"

prvo se iz labele SEND_CHAR izdvoje podaci za slovo "M "u ovom obliku: $7F,$02,$0C,$02,$7F i s tim podacima se puni prvih 8 mjesta u bufferu,
nakon toga se izdvajaju podaci iz labele SEND_CHAR za slovo"I" u obliku $00,$41,$7F,$41,$00 i kako oni pune opet prvih osam mjesta u bufferu tako se podaci od slova "M "pomicu za 8 mjesta u lijevo,nakon toga
se izdvajaju podaci za slovo "S "i kako oni pune prvih osam mjesta tako se podaci od slova M,I pomicu jos u lijevo za osam mjesta.

E sad skroz desni MAX mora da cita podatke iz buffera od pozicije 0-7 i sprema u DATAREG, a adresa za njega se krece u rangu od 1-8,
srednji MAX treba da cita podatke iz buffra od 8-15 i sprema u DATAREG ,i njegova adresa se krece u rangu od 1-8
Lijevi MAX cita podatke iz bufera od pozicije 16-23 i sprema u DATAREG i njegova dresa je isto u rangu od 1-8

Da li je to dobra ideja i kako je realizirati.

Da li bi latch od sva tri MAX trebala biti zajedno spojena ili svaki LATCH bi trebao imat svoj pin na procesoru.
CLK im je spojen zajedno, a
DATA ide s PIC-a u prvi MAX na njegov DIN pin a njegov DOUT pin se spaja ina duci MAX7219 na DIN pin.
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: MAX7219 I 8X8 LED DISPLAY

Post by febo26 »

Ja sam svoje ideje spucao i nisam nista napravio nema pomaka.Ako neko dobi jos koju ideju neka napise da sprobam.Jos uvijek se tekst vrti na jednom displeju.....
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 »

Probaj ovo i na sva 3 displeja treba da dobijes iste slike, slova ili sta vec.

Code: Select all

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,ADDRESS,DATAREG,ADDRESS,DATAREG] 'Shift out the data to the 'MAX7219 'first the address, then data.
        pulsout LOAD,1 'load the data into the MAX7219
        return
Kad to dobijes, onda napravi

Code: Select all

shiftout DAT,CLK,MSBFIRST,[ADDRESS,DATAREG3,ADDRESS,DATAREG2,ADDRESS,DATAREG1]
Sa tim ces slati posebne podatke na sva 3 displeja.

Code: Select all

for Y =0 to 7
ADDRESS = Y+1
DATAREG1 = displej[y]
DATAREG2 = displej[y+8]
DATAREG3 = displej[y+16]
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 »

Upravo sam probao ovo i nazalost ne radi.
Desava se to da na skroz desnom displeju dobivam samo nekakve tockice,srednji displej pokazuje cijelu znamenku bez skrolanja a skroz lijevi displej skrola normalno text s desne strane na lijevu.Jos negdi nekaj fali.

Dok se na srednjem displeju pojavi cijela znamenka onda tek se ta ista znamenka na skroz lijevom displeju pocne skrolati i dok dodje do kraja onda se pojavi na srednjem displeju nova znamenka i tako u krug

evo koda:

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   :                                                   *
'*          :                                                   *
'****************************************************************
 @ ERRORLEVEL -306 ; turn off crossing page boundary message
	 #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 byte  'variable address for display
        DATAREG  var byte
         DATAREG1  var byte
          DATAREG2  var byte
           DATAREG3  var byte 'variable data register for display
        Y        VAR BYTE  'okomice
        i        var byte
        FC       VAR BYTE[5]
        BrzinaSkrolovanja VAR WORD
        CHAR      VAR byte
        Addr      VAR word
        Lcd_Data  var word
        CharLine  var byte
        Displej   var byte[8]
         r var byte
         BrzinaSkrolovanja = 200
        
        
        '----- symbolos ------ 
        '-----PIN SETUPS-----
        SYMBOL CLK = PORTB.0
        SYMBOL DAT = PORTB.1
        SYMBOL LOAD = PORTB.2
        
        
inicijalizacija :  
'MAX7219 chipa obavezno na pocetku programa
        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' NO SHUT, NORMAL OPERATION 
        shiftout DAT,CLK,MSBFIRST,[ADDRESS,DATAREG,ADDRESS,DATAREG,ADDRESS,DATAREG] 'Shift out the data to the 'MAX7219 'first the address, then data.
        pulsout LOAD,1
         
        ADDRESS = $09 : DATAREG = $00  ' COMBINACION BINARIA, NO DECODE
           shiftout DAT,CLK,MSBFIRST,[ADDRESS,DATAREG,ADDRESS,DATAREG,ADDRESS,DATAREG] 'Shift out the data to the 'MAX7219 'first the address, then data.
        pulsout LOAD,1
        
        
        ADDRESS = $0A : DATAREG = $02  ' INTENSIDAD DE LEDS 1(MIN) A F(MAX)
           shiftout DAT,CLK,MSBFIRST,[ADDRESS,DATAREG,ADDRESS,DATAREG,ADDRESS,DATAREG] 'Shift out the data to the 'MAX7219 'first the address, then data.
        pulsout LOAD,1
        
        
        ADDRESS = $0B : DATAREG = $07  ' SCAN LIMIT NUMERO DE DIGITOS
           shiftout DAT,CLK,MSBFIRST,[ADDRESS,DATAREG,ADDRESS,DATAREG,ADDRESS,DATAREG] 'Shift out the data to the 'MAX7219 'first the address, then data.
        pulsout LOAD,1
        
        
        ADDRESS = $0F : DATAREG = $00
           shiftout DAT,CLK,MSBFIRST,[ADDRESS,DATAREG,ADDRESS,DATAREG,ADDRESS,DATAREG] 'Shift out the data to the 'MAX7219 'first the address, then data.
        pulsout LOAD,1
        

main:     
             
For r=0 to 255
Char=0
LOOKUP r,["Pedja089 i ZELJKO FERIC PITOMACA Visnja Karla Reklama za studio"], Char
if char=0 then exit'Automatski detektuj kraj teksta, tako da ne moras svaki put brojati koliko tekst ima slova
GOSUB SendChar
Next r 

pause 1000
goto main
    
        
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
        
        
GOSUB PomeriNiz
Displej[7]=0 ' Vertikalna prazna linija sa leve strane slova
GOSUB Prikazi_Niz


FOR CharLine=0 to 4
GOSUB PomeriNiz
Displej[i]=FC(CharLine)
GOSUB Prikazi_Niz
PAUSE BrzinaSkrolovanja
Next CharLine
        Return
        
        
        
        
        
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.
return


Prikazi_Niz:
    for Y =0 to 7
       ADDRESS = Y+1
       DATAREG1 = displej[y]
       DATAREG2 = displej[y+8]
       DATAREG3 = displej[y+16]
       gosub MaxWrite
    next Y
return



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

     
dok napisem ovo kako si rekao onda dobim na sva tri displeja u isto vrijeme isti ispis i normalno skrolanje

Code: Select all

    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,ADDRESS,DATAREG,ADDRESS,DATAREG] 'Shift out the data to the 'MAX7219 'first the address, then data.
            pulsout LOAD,1 'load the data into the MAX7219
            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 »

Do kojeg broja ti ide pomeri niz a do kojeg bi trebalo? I koliko displj niz treba da ima clanova ako imas 24 kolone???
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: MAX7219 I 8X8 LED DISPLAY

Post by febo26 »

Pedja probao sam to i u niz-u promjeniti ali nije pomoglo jer je bilo jos nedostataka u kodu koji su radili probleme i koji su me zbunili pa sam pustio orginalni kod..Sada je sve ispravljeno i sve radi.

Promjenjeno je sljedece:

FC VAR BYTE[5] ------ u---- FC VAR BYTE[6]
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: MAX7219 I 8X8 LED DISPLAY

Post by febo26 »

ispravak prijasnjeg posta evo cijelog texta

Pedja probao sam to i u niz-u promjeniti ali nije pomoglo jer je bilo jos nedostataka u kodu koji su radili probleme i koji su me zbunili pa sam pustio orginalni kod..Sada je sve ispravljeno i sve radi.

Promjenjeno je sljedece:

FC VAR BYTE[5] ------ u---- FC VAR BYTE[6]
Displej var byte[8]------u-------Displej var byte[24]
u labeli SEND CHAR na svaki znak na kraju je dodano ovo :FC(5)=$00 da bi imalo razmak izmedju slova

u istoj toj labeli izbačeno je ovo van:
'GOSUB PomeriNiz
'Displej[7]=0
' Vertikalna prazna linija sa leve strane slova
'GOSUB Prikazi_Niz

u istoj toj labeli ovaj red je izmjenjen

Displej=FC(CharLine) u ovaj oblik Displej[i-1]=FC(CharLine)


iz labele POMERI NIZ
izbacen je ovaj red:
'Displej[7]=0
i ovo promjenjeno u ovaj oblik
For i=0 to 6 u ovaj oblik For i=0 to 23



Sada sve radi kao treba tekst se scrola s lijeva na desno bez ijedne greske.
Zahvaljujem Pedji 089 na svestranoj pomoci i strpljenu.Nadam se da cemo se jednom naci i otici na hladno pivo....


evo i finalnog koda

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   :                                                   *
'*          :                                                   *
'****************************************************************
 @ ERRORLEVEL -306 ; turn off crossing page boundary message
	 #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 byte  'variable address for display
        DATAREG  var byte
         DATAREG1  var byte
          DATAREG2  var byte
           DATAREG3  var byte 'variable data register for display
        Y        VAR BYTE  'okomice
        i        var byte
        FC       VAR BYTE[6]
        BrzinaSkrolovanja VAR WORD
        CHAR      VAR byte
        Addr      VAR word
        Lcd_Data  var word
        CharLine  var byte
        Displej   var byte[24]
         r var byte
         BrzinaSkrolovanja = 200
        
        
        '----- symbolos ------ 
        '-----PIN SETUPS-----
        SYMBOL CLK = PORTB.0
        SYMBOL DAT = PORTB.1
        SYMBOL LOAD = PORTB.2
        
        
inicijalizacija :  
'MAX7219 chipa obavezno na pocetku programa
        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' NO SHUT, NORMAL OPERATION 
        shiftout DAT,CLK,MSBFIRST,[ADDRESS,DATAREG,ADDRESS,DATAREG,ADDRESS,DATAREG] 'Shift out the data to the 'MAX7219 'first the address, then data.
        pulsout LOAD,1
         
        ADDRESS = $09 : DATAREG = $00  ' COMBINACION BINARIA, NO DECODE
           shiftout DAT,CLK,MSBFIRST,[ADDRESS,DATAREG,ADDRESS,DATAREG,ADDRESS,DATAREG] 'Shift out the data to the 'MAX7219 'first the address, then data.
        pulsout LOAD,1
        
        
        ADDRESS = $0A : DATAREG = $02  ' INTENSIDAD DE LEDS 1(MIN) A F(MAX)
           shiftout DAT,CLK,MSBFIRST,[ADDRESS,DATAREG,ADDRESS,DATAREG,ADDRESS,DATAREG] 'Shift out the data to the 'MAX7219 'first the address, then data.
        pulsout LOAD,1
        
        
        ADDRESS = $0B : DATAREG = $07  ' SCAN LIMIT NUMERO DE DIGITOS
           shiftout DAT,CLK,MSBFIRST,[ADDRESS,DATAREG,ADDRESS,DATAREG,ADDRESS,DATAREG] 'Shift out the data to the 'MAX7219 'first the address, then data.
        pulsout LOAD,1
        
        
        ADDRESS = $0F : DATAREG = $00
           shiftout DAT,CLK,MSBFIRST,[ADDRESS,DATAREG,ADDRESS,DATAREG,ADDRESS,DATAREG] 'Shift out the data to the 'MAX7219 'first the address, then data.
        pulsout LOAD,1
        

        
        
        





main:     
             
For r=0 to 255
Char=0
LOOKUP r,["Digital Electronic 33405 Pitomaca Tel/FAX:033-800-111    "], Char
if char=0 then exit'Automatski detektuj kraj teksta, tako da ne moras svaki put brojati koliko tekst ima slova
GOSUB SendChar
Next r 
pause 1000
goto main
    
        
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:FC(5)=$00'' // !
        Case 34                   
           FC(0)=$00:FC(1)=$07:FC(2)=$00:FC(3)=$07:FC(4)=$00:FC(5)=$00' ' // " (shown as \ in Lookdown table)
        Case 35                   
           FC(0)=$14:FC(1)=$7f:FC(2)=$14:FC(3)=$7f:FC(4)=$14:FC(5)=$00' ' // #
        Case 36                   
           FC(0)=$24:FC(1)=$2a:FC(2)=$7f:FC(3)=$2a:FC(4)=$12:FC(5)=$00' ' // $
        Case 37                   
           FC(0)=$c4:FC(1)=$c8:FC(2)=$10:FC(3)=$26:FC(4)=$46:FC(5)=$00' ' // %
        Case 38                   
           FC(0)=$36:FC(1)=$49:FC(2)=$55:FC(3)=$22:FC(4)=$50:FC(5)=$00' ' // &
        Case 39                   
           FC(0)=$00:FC(1)=$05:FC(2)=$03:FC(3)=$00:FC(4)=$00:FC(5)=$00' ' // '
        Case 40                   
           FC(0)=$00:FC(1)=$1c:FC(2)=$22:FC(3)=$41:FC(4)=$00:FC(5)=$00' ' // (
        Case 41                   
           FC(0)=$00:FC(1)=$41:FC(2)=$22:FC(3)=$1c:FC(4)=$00:FC(5)=$00' ' // )
        Case 42                   
           FC(0)=$14:FC(1)=$08:FC(2)=$3E:FC(3)=$08:FC(4)=$14:FC(5)=$00' ' // *
        Case 43                                             
           FC(0)=$08:FC(1)=$08:FC(2)=$3E:FC(3)=$08:FC(4)=$08:FC(5)=$00' ' // +
        Case 44                   
           FC(0)=$00:FC(1)=$00:FC(2)=$50:FC(3)=$30:FC(4)=$00:FC(5)=$00' ' // ,
        Case 45                   
           FC(0)=$10:FC(1)=$10:FC(2)=$10:FC(3)=$10:FC(4)=$10:FC(5)=$00' ' // -
        Case 46                   
           FC(0)=$00:FC(1)=$60:FC(2)=$60:FC(3)=$00:FC(4)=$00:FC(5)=$00' ' // .
        Case 47                   
           FC(0)=$20:FC(1)=$10:FC(2)=$08:FC(3)=$04:FC(4)=$02:FC(5)=$00' ' // /
        Case 48                   
           FC(0)=$3E:FC(1)=$51:FC(2)=$49:FC(3)=$45:FC(4)=$3E:FC(5)=$00' ' // 0
        Case 49                   
           FC(0)=$00:FC(1)=$42:FC(2)=$7F:FC(3)=$40:FC(4)=$00:FC(5)=$00' ' // 1  :FC(5)=$00:FC(6)=$00:FC(7)=$00
        Case 50                   
           FC(0)=$42:FC(1)=$61:FC(2)=$51:FC(3)=$49:FC(4)=$46:FC(5)=$00' ' // 2
        Case 51                   
           FC(0)=$21:FC(1)=$41:FC(2)=$45:FC(3)=$4B:FC(4)=$31:FC(5)=$00' ' // 3
        Case 52                   
           FC(0)=$18:FC(1)=$14:FC(2)=$12:FC(3)=$7F:FC(4)=$10:FC(5)=$00' ' // 4
        Case 53                   
           FC(0)=$27:FC(1)=$45:FC(2)=$45:FC(3)=$45:FC(4)=$39:FC(5)=$00' ' // 5
        Case 54                   
           FC(0)=$3C:FC(1)=$4A:FC(2)=$49:FC(3)=$49:FC(4)=$30:FC(5)=$00' ' // 6
        Case 55                   
           FC(0)=$01:FC(1)=$71:FC(2)=$09:FC(3)=$05:FC(4)=$03:FC(5)=$00' ' // 7
        Case 56                   
           FC(0)=$36:FC(1)=$49:FC(2)=$49:FC(3)=$49:FC(4)=$36:FC(5)=$00' ' // 8
        Case 57                   
           FC(0)=$06:FC(1)=$49:FC(2)=$49:FC(3)=$29:FC(4)=$1E:FC(5)=$00' ' // 9
        Case 58                   
           FC(0)=$00:FC(1)=$36:FC(2)=$36:FC(3)=$00:FC(4)=$00:FC(5)=$00' ' // :
        Case 59                   
           FC(0)=$00:FC(1)=$56:FC(2)=$36:FC(3)=$00:FC(4)=$00:FC(5)=$00' ' // ";"
        Case 60                   
           FC(0)=$08:FC(1)=$14:FC(2)=$22:FC(3)=$41:FC(4)=$00:FC(5)=$00' ' // <
        Case 61                   
           FC(0)=$14:FC(1)=$14:FC(2)=$14:FC(3)=$14:FC(4)=$14 :FC(5)=$00'' // =
        Case 62                   
           FC(0)=$00:FC(1)=$41:FC(2)=$22:FC(3)=$14:FC(4)=$08:FC(5)=$00' ' // >
        Case 63                   
           FC(0)=$02:FC(1)=$01:FC(2)=$51:FC(3)=$09:FC(4)=$06:FC(5)=$00' ' // ?
        Case 64                   
           FC(0)=$32:FC(1)=$49:FC(2)=$59:FC(3)=$51:FC(4)=$3E:FC(5)=$00' ' // @
        Case 65                   
           FC(0)=$7E:FC(1)=$11:FC(2)=$11:FC(3)=$11:FC(4)=$7E :FC(5)=$00' // A
        Case 66                   
           FC(0)=$7F:FC(1)=$49:FC(2)=$49:FC(3)=$49:FC(4)=$36:FC(5)=$00' // B
        Case 67                   
           FC(0)=$3E:FC(1)=$41:FC(2)=$41:FC(3)=$41:FC(4)=$22:FC(5)=$00' // C
        Case 68                   
           FC(0)=$7F:FC(1)=$41:FC(2)=$41:FC(3)=$22:FC(4)=$1C:FC(5)=$00' // D
        Case 69                   
           FC(0)=$7F:FC(1)=$49:FC(2)=$49:FC(3)=$49:FC(4)=$41:FC(5)=$00' // E
        Case 70                   
           FC(0)=$7F:FC(1)=$09:FC(2)=$09:FC(3)=$09:FC(4)=$01:FC(5)=$00' // F
        Case 71                   
           FC(0)=$3E:FC(1)=$41:FC(2)=$49:FC(3)=$49:FC(4)=$7A:FC(5)=$00' // G
        Case 72                   
           FC(0)=$7F:FC(1)=$08:FC(2)=$08:FC(3)=$08:FC(4)=$7F:FC(5)=$00'// H
        Case 73                   
           FC(0)=$00:FC(1)=$41:FC(2)=$7F:FC(3)=$41:FC(4)=$00:FC(5)=$00' // I
        Case 74                   
           FC(0)=$20:FC(1)=$40:FC(2)=$41:FC(3)=$3F:FC(4)=$01:FC(5)=$00': // J
        Case 75                   
           FC(0)=$7F:FC(1)=$08:FC(2)=$14:FC(3)=$22:FC(4)=$41:FC(5)=$00' // K
        Case 76                   
           FC(0)=$7F:FC(1)=$40:FC(2)=$40:FC(3)=$40:FC(4)=$40:FC(5)=$00' // L
        Case 77                   
           FC(0)=$7F:FC(1)=$02:FC(2)=$0C:FC(3)=$02:FC(4)=$7F:FC(5)=$00':// M
        Case 78                   
           FC(0)=$7F:FC(1)=$04:FC(2)=$08:FC(3)=$10:FC(4)=$7F:FC(5)=$00' // N
        Case 79                   
           FC(0)=$3E:FC(1)=$41:FC(2)=$41:FC(3)=$41:FC(4)=$3E:FC(5)=$00' // O
        Case 80                   
           FC(0)=$7F:FC(1)=$09:FC(2)=$09:FC(3)=$09:FC(4)=$06:FC(5)=$00' // P
        Case 81                   
           FC(0)=$3E:FC(1)=$41:FC(2)=$51:FC(3)=$21:FC(4)=$5E:FC(5)=$00' // Q
        Case 82                   
           FC(0)=$7F:FC(1)=$09:FC(2)=$19:FC(3)=$29:FC(4)=$46:FC(5)=$00' // R
        Case 83                   
           FC(0)=$46:FC(1)=$49:FC(2)=$49:FC(3)=$49:FC(4)=$31:FC(5)=$00' // S
        Case 84                   
           FC(0)=$01:FC(1)=$01:FC(2)=$7F:FC(3)=$01:FC(4)=$01:FC(5)=$00' // T
        Case 85                   
           FC(0)=$3F:FC(1)=$40:FC(2)=$40:FC(3)=$40:FC(4)=$3F:FC(5)=$00' // U
        Case 86                   
           FC(0)=$1F:FC(1)=$20:FC(2)=$40:FC(3)=$20:FC(4)=$1F:FC(5)=$00' // V
        Case 87                   
           FC(0)=$3F:FC(1)=$40:FC(2)=$38:FC(3)=$40:FC(4)=$3F:FC(5)=$00' // W
        Case 88                   
           FC(0)=$63:FC(1)=$14:FC(2)=$08:FC(3)=$14:FC(4)=$63:FC(5)=$00' // X
        Case 89                   
           FC(0)=$07:FC(1)=$08:FC(2)=$70:FC(3)=$08:FC(4)=$07:FC(5)=$00' // Y
        Case 90                   
           FC(0)=$61:FC(1)=$51:FC(2)=$49:FC(3)=$45:FC(4)=$43:FC(5)=$00' // Z
        Case 91                   
           FC(0)=$00:FC(1)=$7F:FC(2)=$41:FC(3)=$41:FC(4)=$00 :FC(5)=$00'' // [
        Case 92                   
            FC(0)=$02:FC(1)=$04:FC(2)=$08:FC(3)=$10:FC(4)=$20 :FC(5)=$00'' // \  (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:FC(5)=$00' ' // ]
        Case 94                   
           FC(0)=$04:FC(1)=$02:FC(2)=$01:FC(3)=$02:FC(4)=$04:FC(5)=$00' ' // ^
        Case 95                   
           FC(0)=$40:FC(1)=$40:FC(2)=$40:FC(3)=$40:FC(4)=$40 :FC(5)=$00'' // _
        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:FC(5)=$00' ' // \ (shown as ` in Lookdown table)
        Case 97                   
           FC(0)=$20:FC(1)=$54:FC(2)=$54:FC(3)=$54:FC(4)=$78:FC(5)=$00' ' // a
        Case 98                   
           FC(0)=$7F:FC(1)=$48:FC(2)=$44:FC(3)=$44:FC(4)=$38:FC(5)=$00'' // b
        Case 99                   
           FC(0)=$38:FC(1)=$44:FC(2)=$44:FC(3)=$44:FC(4)=$20 :FC(5)=$00'' // c
        Case 100                   
           FC(0)=$38:FC(1)=$44:FC(2)=$44:FC(3)=$48:FC(4)=$7F:FC(5)=$00' ' // d
        Case 101                   
           FC(0)=$38:FC(1)=$54:FC(2)=$54:FC(3)=$54:FC(4)=$18:FC(5)=$00' ' // e
        Case 102                   
           FC(0)=$08:FC(1)=$7E:FC(2)=$09:FC(3)=$01:FC(4)=$02:FC(5)=$00' ' // f
        Case 103                   
           FC(0)=$0C:FC(1)=$52:FC(2)=$52:FC(3)=$52:FC(4)=$3E:FC(5)=$00' ' // g
        Case 104                   
           FC(0)=$7F:FC(1)=$08:FC(2)=$04:FC(3)=$04:FC(4)=$78:FC(5)=$00' ' // h
        Case 105                   
           FC(0)=$00:FC(1)=$44:FC(2)=$7D:FC(3)=$40:FC(4)=$00:FC(5)=$00' ' // i
        Case 106                   
           FC(0)=$20:FC(1)=$40:FC(2)=$44:FC(3)=$3D:FC(4)=$00:FC(5)=$00' ' // j
        Case 107                   
           FC(0)=$7F:FC(1)=$10:FC(2)=$28:FC(3)=$44:FC(4)=$00:FC(5)=$00' ' // k
        Case 108                   
           FC(0)=$00:FC(1)=$41:FC(2)=$7F:FC(3)=$40:FC(4)=$00:FC(5)=$00' ' // l
        Case 109                   
           FC(0)=$7C:FC(1)=$04:FC(2)=$18:FC(3)=$04:FC(4)=$78:FC(5)=$00' ' // m
        Case 110                   
           FC(0)=$7C:FC(1)=$08:FC(2)=$04:FC(3)=$04:FC(4)=$78:FC(5)=$00' ' // n
        Case 111                   
           FC(0)=$38:FC(1)=$44:FC(2)=$44:FC(3)=$44:FC(4)=$38 :FC(5)=$00'' // o
        Case 112                   
           FC(0)=$7C:FC(1)=$14:FC(2)=$14:FC(3)=$14:FC(4)=$08:FC(5)=$00' ' // p
        Case 113                   
           FC(0)=$08:FC(1)=$14:FC(2)=$14:FC(3)=$18:FC(4)=$7C:FC(5)=$00' ' // q
        Case 114                   
           FC(0)=$7C:FC(1)=$08:FC(2)=$04:FC(3)=$04:FC(4)=$08:FC(5)=$00' ' // r
        Case 115                   
           FC(0)=$48:FC(1)=$54:FC(2)=$54:FC(3)=$54:FC(4)=$20:FC(5)=$00' ' // s
        Case 116                   
           FC(0)=$04:FC(1)=$3F:FC(2)=$44:FC(3)=$40:FC(4)=$20:FC(5)=$00' ' // t
        Case 117                   
           FC(0)=$3C:FC(1)=$40:FC(2)=$40:FC(3)=$20:FC(4)=$7C:FC(5)=$00' ' // u
        Case 118                   
           FC(0)=$1C:FC(1)=$20:FC(2)=$40:FC(3)=$20:FC(4)=$1C:FC(5)=$00' ' // v
        Case 119                   
           FC(0)=$3C:FC(1)=$40:FC(2)=$30:FC(3)=$40:FC(4)=$3C:FC(5)=$00' ' // w
        Case 120                   
           FC(0)=$44:FC(1)=$28:FC(2)=$10:FC(3)=$28:FC(4)=$44:FC(5)=$00' ' // x
        Case 121                   
           FC(0)=$0C:FC(1)=$50:FC(2)=$50:FC(3)=$50:FC(4)=$3C:FC(5)=$00' ' // y
        Case 122                   
           FC(0)=$44:FC(1)=$64:FC(2)=$54:FC(3)=$4C:FC(4)=$44:FC(5)=$00' ' // 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:FC(5)=$00' ' // 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:FC(5)=$00' ' // 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:FC(5)=$00' ' // Frown face (shown as } in Lookdown table)
        case 126
            FC(0)=$10:FC(1)=$08:FC(2)=$08:FC(3)=$10:FC(4)=$08:FC(5)=$00''  // ~

end SELECT
        
FOR CharLine=0 to 5
     GOSUB PomeriNiz
     Displej[i-1]=FC(CharLine)
     GOSUB Prikazi_Niz
     PAUSE BrzinaSkrolovanja
     Next CharLine
Return
        
        
        
        
        
PomeriNiz:
            For i=0 to 23
            Displej[i]=displej[i+1]
            next i         
return


Prikazi_Niz:
    for Y =0 to 7
       ADDRESS = Y+1
       DATAREG1 = displej[y]
       DATAREG2 = displej[y+8]
       DATAREG3 = displej[y+16]
       gosub MaxWrite
    next Y
return



MaxWrite:
shiftout DAT,CLK,MSBFIRST,[ADDRESS,DATAREG3,ADDRESS,DATAREG2,ADDRESS,DATAREG1] 'Shift out the data to the 'MAX7219 'first the address, then data.
pulsout LOAD,1 'load the data into the MAX7219
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 »

Drago mi je da ti uspelo. Nema na cemu... Daj neki snimak ili sliku da vidimo kako to izgleda.
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: MAX7219 I 8X8 LED DISPLAY

Post by febo26 »

STRING preko makroa ne radi. I dalje ispisuje samo svako drugo slovo,ali to mi nije ni previse bitno,ako uspijem skuziti problem OK ako ne nema veze

VARIJABLA radi perfektno preko makroa,evo i primjera.

Primjer ispisa varijable preko makroa:

Code: Select all

'****************************************************************
'*  Name    : UNTITLED.BAS                                      *
'*  Author  : ZELJKO FERIC                                      *
'*  Notice  : Copyright (c) 2014 [select VIEW...EDITOR OPTIONS] *
'*          : All Rights Reserved                               *
'*  Date    : 25.10.2014                                        *
'*  Version : 1.0                                               *
'*  Notes   :                                                   *
'*          :                                                   *
'****************************************************************
        INCLUDE "pedja_MACRO2.pbp"
                
temperatura var word
temperatura = 1

main:
temperatura = temperatura +5
@ PrintVar _temperatura
pause 1000
goto main

i include file PEDJA MACRO2

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   :                                                   *
'*          :                                                   *
'****************************************************************
 @ ERRORLEVEL -306 ; turn off crossing page boundary message
	 #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

       

       
VarData         var word 

        '-----VARIABLES-----
        ADDRESS  var byte  'variable address for display
        DATAREG  var byte
        DATAREG1  var byte
        DATAREG2  var byte
        DATAREG3  var byte 'variable data register for display
        Y        VAR BYTE  'okomice
        i        var byte
        FC       VAR BYTE[6]
        BrzinaSkrolovanja VAR WORD
        CHAR      VAR byte
        Addr      VAR word
        Lcd_Data  var byte
        CharLine  var byte
        Displej   var byte[24]
        r var byte
        BrzinaSkrolovanja = 20
         wordChar var word
         t var byte
        
        '----- symbolos ------ 
        '-----PIN SETUPS-----
        SYMBOL CLK = PORTB.0
        SYMBOL DAT = PORTB.1
        SYMBOL LOAD = PORTB.2
        
        
inicijalizacija :  
'MAX7219 chipa obavezno na pocetku programa
        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' NO SHUT, NORMAL OPERATION 
        shiftout DAT,CLK,MSBFIRST,[ADDRESS,DATAREG,ADDRESS,DATAREG,ADDRESS,DATAREG] 'Shift out the data to the 'MAX7219 'first the address, then data.
        pulsout LOAD,1
         
        ADDRESS = $09 : DATAREG = $00  ' COMBINACION BINARIA, NO DECODE
           shiftout DAT,CLK,MSBFIRST,[ADDRESS,DATAREG,ADDRESS,DATAREG,ADDRESS,DATAREG] 'Shift out the data to the 'MAX7219 'first the address, then data.
        pulsout LOAD,1
        
        
        ADDRESS = $0A : DATAREG = $02  ' INTENSIDAD DE LEDS 1(MIN) A F(MAX)
           shiftout DAT,CLK,MSBFIRST,[ADDRESS,DATAREG,ADDRESS,DATAREG,ADDRESS,DATAREG] 'Shift out the data to the 'MAX7219 'first the address, then data.
        pulsout LOAD,1
        
        
        ADDRESS = $0B : DATAREG = $07  ' SCAN LIMIT NUMERO DE DIGITOS
           shiftout DAT,CLK,MSBFIRST,[ADDRESS,DATAREG,ADDRESS,DATAREG,ADDRESS,DATAREG] 'Shift out the data to the 'MAX7219 'first the address, then data.
        pulsout LOAD,1
        
        
        ADDRESS = $0F : DATAREG = $00
           shiftout DAT,CLK,MSBFIRST,[ADDRESS,DATAREG,ADDRESS,DATAREG,ADDRESS,DATAREG] 'Shift out the data to the 'MAX7219 'first the address, then data.
        pulsout LOAD,1
        
      goto overlcd
        
  ' @ PrintVar macro function 
' format should look like this: @ PrintVar x,y, _anyvariable
ASM
PrintVar macro  Variable   ; input values from: @PrintVar 0,1, _any_variable  
    local OverVar                
    goto OverVar                
OverVar
         
    MOVE?WW  Variable, _VarData ; move variable in statement to VarData
    L?CALL   _GLCD_VariableOut       ; call VariableOut function
    endm
ENDASM

GLCD_VariableOut:
 For t = 4 to 0 step -1
  
char= 48+ vardata DIG t
	If vardata<10000 and t=4 then char= 32' Zero Suppression for the second digit
	If vardata<1000 and t=3 then char= 32	' Zero Suppression for the Third digit
	If vardata<100 and t=2 then char= 32	' Zero Suppression for the Forth digit
	If vardata<10 and t=1 then char= 32
gosub SendChar
NEXT t
                  
       
return
        
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:FC(5)=$00'' // !
        Case 34                   
           FC(0)=$00:FC(1)=$07:FC(2)=$00:FC(3)=$07:FC(4)=$00:FC(5)=$00' ' // " (shown as \ in Lookdown table)
        Case 35                   
           FC(0)=$14:FC(1)=$7f:FC(2)=$14:FC(3)=$7f:FC(4)=$14:FC(5)=$00' ' // #
        Case 36                   
           FC(0)=$24:FC(1)=$2a:FC(2)=$7f:FC(3)=$2a:FC(4)=$12:FC(5)=$00' ' // $
        Case 37                   
           FC(0)=$c4:FC(1)=$c8:FC(2)=$10:FC(3)=$26:FC(4)=$46:FC(5)=$00' ' // %
        Case 38                   
           FC(0)=$36:FC(1)=$49:FC(2)=$55:FC(3)=$22:FC(4)=$50:FC(5)=$00' ' // &
        Case 39                   
           FC(0)=$00:FC(1)=$05:FC(2)=$03:FC(3)=$00:FC(4)=$00:FC(5)=$00' ' // '
        Case 40                   
           FC(0)=$00:FC(1)=$1c:FC(2)=$22:FC(3)=$41:FC(4)=$00:FC(5)=$00' ' // (
        Case 41                   
           FC(0)=$00:FC(1)=$41:FC(2)=$22:FC(3)=$1c:FC(4)=$00:FC(5)=$00' ' // )
        Case 42                   
           FC(0)=$14:FC(1)=$08:FC(2)=$3E:FC(3)=$08:FC(4)=$14:FC(5)=$00' ' // *
        Case 43                                             
           FC(0)=$08:FC(1)=$08:FC(2)=$3E:FC(3)=$08:FC(4)=$08:FC(5)=$00' ' // +
        Case 44                   
           FC(0)=$00:FC(1)=$00:FC(2)=$50:FC(3)=$30:FC(4)=$00:FC(5)=$00' ' // ,
        Case 45                   
           FC(0)=$10:FC(1)=$10:FC(2)=$10:FC(3)=$10:FC(4)=$10:FC(5)=$00' ' // -
        Case 46                   
           FC(0)=$00:FC(1)=$60:FC(2)=$60:FC(3)=$00:FC(4)=$00:FC(5)=$00' ' // .
        Case 47                   
           FC(0)=$20:FC(1)=$10:FC(2)=$08:FC(3)=$04:FC(4)=$02:FC(5)=$00' ' // /
        Case 48                   
           FC(0)=$3E:FC(1)=$51:FC(2)=$49:FC(3)=$45:FC(4)=$3E:FC(5)=$00' ' // 0
        Case 49                   
           FC(0)=$00:FC(1)=$42:FC(2)=$7F:FC(3)=$40:FC(4)=$00:FC(5)=$00' ' // 1  :FC(5)=$00:FC(6)=$00:FC(7)=$00
        Case 50                   
           FC(0)=$42:FC(1)=$61:FC(2)=$51:FC(3)=$49:FC(4)=$46:FC(5)=$00' ' // 2
        Case 51                   
           FC(0)=$21:FC(1)=$41:FC(2)=$45:FC(3)=$4B:FC(4)=$31:FC(5)=$00' ' // 3
        Case 52                   
           FC(0)=$18:FC(1)=$14:FC(2)=$12:FC(3)=$7F:FC(4)=$10:FC(5)=$00' ' // 4
        Case 53                   
           FC(0)=$27:FC(1)=$45:FC(2)=$45:FC(3)=$45:FC(4)=$39:FC(5)=$00' ' // 5
        Case 54                   
           FC(0)=$3C:FC(1)=$4A:FC(2)=$49:FC(3)=$49:FC(4)=$30:FC(5)=$00' ' // 6
        Case 55                   
           FC(0)=$01:FC(1)=$71:FC(2)=$09:FC(3)=$05:FC(4)=$03:FC(5)=$00' ' // 7
        Case 56                   
           FC(0)=$36:FC(1)=$49:FC(2)=$49:FC(3)=$49:FC(4)=$36:FC(5)=$00' ' // 8
        Case 57                   
           FC(0)=$06:FC(1)=$49:FC(2)=$49:FC(3)=$29:FC(4)=$1E:FC(5)=$00' ' // 9
        Case 58                   
           FC(0)=$00:FC(1)=$36:FC(2)=$36:FC(3)=$00:FC(4)=$00:FC(5)=$00' ' // :
        Case 59                   
           FC(0)=$00:FC(1)=$56:FC(2)=$36:FC(3)=$00:FC(4)=$00:FC(5)=$00' ' // ";"
        Case 60                   
           FC(0)=$08:FC(1)=$14:FC(2)=$22:FC(3)=$41:FC(4)=$00:FC(5)=$00' ' // <
        Case 61                   
           FC(0)=$14:FC(1)=$14:FC(2)=$14:FC(3)=$14:FC(4)=$14 :FC(5)=$00'' // =
        Case 62                   
           FC(0)=$00:FC(1)=$41:FC(2)=$22:FC(3)=$14:FC(4)=$08:FC(5)=$00' ' // >
        Case 63                   
           FC(0)=$02:FC(1)=$01:FC(2)=$51:FC(3)=$09:FC(4)=$06:FC(5)=$00' ' // ?
        Case 64                   
           FC(0)=$32:FC(1)=$49:FC(2)=$59:FC(3)=$51:FC(4)=$3E:FC(5)=$00' ' // @
        Case 65                   
           FC(0)=$7E:FC(1)=$11:FC(2)=$11:FC(3)=$11:FC(4)=$7E :FC(5)=$00' // A
        Case 66                   
           FC(0)=$7F:FC(1)=$49:FC(2)=$49:FC(3)=$49:FC(4)=$36:FC(5)=$00' // B
        Case 67                   
           FC(0)=$3E:FC(1)=$41:FC(2)=$41:FC(3)=$41:FC(4)=$22:FC(5)=$00' // C
        Case 68                   
           FC(0)=$7F:FC(1)=$41:FC(2)=$41:FC(3)=$22:FC(4)=$1C:FC(5)=$00' // D
        Case 69                   
           FC(0)=$7F:FC(1)=$49:FC(2)=$49:FC(3)=$49:FC(4)=$41:FC(5)=$00' // E
        Case 70                   
           FC(0)=$7F:FC(1)=$09:FC(2)=$09:FC(3)=$09:FC(4)=$01:FC(5)=$00' // F
        Case 71                   
           FC(0)=$3E:FC(1)=$41:FC(2)=$49:FC(3)=$49:FC(4)=$7A:FC(5)=$00' // G
        Case 72                   
           FC(0)=$7F:FC(1)=$08:FC(2)=$08:FC(3)=$08:FC(4)=$7F:FC(5)=$00'// H
        Case 73                   
           FC(0)=$00:FC(1)=$41:FC(2)=$7F:FC(3)=$41:FC(4)=$00:FC(5)=$00' // I
        Case 74                   
           FC(0)=$20:FC(1)=$40:FC(2)=$41:FC(3)=$3F:FC(4)=$01:FC(5)=$00': // J
        Case 75                   
           FC(0)=$7F:FC(1)=$08:FC(2)=$14:FC(3)=$22:FC(4)=$41:FC(5)=$00' // K
        Case 76                   
           FC(0)=$7F:FC(1)=$40:FC(2)=$40:FC(3)=$40:FC(4)=$40:FC(5)=$00' // L
        Case 77                   
           FC(0)=$7F:FC(1)=$02:FC(2)=$0C:FC(3)=$02:FC(4)=$7F:FC(5)=$00':// M
        Case 78                   
           FC(0)=$7F:FC(1)=$04:FC(2)=$08:FC(3)=$10:FC(4)=$7F:FC(5)=$00' // N
        Case 79                   
           FC(0)=$3E:FC(1)=$41:FC(2)=$41:FC(3)=$41:FC(4)=$3E:FC(5)=$00' // O
        Case 80                   
           FC(0)=$7F:FC(1)=$09:FC(2)=$09:FC(3)=$09:FC(4)=$06:FC(5)=$00' // P
        Case 81                   
           FC(0)=$3E:FC(1)=$41:FC(2)=$51:FC(3)=$21:FC(4)=$5E:FC(5)=$00' // Q
        Case 82                   
           FC(0)=$7F:FC(1)=$09:FC(2)=$19:FC(3)=$29:FC(4)=$46:FC(5)=$00' // R
        Case 83                   
           FC(0)=$46:FC(1)=$49:FC(2)=$49:FC(3)=$49:FC(4)=$31:FC(5)=$00' // S
        Case 84                   
           FC(0)=$01:FC(1)=$01:FC(2)=$7F:FC(3)=$01:FC(4)=$01:FC(5)=$00' // T
        Case 85                   
           FC(0)=$3F:FC(1)=$40:FC(2)=$40:FC(3)=$40:FC(4)=$3F:FC(5)=$00' // U
        Case 86                   
           FC(0)=$1F:FC(1)=$20:FC(2)=$40:FC(3)=$20:FC(4)=$1F:FC(5)=$00' // V
        Case 87                   
           FC(0)=$3F:FC(1)=$40:FC(2)=$38:FC(3)=$40:FC(4)=$3F:FC(5)=$00' // W
        Case 88                   
           FC(0)=$63:FC(1)=$14:FC(2)=$08:FC(3)=$14:FC(4)=$63:FC(5)=$00' // X
        Case 89                   
           FC(0)=$07:FC(1)=$08:FC(2)=$70:FC(3)=$08:FC(4)=$07:FC(5)=$00' // Y
        Case 90                   
           FC(0)=$61:FC(1)=$51:FC(2)=$49:FC(3)=$45:FC(4)=$43:FC(5)=$00' // Z
        Case 91                   
           FC(0)=$00:FC(1)=$7F:FC(2)=$41:FC(3)=$41:FC(4)=$00 :FC(5)=$00'' // [
        Case 92                   
            FC(0)=$02:FC(1)=$04:FC(2)=$08:FC(3)=$10:FC(4)=$20 :FC(5)=$00'' // \  (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:FC(5)=$00' ' // ]
        Case 94                   
           FC(0)=$04:FC(1)=$02:FC(2)=$01:FC(3)=$02:FC(4)=$04:FC(5)=$00' ' // ^
        Case 95                   
           FC(0)=$40:FC(1)=$40:FC(2)=$40:FC(3)=$40:FC(4)=$40 :FC(5)=$00'' // _
        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:FC(5)=$00' ' // \ (shown as ` in Lookdown table)
        Case 97                   
           FC(0)=$20:FC(1)=$54:FC(2)=$54:FC(3)=$54:FC(4)=$78:FC(5)=$00' ' // a
        Case 98                   
           FC(0)=$7F:FC(1)=$48:FC(2)=$44:FC(3)=$44:FC(4)=$38:FC(5)=$00'' // b
        Case 99                   
           FC(0)=$38:FC(1)=$44:FC(2)=$44:FC(3)=$44:FC(4)=$20 :FC(5)=$00'' // c
        Case 100                   
           FC(0)=$38:FC(1)=$44:FC(2)=$44:FC(3)=$48:FC(4)=$7F:FC(5)=$00' ' // d
        Case 101                   
           FC(0)=$38:FC(1)=$54:FC(2)=$54:FC(3)=$54:FC(4)=$18:FC(5)=$00' ' // e
        Case 102                   
           FC(0)=$08:FC(1)=$7E:FC(2)=$09:FC(3)=$01:FC(4)=$02:FC(5)=$00' ' // f
        Case 103                   
           FC(0)=$0C:FC(1)=$52:FC(2)=$52:FC(3)=$52:FC(4)=$3E:FC(5)=$00' ' // g
        Case 104                   
           FC(0)=$7F:FC(1)=$08:FC(2)=$04:FC(3)=$04:FC(4)=$78:FC(5)=$00' ' // h
        Case 105                   
           FC(0)=$00:FC(1)=$44:FC(2)=$7D:FC(3)=$40:FC(4)=$00:FC(5)=$00' ' // i
        Case 106                   
           FC(0)=$20:FC(1)=$40:FC(2)=$44:FC(3)=$3D:FC(4)=$00:FC(5)=$00' ' // j
        Case 107                   
           FC(0)=$7F:FC(1)=$10:FC(2)=$28:FC(3)=$44:FC(4)=$00:FC(5)=$00' ' // k
        Case 108                   
           FC(0)=$00:FC(1)=$41:FC(2)=$7F:FC(3)=$40:FC(4)=$00:FC(5)=$00' ' // l
        Case 109                   
           FC(0)=$7C:FC(1)=$04:FC(2)=$18:FC(3)=$04:FC(4)=$78:FC(5)=$00' ' // m
        Case 110                   
           FC(0)=$7C:FC(1)=$08:FC(2)=$04:FC(3)=$04:FC(4)=$78:FC(5)=$00' ' // n
        Case 111                   
           FC(0)=$38:FC(1)=$44:FC(2)=$44:FC(3)=$44:FC(4)=$38 :FC(5)=$00'' // o
        Case 112                   
           FC(0)=$7C:FC(1)=$14:FC(2)=$14:FC(3)=$14:FC(4)=$08:FC(5)=$00' ' // p
        Case 113                   
           FC(0)=$08:FC(1)=$14:FC(2)=$14:FC(3)=$18:FC(4)=$7C:FC(5)=$00' ' // q
        Case 114                   
           FC(0)=$7C:FC(1)=$08:FC(2)=$04:FC(3)=$04:FC(4)=$08:FC(5)=$00' ' // r
        Case 115                   
           FC(0)=$48:FC(1)=$54:FC(2)=$54:FC(3)=$54:FC(4)=$20:FC(5)=$00' ' // s
        Case 116                   
           FC(0)=$04:FC(1)=$3F:FC(2)=$44:FC(3)=$40:FC(4)=$20:FC(5)=$00' ' // t
        Case 117                   
           FC(0)=$3C:FC(1)=$40:FC(2)=$40:FC(3)=$20:FC(4)=$7C:FC(5)=$00' ' // u
        Case 118                   
           FC(0)=$1C:FC(1)=$20:FC(2)=$40:FC(3)=$20:FC(4)=$1C:FC(5)=$00' ' // v
        Case 119                   
           FC(0)=$3C:FC(1)=$40:FC(2)=$30:FC(3)=$40:FC(4)=$3C:FC(5)=$00' ' // w
        Case 120                   
           FC(0)=$44:FC(1)=$28:FC(2)=$10:FC(3)=$28:FC(4)=$44:FC(5)=$00' ' // x
        Case 121                   
           FC(0)=$0C:FC(1)=$50:FC(2)=$50:FC(3)=$50:FC(4)=$3C:FC(5)=$00' ' // y
        Case 122                   
           FC(0)=$44:FC(1)=$64:FC(2)=$54:FC(3)=$4C:FC(4)=$44:FC(5)=$00' ' // 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:FC(5)=$00' ' // 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:FC(5)=$00' ' // 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:FC(5)=$00' ' // Frown face (shown as } in Lookdown table)
        case 126
            FC(0)=$10:FC(1)=$08:FC(2)=$08:FC(3)=$10:FC(4)=$08:FC(5)=$00''  // ~
end SELECT
        
FOR CharLine=0 to 5
     GOSUB PomeriNiz
     Displej[i-1]=FC(CharLine)
     GOSUB Prikazi_Niz
     PAUSE BrzinaSkrolovanja
     Next CharLine
Return
        
        
        
        
        
PomeriNiz:
            For i=0 to 23
            Displej[i]=displej[i+1]
            next i         
return


Prikazi_Niz:
    for Y =0 to 7
       ADDRESS = Y+1
       DATAREG1 = displej[y]
       DATAREG2 = displej[y+8]
       DATAREG3 = displej[y+16]
       gosub MaxWrite
    next Y
return



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

    
    
 overlcd: 

        

        
        
        
        
        

             
        

     
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 »

Probaj umesto data u makrou staviti DW pa da vidimo onda sta ce biti. Probao bi ja, ali nisam pri kompijuteru...
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: MAX7219 I 8X8 LED DISPLAY

Post by febo26 »

Da li si mislio na makro za string da prepravim u ovaj oblik:

Code: Select all

         ASM
    PrintStr macro  Str
        local TheString, OverStr
        goto OverStr
    TheString
        DW  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
data je zamjenjen u DW i nema razlike i dalje svako drugo slovo.
Nema razlike isto cita svako drugo slovo.
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 sam mislio... Mozes probati i da zamenis DW sa DB, ako i onda daje svako drugo, onda ne znam zasto ne radi, i sta se desava. A to bi mi ponekad zatrebalo, pa ako ovo sa DB ne bude radilo moracu baciti oko ocemu se tacno radi.
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: MAX7219 I 8X8 LED DISPLAY

Post by febo26 »

Sad sam nabrzaka isprobao to zamjenit i dobijem ovaj rezultat:

Ako napisem ovako : DB Str, 0 onda cita ova slova ej09)
a ako napisem DB, Str, 0 onda pise ova slova Pda8:

rijec je za ispis Pedja089:)

Razlika je u zarezu iz DB
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 »

Probaj sa zarezom, i ovo bi trebalo onda da radi

Code: Select all

Na pocetku include stavi 
wordChar   var word
Addr    var word
Ovo dole zameni...
    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
Post Reply