Zadatak: Napisati program za GLCD

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: Zadatak: Napisati program za GLCD

Post by febo26 »

Evo ga,uspio sam prokuziti kako da u istom redu imam ispis stringa i u nastavku njega ispis varijable pomocu pedjinog koda.

primjer:

Code: Select all

'****************************************************************
'*  Name    : UNTITLED.BAS                                      *
'*  Author  : [select VIEW...EDITOR OPTIONS]                    *
'*  Notice  : Copyright (c) 2012 [select VIEW...EDITOR OPTIONS] *
'*          : All Rights Reserved                               *
'*  Date    : 14.12.2012                                        *
'*  Version : 1.0                                               *
'*  Notes   :                                                   *
'*          :                                                   *
'****************************************************************
  @ ERRORLEVEL -306 ; turn off crossing page boundary message
   define OSC 20
  include "glcd.pbp"

   
    
       TRISA = $00     'Postavi sve pinove porta A kao IZLAZNI  
   TRISB = %00000000  'Postavi sve pinove porta B kao ulazne  
   TRISC = $00     'Postavi sve pinove porta C kao IZLAZNI 
   TRISD = $00     'Postavi sve pinove porta D kao izlazne 
   TRISE = %000    'Postavi sve pinove porta E kao ulazne
   ADCON1 = 7	   ' PORTA i PORTE su digitalni  ISKLJUCI KOMPARATORE I ANALOGNE ULAZE
   Hour var word
   Hour=1
   
   
   START:
  hour= Hour +1
  if Hour = 255 then Hour = 0
 @ PrintStr 1,0, "TEMPERATURA: " 
 @ PrintVar 0,0, _Hour
 @ PrintStr 93,0, "C" 
 @ PrintStr 1,1, "PRITISAK : " 
 @ PrintVar 0,1, _Hour
 @ PrintStr 82,1, " hP" 
 @ PrintStr 1,2, "VLAZNOST : " 
 @ PrintVar 0,2, _Hour
 @ PrintStr 82,2, " %Rh" 
 @ PrintStr 1,3, "SMJER VJETRA: " 
 @ PrintVar 0,3, _Hour
 @ PrintStr 1,4, "BRZINA VJETRA: " 
 @ PrintVar 0,4, _Hour
 @ PrintStr 105,4, "kmH" 
 
    pause 1000
    gosub lcd_clr
    goto start
    END
GLCD komanda kako ce izgledati i sto ce se pomocu nje moci ispisivati?
Kako ste dobili na onim slikama s pocetka teme onako debela slova u ispisu PEDJA?
Na koji nacin se mogu nacrtati pravokutnik ,krug ili neki drugi oblik na GLCD-u.?da li se to moze nacrtati s PBPom.Vidio sam da MicroBasic od Mikroelektronike ima tu mogucnost.
User avatar
pedja089
Administrator sajta
Administrator sajta
Posts: 7877
Joined: 20-02-2007, 14:50
Location: Beočin -Srbija

Re: Zadatak: Napisati program za GLCD

Post by pedja089 »

Trebalo bi isto kao i lcdout. Jer pbp 3, podrzava pisanje komandi...
A samo redjas 8 po 8 bita... Prvo nacrtas na nekoj mrezici 128x128 piksela, pa onda racunas... Isto ko i ona 2 smajlija.
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: Zadatak: Napisati program za GLCD

Post by febo26 »

Da li se netko igrao s ovima displejima s Ebaya

http://www.ebay.com/itm/1PCS-12864-128X ... 3cc6d99d2e

u pola cijene je u odnosu na KS0108 displey.
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: Zadatak: Napisati program za GLCD

Post by febo26 »

Pitanje u vezi Pedjinog glcd.pbp fajla
da li je moguce s njim u istom redu ispisat vise varijabli
npr za ispis vremena na GLCDu , s obicnim LCDom to nije problem ali ovo ne kuzim kako izvest.

TIME: hr : min : sec
string varijabla string varijabla string varijabla

Da li bi to tako bilo moguce ispisat

hr,min,sec se citaju iz DS1337 rtc chipa
User avatar
pedja089
Administrator sajta
Administrator sajta
Posts: 7877
Joined: 20-02-2007, 14:50
Location: Beočin -Srbija

Re: Zadatak: Napisati program za GLCD

Post by pedja089 »

Moguce, samo za svaku promenljivu novi glcdout....
Ako se ne varam ima i primer.
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: Zadatak: Napisati program za GLCD

Post by febo26 »

Glcdout ? nema toga u vasem glcd.pbp fajlu
Ima samo print string i print var.
uspio sam nesto dobiti,ali nisam zadovoljan rezultatom,nece pomaknuti po x osi varijablu onako kako mu napisem.

TIME:00: taj dio je ok ,ali onda dok trebam ubacit minute tu mi se nesto svadja,ili mi preklopi nule jednu preko druge ili mi ih razdvoji ili presjece po pola prvu nulu.
Za sada toliko,navecer cu se nastaviti igrati s GLCDom.
User avatar
Gromit
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 331
Joined: 08-01-2011, 05:36
Location: Hrvatska

Re: Zadatak: Napisati program za GLCD

Post by Gromit »

febo26 wrote:Da li se netko igrao s ovima displejima s Ebaya

http://www.ebay.com/itm/1PCS-12864-128X ... 3cc6d99d2e

u pola cijene je u odnosu na KS0108 displey.
Ja sam ga dobio za oko 35kn, na aukciji. Naravno da je upola cijene, jer je namjenjen prvenstveno za 9000+ kineskih slova i samo "usput" ima latinski ASCII skup. Inaće radi normalno kao i svaki grafički LCD. Ima zeznuti kontroler ST7920, kad se pišu naša slova moraju se slat po 2 slova istodobno, jer im je matrica 8x16 pixela (što odgovara 4x16 alfanumeričkom displayu), teško je nač podatke za njega, datasheet je više dataŠIT :) !
Ali, uspio sam nač program za 89S51 (u C-u), pa tko hoće može probat izvuć "algoritam" za prikaz.
Probat ću ga ovdje prekopirat:

Code: Select all

#ifndef _LCDdriver_H_
#define _LCDdriver_H_

#define DATE		portc
#define BUSY		portc.7
#define RS			portb.4
#define RW			porta.5
#define EN			portb.1

/*****************ORDER********************************/
#define SET_NC		0x02//set the cursor to start but no clear the screen
#define SET_C		0x01//set the addres to start and clear the screen
#define CLE			0x00//clear the screen
#define CUR_ON		0x0f//turn on the cursor to flash
#define CUR_OFF		0x0c//turn off the cursor
/******************************************************/

rom char *psotion_lcd = {0x80, 0x90, 0x88, 0x98};

void DelayS(void)
{
	 uchar i;
	 i = 0x1f;
	 while(i--);
}
void wait_5ms( void )
{
	unsigned int i ;
	for( i=0 ; i<1000 ; i++ );
}
void wait_for_busy(void)
{
	trisc = 0xff;
	RS = 0;
	RW = 1;
	EN = 1;
	while(BUSY); // wait while busy set
	EN = 0;
	trisc = 0x00;
}
void WriteCmd(uchar ch)
{
     wait_for_busy();
     DelayS();
     EN 	= 0;
     RS 	= 0;
     RW 	= 0;
     nop();
     EN 	= 1;
     DATE	= ch;
	 nop();
     EN		= 0;
}
void WriteData(uchar ch)
{
     wait_for_busy();
     DelayS();
     EN 	= 0;
     RS 	= 1;
     RW 	= 0;
     nop();
     EN 	= 1;
     DATE	= ch;
	 nop();
     EN 	= 0;
     RS 	= 0;
}
void InitLcd(void)
{
	 //RST=0;
     wait_5ms();
	// RST=1;
	 wait_5ms();
	 wait_5ms();
	 WriteCmd(0x30);
	 WriteCmd(0x0c);
	 WriteCmd(0x01);
     WriteCmd(0x02);
	 WriteCmd(0x80);
}
/*******************************************************
function: set the addres for DBC
e.g:    1,1 1,2					1,7	1,8
		2,1					2,6		2,8
		3,1		3,3					3,8
		4,1			4,4	4,5			4,8
*******************************************************/
void set_addres(uchar row,uchar column)
{
	WriteCmd(psotion_lcd[row]+column);
}
/*********************************************************
function:write ch on the postion of row and column
**********************************************************/
void write_dbc(uchar row,uchar column,uchar *ch)
{
	uchar c,pi=0;
	WriteCmd(psotion_lcd[row]+column);
	while(1)
	{
		c = ch[pi++];
		if ( !c )
			break;
		WriteData(c);
	}
}
/*******************************************************
function: set the addres for SBC
e.g:    1,1 1,2					1,7	1,8
		2,1					2,6		2,8
		3,1		3,3					3,8
		4,1			4,4	4,5			4,8
*******************************************************/
void display(uchar x_add,uchar y_add,uchar dat1,uchar dat2)
{
	WriteCmd(psotion_lcd[x_add]+y_add);	
     WriteData(dat1);
     WriteData(dat2);
}
/*****************************************
function: display the welcome message
*****************************************/
void welcome(void)
{
    uchar i,j;
    WriteCmd(CLE);
    clear_wdt();
    wait_5ms();
    for(i=1; i<5; i++)
    {
    	for(j=7; j>i; j--)
    	{
    		display(1,j+1,0xD7,0xa0);//clear
    		switch(i)
    		{
				case 1:
					display(1,j,0xba,0xcf);//合
					break;
				case 2:
					display(1,j,0xb3,0xc9);//成
					break;
				case 3:
					display(1,j,0xb5,0xe7);//电
					break;
				case 4:
					display(1,j,0xc6,0xf7);//器
					break;
				default:
					write_dbc(1,3,"erro!!!");
			}
    	delay_s(1);
		clear_wdt();
    	}
    }
	for(i=0; i<2; i++)
	{
		delay_s(2);
		clear_wdt();
	}
	WriteCmd(CLE);
}
/*********************************************************
function:write ch on the postion of row and column
**********************************************************/
void write_dbc_l(uchar row,uchar column, uchar len, uchar *ch)
{
	uchar c,pi=0;
	WriteCmd(psotion_lcd[row]+column);	
	while(len--)
	{
		c = ch[pi++];
		WriteData(c);
	}
}
#endif
Ja se nisam s time petljao, ali sam našao kod (ruski :D ) za BascomAVR i Atmegu8, pa se možete i sa njime igrat. Njega sam isprobao i - RADI! Sad iz tog koda treba izvuč naredbe, inicijalizaciju itd...

Code: Select all

Izvor: http://bascomavr.3bb.ru/viewtopic.php?id=736
=====================================================
Может кому пригодится рабочий код на графический ЖКИ 128*64 с контроллером ST7920, модель JN12864J V1.2

подключено 8-битной шиной, вывод Psb  подключить на плюс питания (через резистор 1-10 ком) - это выбор параллельной шины обмена
ДЛЯ AVR ATMEGA8

в теле кода есть два обращения к порту напрямую, учитывайте при переназначении выводов!
-------------------------
Maybe someone will come in handy working code for graphic LCD 128 x 64 to the controller ST7920, model JN12864J V1.2

Connect the 8-bit bus, the output Psb connect to positive supply (via a resistor 1.10 com) - is the choice of parallel bus
FOR AVR ATMEGA8

in the body of the code, there are two access port directly, consider the remapping of conclusions! 
-----------------------------
Код:

'Рабочий код на графический ЖКИ 128*64 с контроллером ST7920, модель JN12864J V1.2
'Подключено 8-битной шиной,
'Вывод Psb  подключить на плюс питания (через резистор 1-10 ком) - это выбор параллельной шины обмена
'В теле кода есть два обращения к порту напрямую, учитывайте при переназначении выводов!

'Для AVR ATMEGA8



$regfile = "m8def.dat"
$crystal = 8000000

$hwstack = 32
$swstack = 20
$framesize = 40

Declare Sub Lcdstart()
Declare Sub Lcdimgcls()
Declare Sub Lcdcommand(ir As Byte)
Declare Sub Lcdwrite(dr_en As Byte)
Declare Function Lcdget() As Byte
Declare Sub Showstr(zf As String)
Declare Sub Point(x As Byte , Y As Byte)
Declare Sub Lcdline(px1 As Byte , Py1 As Byte , Px2 As Byte , Py2 As Byte )
Declare Sub Lcdcircle(px1 As Byte , Py1 As Byte , Rcircle As Byte)

Outport Alias Portb
Getport Alias Pinb
Config Outport = Output


Rs Alias Portc.4                   'H: Data    L: Instruction Code
Config Rs = Output

Rw Alias Portc.3                   'H: Read    L: Write
Config Rw = Output

E Alias Portc.2
Config E = Output

Rst Alias Portc.0
Config Rst = Output


Dim Mybyte As Byte
Dim Myword As Word
Dim Lcdstr As String * 32
Dim Lcdx As Byte , Lcdy As Byte
Dim Pstx As Byte , Psty As Byte
Dim Xx1 As Byte , Yy1 As Byte , Xx2 As Byte , Yy2 As Byte

Dim K As Single , Mysingle As Single
Dim Dx As Integer , Dy As Integer
Dim X As Byte , Y As Byte
Dim Xi As Byte , Yi As Byte
Dim Xadrs As Byte , Yadrs As Byte , Xpos As Byte
Dim Byteh As Byte , Bytel As Byte
Const Pi = 3.1416


   Call Lcdstart

   Mybyte = &B_1001_1000 : Lcdcommand Mybyte

   Lcdstr = "ST7920.BascomAvr" : Showstr Lcdstr


   Mybyte = &B_0011_0100 : Lcdcommand Mybyte       ' EXTENDEN instruction
   Mybyte = &B_0011_0110 : Lcdcommand Mybyte       ' GRAGIC display On

   Call Lcdimgcls


   Psty = 0
   For Pstx = 0 To 127
      Point Pstx , Psty
   Next


   Pstx = 0
   For Psty = 0 To 63
      Point Pstx , Psty
   Next


   Pstx = 127
   For Psty = 0 To 63
      Point Pstx , Psty
   Next


   Psty = 63
   For Pstx = 0 To 127
      Point Pstx , Psty
   Next



   Pstx = 35 : Psty = 17 : Mybyte = 15
   Lcdcircle Pstx , Psty , Mybyte

   Pstx = 66 : Psty = 17 : Mybyte = 15
   Lcdcircle Pstx , Psty , Mybyte

   Pstx = 97 : Psty = 17 : Mybyte = 15
   Lcdcircle Pstx , Psty , Mybyte

   Pstx = 50 : Psty = 34 : Mybyte = 15
   Lcdcircle Pstx , Psty , Mybyte

   Pstx = 81 : Psty = 34 : Mybyte = 15
   Lcdcircle Pstx , Psty , Mybyte


   Xx1 = 0 : Yy1 = 49 : Xx2 = 127 : Yy2 = 49
   Lcdline Xx1 , Yy1 , Xx2 , Yy2


Wait 2


   Xx1 = 0 : Yy1 = 0 : Xx2 = 127 : Yy2 = 49
   Lcdline Xx1 , Yy1 , Xx2 , Yy2

   Xx1 = 0 : Yy1 = 49 : Xx2 = 127 : Yy2 = 0
   Lcdline Xx1 , Yy1 , Xx2 , Yy2



End



Sub Lcdstart()
   Reset Rst : Waitms 50 : Set Rst

   Reset Rw
   Reset E

   Waitms 50

   Mybyte = &B_0011_0000 : Lcdcommand Mybyte : Waitms 150       ' Set 8-bit interface
   Mybyte = &B_0011_0000 : Lcdcommand Mybyte

   Mybyte = &B_0000_0001 : Lcdcommand Mybyte       ' Clear Display
   Waitms 2

   Mybyte = &B_0000_0110 : Lcdcommand Mybyte       ' Entry Mode Set
   Mybyte = &B_0000_1100 : Lcdcommand Mybyte       ' Control Display
End Sub



Function Lcdget()as Byte
   E = 0 : Rs = 1 : Rw = 1
   E = 1
   Config Outport = Input          ' Input
   nop
   Lcdget = Getport                ' Read
   nop
   E = 0
   Rw = 0
   Waitus 80
   Config Outport = Output
End Function



Sub Lcdcommand(ir As Byte)
   E = 0
   Rs = 0
   E = 1
   nop
   Outport = Ir
   nop
   E = 0
   Waitus 80
End Sub


Sub Lcdwrite(dr_en As Byte)
   E = 0
   Rs = 1
   E = 1
   nop
   Outport = Dr_en
   nop
   E = 0
   Waitus 80
End Sub


Sub Showstr(zf As String)
   Local T As Byte , I As Byte , Zf1 As String * 1
   Zf = Format(zf , "00")
   For T = 1 To Len(zf)
      Zf1 = Mid(zf , T , 1)
      I = Asc(zf1)
      Lcdwrite I
   Next
End Sub



Sub Lcdimgcls()
   Mybyte = &H00
   For Lcdx = &H80 To &B10001111
      For Lcdy = &H80 To &B10011111
         Lcdcommand Lcdy
         Lcdcommand Lcdx
         Lcdwrite Mybyte
         Lcdwrite Mybyte
      Next
   Next
End Sub



Sub Point(x As Byte , Y As Byte )
   ' (0,0)-(127,63)
   Xadrs = X \ 16
   Xpos = X Mod 16

   Yadrs = Y \ 32
   Yadrs = Yadrs * 8
   Xadrs = Xadrs + Yadrs

   Yadrs = Y Mod 32


   Xadrs = Xadrs + &H80
   Yadrs = Yadrs + &H80
   Lcdcommand Yadrs
   Lcdcommand Xadrs


   Byteh = Lcdget()
   Byteh = Lcdget()
   Bytel = Lcdget()

   If Xpos < 8 Then
      Xpos = 7 - Xpos
      Xpos = 2 ^ Xpos
      Byteh = Byteh Or Xpos
      Else
      Xpos = 15 - Xpos
      Xpos = 2 ^ Xpos
      Bytel = Bytel Or Xpos
   End If

   Lcdcommand Yadrs
   Lcdcommand Xadrs


   Lcdwrite Byteh
   Lcdwrite Bytel
End Sub



Sub Lcdline(px1 As Byte , Py1 As Byte , Px2 As Byte , Py2 As Byte )
   Dy = Py2 - Py1 : Dx = Px2 - Px1

   If Dy = 0 And Dx = 0 Then
      Point Px1 , Py1
      Exit Sub
   End If

   If Dy = 0 Then
      If Px1 > Px2 Then
         For X = Px1 To Px2 Step -1
            Point X , Py1
         Next
         Else
         For X = Px1 To Px2 Step 1
            Point X , Py1
         Next
      End If
      Exit Sub
   End If

   If Dx = 0 Then
      If Py1 > Py2 Then
         For Y = Py1 To Py2 Step -1
            Point Px1 , Y
         Next
         Else
         For Y = Py1 To Py2 Step 1
            Point Px1 , Y
         Next
      End If
      Exit Sub
   End If

   Xi = Abs(dx) : Yi = Abs(dy)
   If Xi > Yi Then
      K = Dy / Dx
      If Px1 > Px2 Then
         For X = Px1 To Px2 Step -1
            Yi = X - Px1
            Yi = K * Yi
            Y = Py1 + Yi
            Point X , Y
         Next
         Else
         For X = Px1 To Px2 Step 1
            Yi = X - Px1
            Yi = K * Yi
            Y = Py1 + Yi
            Point X , Y
         Next
      End If
      Else
      K = Dx / Dy
      If Py1 > Py2 Then
         For Y = Py1 To Py2 Step -1
            Xi = Y - Py1
            Xi = K * Xi
            X = Px1 + Xi
            Point X , Y
         Next
         Else
         For Y = Py1 To Py2 Step 1
            Xi = Y - Py1
            Xi = K * Xi
            X = Px1 + Xi
            Point X , Y
         Next
      End If
    End If
End Sub



Sub Lcdcircle(px1 As Byte , Py1 As Byte , Rcircle As Byte)
   For Myword = 0 To 359 Step 2
      Mysingle = Myword
      K = Deg2rad(mysingle)

      Mysingle = Sin(k)
      Mysingle = Mysingle * Rcircle
      Xx1 = Mysingle + Px1

      Mysingle = Cos(k)
      Mysingle = Mysingle * Rcircle
      Yy1 = Mysingle + Py1

      Point Xx1 , Yy1
   Next
End Sub
--------------------------------
Navodno, može se inicijalizirat kao svaki HD44780 alfa-display i koristit ga kao 4x16 display, ali nisam još probao...

Nadam se da će nekom biti od pomoći!
LP!
Gromit
Can You hear me, can You hear me?
Through the dark night, far away...
I am dying, forever crying :(
To be with You, who can say...
To be near You, to be F R E E !
User avatar
Gromit
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 331
Joined: 08-01-2011, 05:36
Location: Hrvatska

Re: Zadatak: Napisati program za GLCD

Post by Gromit »

Zaboravih napomenut:

Ako netko ima ovakav display, ili ga namjerava nabavit, spajajte LED preko 500-1000 oma otpornika!
DA- 1kOhm! Toga nema u datasheetu! I ostavite one pinove za kontrast da vise - nespojene, sve je već unutar modula pospojeno, barem, kod mene!
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: Zadatak: Napisati program za GLCD

Post by febo26 »

Hvala Gromite na odgovoru,srecom nisam ih narucio.
Znaci,bolje rjesenje je drzat se KS0108 GLCDa, platit ga malo vise ali bar imamo podrsku za njega.
Mada nije bas neka ponuda za KS0108 na ebayu.
User avatar
Gromit
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 331
Joined: 08-01-2011, 05:36
Location: Hrvatska

Re: Zadatak: Napisati program za GLCD

Post by Gromit »

Da, kolega Febo26, bolje sa tim samsungovim KS kontrolerom, ali i tu ima razlike, pa pazite pri naručivanju: naime neki od tih modula su ČISTO grafički displayi - nemaju ugrađeni skup fontova! Ali ima, a to je posebno naglašeno u ponudi, sa ugrađenim fontom (dodan Eprom čip na modul), pa dobijete ekvivalent 8x20 alfa displaya (+grafika)!

Najbolje je svakako ako možete naći sa Toshibinim kontrolerom T6963C, oni imaju i fontove, podržavaju istodobni i odvojeni prikaz grafike i/ili slova (možete recimo samo obrisat grafiku, a slova ostanu), može radit scroll lijevo-desno gore-dolje i svašta drugo! Dosta su skuplji od KS0108, ali najveći eventualni problem je što su pixeli na večini modula nekvadratični, pa vam recimo kružnica ispadne elipsa i sl., no takvi displayi su i jeftiniji od onih sa kvadratičnim pixelima!

I Samsungovi i Toshibini kontroleri/moduli su podržani u praktički svim programima na koje sam naišao - za PIC, AVR... - Bascom, Proton Basic, Oshonsoft PIC Simulator IDE...

Što se brzine tiće, vidio sam na YT snimke gdje se vidi prikaz (monokromatski istina) videa preko PC-a!
Istini za volju, i ovaj "kineski" sa Sitronicsovim kontrolerom me iznenadio brzinom!

Samo jedan primjer: Arduino + KS0108 graphics LCD = USB Monitor
Can You hear me, can You hear me?
Through the dark night, far away...
I am dying, forever crying :(
To be with You, who can say...
To be near You, to be F R E E !
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: Zadatak: Napisati program za GLCD

Post by febo26 »

Posto preko vikenda nisam uspio natjerati varijable i stringove da rade u istome redu uz sve moguce molitve :azdaja: :evil: :azdaja: prebacio sam se na prikaz slike na ekranu i evo prve slike prikazane na displeju. :lol:

Orginalni kod je od Pedje,skinuo sam ga s picbasicforuma iz rubrike Wishes.
U kodu nisam vrsio nikakve modifikacije nego sam samo ubacio podatke za iscrtavanje slike.
Nemojte zamjerit jer kod nije bas estecki dotjeran i nije previse izkomentiran.
kod za prikaz slike je ovdje:
Procesor je PIC18f4550 trenutno mi se taj nalazio pod rukom,ali mislim da bi trebalo radit i s PIC16f877

Code: Select all

'kristal oscilatora mora biti 4mhz inace nema slike na ekranu

           TRISA = $00     'Postavi sve pinove porta A kao IZLAZNI 
       TRISB = %00000000  'Postavi sve pinove porta B kao ulazne 
       TRISC = $00     'Postavi sve pinove porta C kao IZLAZNI
       TRISD = $00     'Postavi sve pinove porta D kao izlazne
       TRISE = %000    'Postavi sve pinove porta E kao ulazne
       ADCON1 = 7      ' PORTA i PORTE su digitalni  ISKLJUCI KOMPARATORE I ANALOGNE ULAZEsymbol RW  =   portb.3
      symbol RW  =   portb.3
    symbol RS  =   portb.2
    symbol E   =   portb.4
    symbol CS1 =   portb.0 ' 0 pali kontroler ,1 ga gasi
    symbol CS2 =   portb.1
    symbol RST =   portb.5
    symbol LCDDATA = PORTD

    output rw
    output rs
    output e
    output cs1
    output cs2
    output rst
    output lcddata

    X VAR BYTE
    Y VAR BYTE
    I VAR BYTE



    Init: 'inicijalizacija displeja
     x=0 
     y=0 
     rw=0   
     cs1=0 
     cs2=0     
     e=1   
     LCDDATA=0
     rst=0
     pause 1
     rst=1
     cs1=0
     cs2=0
     call dispon
     LCDDATA=192 'postavi prvi red memorije na prvi red glcd-a
     gosub kom
    gosub clr
    
    Main:
call clr

 LCDDATA=0
 call clr
 cs1=0  'levi kontroler ukljucen
 x=0
 call setx

 y=0
 call sety
 for i=0 to 63 ' prvi stupac podaci
    Lookup i, [$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_
     $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_
$00, $00, $00],LCDDATA
call pod
 next i
 
 
 x=1
 y=0
 call sety  'drugi stupac    levog kontrolera
 call setx
 for i=0 to 63 
    Lookup i, [ $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
    $80, $80, $80, $80,_
$80, $40, $40, $40, $40, $40, $40, $20, $20, $20, $20, $20, $20, $20, $20, $20,_ 
$20, $20, $20, $20, $20, $20, $20, $20, $20, $20, $20, $20, $20, $20, $20, $20,_ 
$20, $20, $20, $20, $20, $20, $20, $20, $20, $20, $20, $20, $20, $20, $20, $20_
],LCDDATA
    call pod
 next i
 
 
  x=2
  y=0
 call sety   'treci stupac  levog kontrolera
 call setx
 for i=0 to 63 
    Lookup i, [$00, $00, $00, $00, $00, $FE, $00, $01, $01, $01, $01, $01, $FD,_
     $FD, $FD, $FD,_ 
$01, $01, $01, $01, $01, $01, $FD, $FD, $FD, $FD, $01, $01, $01, $01, $FD, $FD,_ 
$FD, $FD, $F9, $F1, $E1, $C1, $81, $C1, $E1, $F9, $FD, $FD, $FD, $FD, $FD, $01,_ 
$01, $01, $01, $FD, $FD, $FD, $FD, $DD, $DD, $DD, $1D, $11, $01, $FF,_
 $01, $01],LCDDATA
    call pod
 next i

  x=3
  y=0
 call sety  ' cetvrti stupac  levog kontrolera
 call setx
 for i=0 to 63 
    Lookup i, [$00, $00, $00, $00, $00, $3F, $60, $60, $60, $E0, $60, $60, $7F,_
     $7F, $7F, $7F,_
$7C, $7C, $7C, $7C, $60, $60, $7F, $7F, $7F, $7F, $60, $60, $60, $60, $7F, $7F,_ 
$7F, $7F, $61, $67, $6F, $7F, $7F, $6F, $67, $63, $61, $7F, $7F, $7F, $7F, $60,_
$60, $60, $60, $7F, $7F, $7F, $7F, $7D, $7D, $7D, $7C, $74, $60, $7F, $40, $40_
],LCDDATA
    call pod
 next i
 
 
   x=4
  y=0
 call sety  ' cetvrti stupac  levog kontrolera
 call setx
 for i=0 to 63 
    Lookup i, [$00, $00, $00, $00, $00, $00, $00, $00, $00, $01, $01, $01, $01,_
     $01, $01, $01,_ 
$01, $01, $7F, $7F, $7F, $7F, $FF, $FF, $F7, $FB, $7B, $BF, $5F, $5D, $7D, $BD,_
$BD, $3F, $5D, $59, $B1, $73, $F3, $E5, $CF, $1B, $3F, $77, $FF, $CF, $BF, $FF,_ 
$FF, $FF, $FF, $FF, $FF, $FF, $FF, $7F, $7F, $7F, $7F, $7F, $7F, $7F, $7F, $FF_
],LCDDATA
    call pod
 next i
 
 
   x=5
  y=0
 call sety  ' cetvrti stupac  levog kontrolera
 call setx
 for i=0 to 63 
    Lookup i, [$00, $00, $00, $80, $C0, $F8, $F8, $F8, $F8, $FC, $FE, $FE, $FE,_
     $FE, $FE, $FE,_ 
$FE, $FE, $FE, $FE, $FE, $FF, $FF, $FF, $FF, $FF, $F6, $EF, $D0, $F6, $AE, $AD,_ 
$A9, $80, $D1, $D0, $E0, $F7, $F9, $FF, $FF, $FC, $DC, $F0, $7F, $FF, $DF, $FF,_ 
$FF, $FF, $FF, $FF, $FF, $FE, $FE, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FE, $FF_
],LCDDATA
    call pod
 next i
 
 
 
   x=6
  y=0
 call sety  ' cetvrti stupac  levog kontrolera
 call setx
 for i=0 to 63 
    Lookup i, [ $00, $00, $00, $01, $01, $01, $01, $03, $03, $03, $07, $07, _
    $07,$07, $07, $0F,_
$0F, $0F, $07, $0F, $0F, $0F, $07, $07, $0F, $0E, $0F, $0D, $0F, $2F, $2B, $2B,_ 
$2B, $2B, $2B, $2F, $6F, $EF, $FF, $FD, $FD, $FF, $FE, $FF, $FF, $FF, $FF, $FF,_ 
$BF, $BF, $EF, $EF, $EF, $BF, $FF, $BF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF_
],LCDDATA
    call pod
 next i
 
 
 
   x=7
  y=0
 call sety  ' cetvrti stupac  levog kontrolera
 call setx
 for i=0 to 63 
    Lookup i, [ $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_
     $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $01, $01, $00,_ 
$01, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $01, $01, $01, $01_
],LCDDATA
    call pod
 next i
 

 
 LCDDATA=0 'drugi kontroler
 cs1=1   'levi iskljucen  kontroler
 cs2=0   'desni ukljucen
 
  x=0
 call setx
 for i=0 to 63 
    Lookup i, [$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_
     $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00_
],LCDDATA  ' prvi stupac  desnog kontrolera
    call pod
 next i
 
 x=1
 call setx
 for i=0 to 63 
    Lookup i, [ $20, $20, $A0, $A0, $A0, $60, $E0, $E0, $60, $60, $60, $20,_
     $00, $20, $20, $20,_ 
$20, $20, $20, $20, $20, $20, $00, $00, $40, $40, $40, $00, $80, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00_
],LCDDATA
    call pod
 next i
 
  x=2
 call setx
 for i=0 to 63 
 Lookup i, [$01, $01, $00, $FE, $01, $A8, $08, $08, $08, $08, $08, $08, $08,_
  $08, $08, $08,_ 
$08, $08, $08, $08, $10, $E0, $18, $24, $84, $00, $02, $82, $05, $51, $44, $70,_ 
$A0, $C0, $60, $60, $20, $00, $80, $80, $C0, $C0, $C0, $40, $00, $00, $00, $00,_ 
$00, $80, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00_
],LCDDATA
    call pod
 next i
 
  x=3
 call setx
 for i=0 to 63 
    Lookup i, [$40, $A0, $60, $FC, $F6, $01, $0E, $06, $06, $02, $02, $02, $02,_
     $02, $02, $02,_ 
$02, $02, $02, $02, $02, $42, $72, $3C, $20, $10, $10, $00, $04, $02, $03, $02,_ 
$00, $00, $00, $04, $04, $04, $04, $14, $10, $10, $10, $10, $10, $09, $09, $29,_ 
$70, $20, $43, $05, $F0, $7E, $AE, $80, $38, $00, $00, $00, $00, $00, $00, $00_
],LCDDATA
    call pod
 next i
 
  x=4
 call setx
 for i=0 to 63 
    Lookup i, [$FF, $FF, $7F, $7F, $7D, $78, $78, $78, $78, $78, $F8, $78, $78,_
     $78, $78, $78,_ 
$78, $F8, $F8, $E0, $87, $00, $00, $00, $00, $00, $00, $00, $00, $80, $F0, $F8,_ 
$78, $BC, $DC, $5C, $FC, $1C, $1C, $3C, $5C, $5C, $3C, $78, $F8, $F8, $60, $C0,_ 
$8F, $A8, $D8, $88, $31, $44, $48, $02, $A0, $60, $00, $00, $00, $00, $00, $00_
],LCDDATA
    call pod
 next i
 
  x=5
 call setx
 for i=0 to 63 
    Lookup i, [$FF, $FF, $FF, $FF, $FF, $FF, $FE, $FE, $FE, $FE, $FE, $FE,_
     $FE, $FE, $FE, $FE_, 
$FE, $FE, $FE, $FE, $FF, $FF, $FF, $FF, $FF, $FF, $FE, $FF, $BE, $FF, $FF, $FD,_ 
$F0, $EF, $DD, $DF, $FE, $A8, $88, $AA, $C4, $D0, $E4, $E6, $F8, $7F, $7E, $9C,_ 
$D8, $E0, $F0, $F0, $F2, $F2, $F0, $B1, $20, $00, $00, $00, $00, $00, $00, $00_
],LCDDATA
    call pod
 next i
 
  x=6
 call setx
 for i=0 to 63 
    Lookup i, [$FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF,_
     $FF, $FF, $FF, $FF,_ 
$FF, $FF, $FF, $FF, $7F, $7F, $7F, $7F, $FF, $FF, $BF, $BF, $BF, $BF, $FF, $FE,_ 
$FF, $FD, $FF, $FF, $FF, $FB, $FF, $FF, $FF, $7F, $7D, $3F, $1F, $1F, $1F, $1F,_ 
$1F, $1F, $3F, $0F, $0F, $07, $07, $03, $03, $03, $00, $00, $00, $00, $00, $00_
],LCDDATA
    call pod
 next i

   x=7
 call setx
 for i=0 to 63 
    Lookup i, [$01, $01, $01, $01, $03, $03, $03, $0B, $0B, $0B, $0B, $07,_
     $03, $0E, $06, $06,_ 
$06, $02, $12, $13, $13, $03, $17, $15, $15, $11, $01, $13, $13, $03, $06, $06,_ 
$0E, $0F, $0F, $07, $0F, $0F, $0F, $0B, $02, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00_ 
],LCDDATA
    call pod
 next i

 PAUSE 5000 'kraj prve slike
  'scrolanje slike od gore prema dolje
'for i=63 to 32 step -1
 'LCDDATA=192+i
 'call kom
 'pause 400
'next i


'goto main
end

    end
     

     

     
    return

    Pod:
     rs=1
     e=0
     pauseus 1
     e=1
    return

    Kom:   '
     rs = 0
     e = 0
     pauseus 1
     e = 1
    return

    SetX:   'postavi x kursor
        LCDDATA=184+x
        gosub Kom
    return

    SetY:  'postavi y kursor
     LCDDATA = 64 + y
     gosub Kom
    return

    Clr:   'ocisti ekran
     for x=0 to 7
     gosub  setx
      y=0
     gosub sety
     LCDDATA=0
     for i=0 to 63
     gosub pod
     next i
     next x
    return

    DispOff:  'Gasenje lcd
     LCDDATA = 62
     gosub kom
    return

    DispOn:    'palenje lcd
     LCDDATA=63
    gosub kom
    return

Bitmap sliku sam uzeo s interneta,konvertirao je u hex file s programom ------128x64 KS0108 Compatible Bitmap to Byte Array Converter----od gospodina Peter J. Vis.
dobiveni file izgleda ovako:

Code: Select all

 
/*-------------------------------------------------------------------
     Generated Bitmap Graphics code for 128x64 LCD KS0108 based LCD  
     www.petervis.co.cc                                              
                                                                     
     Copyright(c) Peter J. Vis                                       
-------------------------------------------------------------------*/
 
 
 
 
 
const char bitmap[] __attribute__ ((progmem)) = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 
0x80, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 
0x20, 0x20, 0xA0, 0xA0, 0xA0, 0x60, 0xE0, 0xE0, 0x60, 0x60, 0x60, 0x20, 0x00, 0x20, 0x20, 0x20, 
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x40, 0x40, 0x40, 0x00, 0x80, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0xFD, 0xFD, 0xFD, 0xFD, 
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xFD, 0xFD, 0xFD, 0xFD, 0x01, 0x01, 0x01, 0x01, 0xFD, 0xFD, 
0xFD, 0xFD, 0xF9, 0xF1, 0xE1, 0xC1, 0x81, 0xC1, 0xE1, 0xF9, 0xFD, 0xFD, 0xFD, 0xFD, 0xFD, 0x01, 
0x01, 0x01, 0x01, 0xFD, 0xFD, 0xFD, 0xFD, 0xDD, 0xDD, 0xDD, 0x1D, 0x11, 0x01, 0xFF, 0x01, 0x01, 
0x01, 0x01, 0x00, 0xFE, 0x01, 0xA8, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 
0x08, 0x08, 0x08, 0x08, 0x10, 0xE0, 0x18, 0x24, 0x84, 0x00, 0x02, 0x82, 0x05, 0x51, 0x44, 0x70, 
0xA0, 0xC0, 0x60, 0x60, 0x20, 0x00, 0x80, 0x80, 0xC0, 0xC0, 0xC0, 0x40, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x60, 0x60, 0x60, 0xE0, 0x60, 0x60, 0x7F, 0x7F, 0x7F, 0x7F, 
0x7C, 0x7C, 0x7C, 0x7C, 0x60, 0x60, 0x7F, 0x7F, 0x7F, 0x7F, 0x60, 0x60, 0x60, 0x60, 0x7F, 0x7F, 
0x7F, 0x7F, 0x61, 0x67, 0x6F, 0x7F, 0x7F, 0x6F, 0x67, 0x63, 0x61, 0x7F, 0x7F, 0x7F, 0x7F, 0x60, 
0x60, 0x60, 0x60, 0x7F, 0x7F, 0x7F, 0x7F, 0x7D, 0x7D, 0x7D, 0x7C, 0x74, 0x60, 0x7F, 0x40, 0x40, 
0x40, 0xA0, 0x60, 0xFC, 0xF6, 0x01, 0x0E, 0x06, 0x06, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 
0x02, 0x02, 0x02, 0x02, 0x02, 0x42, 0x72, 0x3C, 0x20, 0x10, 0x10, 0x00, 0x04, 0x02, 0x03, 0x02, 
0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x14, 0x10, 0x10, 0x10, 0x10, 0x10, 0x09, 0x09, 0x29, 
0x70, 0x20, 0x43, 0x05, 0xF0, 0x7E, 0xAE, 0x80, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 
0x01, 0x01, 0x7F, 0x7F, 0x7F, 0x7F, 0xFF, 0xFF, 0xF7, 0xFB, 0x7B, 0xBF, 0x5F, 0x5D, 0x7D, 0xBD, 
0xBD, 0x3F, 0x5D, 0x59, 0xB1, 0x73, 0xF3, 0xE5, 0xCF, 0x1B, 0x3F, 0x77, 0xFF, 0xCF, 0xBF, 0xFF, 
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xFF, 
0xFF, 0xFF, 0x7F, 0x7F, 0x7D, 0x78, 0x78, 0x78, 0x78, 0x78, 0xF8, 0x78, 0x78, 0x78, 0x78, 0x78, 
0x78, 0xF8, 0xF8, 0xE0, 0x87, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xF0, 0xF8, 
0x78, 0xBC, 0xDC, 0x5C, 0xFC, 0x1C, 0x1C, 0x3C, 0x5C, 0x5C, 0x3C, 0x78, 0xF8, 0xF8, 0x60, 0xC0, 
0x8F, 0xA8, 0xD8, 0x88, 0x31, 0x44, 0x48, 0x02, 0xA0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x80, 0xC0, 0xF8, 0xF8, 0xF8, 0xF8, 0xFC, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF6, 0xEF, 0xD0, 0xF6, 0xAE, 0xAD, 
0xA9, 0x80, 0xD1, 0xD0, 0xE0, 0xF7, 0xF9, 0xFF, 0xFF, 0xFC, 0xDC, 0xF0, 0x7F, 0xFF, 0xDF, 0xFF, 
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 
0xFE, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xBE, 0xFF, 0xFF, 0xFD, 
0xF0, 0xEF, 0xDD, 0xDF, 0xFE, 0xA8, 0x88, 0xAA, 0xC4, 0xD0, 0xE4, 0xE6, 0xF8, 0x7F, 0x7E, 0x9C, 
0xD8, 0xE0, 0xF0, 0xF0, 0xF2, 0xF2, 0xF0, 0xB1, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0F, 
0x0F, 0x0F, 0x07, 0x0F, 0x0F, 0x0F, 0x07, 0x07, 0x0F, 0x0E, 0x0F, 0x0D, 0x0F, 0x2F, 0x2B, 0x2B, 
0x2B, 0x2B, 0x2B, 0x2F, 0x6F, 0xEF, 0xFF, 0xFD, 0xFD, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 
0xBF, 0xBF, 0xEF, 0xEF, 0xEF, 0xBF, 0xFF, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 
0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x7F, 0x7F, 0x7F, 0xFF, 0xFF, 0xBF, 0xBF, 0xBF, 0xBF, 0xFF, 0xFE, 
0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFB, 0xFF, 0xFF, 0xFF, 0x7F, 0x7D, 0x3F, 0x1F, 0x1F, 0x1F, 0x1F, 
0x1F, 0x1F, 0x3F, 0x0F, 0x0F, 0x07, 0x07, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 
0x01, 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x0B, 0x0B, 0x0B, 0x0B, 0x07, 0x03, 0x0E, 0x06, 0x06, 
0x06, 0x02, 0x12, 0x13, 0x13, 0x03, 0x17, 0x15, 0x15, 0x11, 0x01, 0x13, 0x13, 0x03, 0x06, 0x06, 
0x0E, 0x0F, 0x0F, 0x07, 0x0F, 0x0F, 0x0F, 0x0B, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00};   // array ends
nakon toga sam taj fajl otvorio s MS Wordom i sve znakove "0x" zamjenio s znakom "$" da bi mi PicbasicPro vidio te brojke kao HEX oblik kordinata za GLCD.
Tu su sad nastale muke kako rasporediti te brojke u Pedjin kod da bi dobio sliku i dosao sam do zakljucka da ako gledamo hex fajl od pocetka da prva 4 reda (64 bajta) pripadaju prvom redu lijevog kontrolera na GLCD-u,a druga 4 reda pripaduju isto prvom redu ali desnom kontroleru. i tako redom do kraja 2 red,3 red,4red......
Za sada toliko.
Ako netko ima prijedlog kako jednostavnije citati kordinate iz HEX fajla neka podjeli s nama. :lol: :lol: :P
User avatar
pedja089
Administrator sajta
Administrator sajta
Posts: 7877
Joined: 20-02-2007, 14:50
Location: Beočin -Srbija

Re: Zadatak: Napisati program za GLCD

Post by pedja089 »

Nisam pre stigao nista napisati...
Sto se tice glcdout, na tome radim, pa isprobavam. Pa sam pomesao koji ti fajl imas...
Sto se tice ispisa u istom redu, ne vidim u cemu je problem. Nije mi jasno sta zeza...
Ako mozes malo pojasni...
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: Zadatak: Napisati program za GLCD

Post by febo26 »

Ma za sada sam taj primjer ostavio sa strane kad mi nije islo od ruke,
Pokusavao sam napisati program za sat s prikazom na GLCD-u
Podaci se citaju iz DS1337 i prikazuju se u ovom bliku

TIME: hr : mm : ss
DATE: dd : mm : yr

Problem mi stvara to da mi super ispise prvi dio TIME: 12: i poslije toga nisam uspio upisati minute i sekunde.Desavalo se to da mi se preklapaju minute i sekunde ,nisam ih uspio razdvojiti.Za sada sve stoji.

Sada se jos igram s slikom.
posto slike uzme dosta prostora u memoriji procesora pa ostaje malo mjesta za glavni program da li je moguce podatke od slike upisati na vanjsku EEprom memoriju 24c64 i onda po potrebi ih citat i prikazat na GLCDu. tu sam sada zapeo , nemam ideju kako to izvest...
Da li bi trebalo napraviti program za PIC koji bi sluzio samo za upis podataka od slike u 24c64,(8 slika u jedan 24C64).taj program bi sluzio kao programator za EEprom 24c64 ili ima neki vec gotovi program koji moze podatke od slike pretvoriti u HEX fajl za eeprom pa taj HEX fajl upisem u eeprom pomocu programatora.

Glavni program koji bi citao slike ovisno o radnji koju radi morao bi znati od koje adrese pocinje i na kojoj adresi zavrsava pojedina slika.
User avatar
pedja089
Administrator sajta
Administrator sajta
Posts: 7877
Joined: 20-02-2007, 14:50
Location: Beočin -Srbija

Re: Zadatak: Napisati program za GLCD

Post by pedja089 »

Nemam pojma koja je verzija kod tebe, al probaj ovako

Code: Select all

if Hour < 10 then
        @ PrintStr 36,4, "0"
        @ PrintVar 42,4, _Hour
else
        @ PrintVar 36,4, _Hour
endif
@ PrintStr 48,4, ":"
if Minute < 10 then
        @ PrintStr 52,4, "0"
        @ PrintVar 58,4, _Minute
else
        @ PrintVar 52,4, _Minute
endif
@ PrintStr 64,4, ":"
if second < 10 then
        @ PrintStr 69,4, "0"
        @ PrintVar 76,4, _Second
else
        @ PrintVar 69,4, _Second
endif
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: Zadatak: Napisati program za GLCD

Post by febo26 »

Taj primjer sam i probavao ali nije islo,preklapale su se minute i sekunde
Taj primjer je bio u rar fajlu s onim glcd kodom na kraju prve stranice ove teme.
Budem navecer probao opet se s tim igrati da vidim da li bude napretka
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: Zadatak: Napisati program za GLCD

Post by febo26 »

Upisivanje slike pomocu PIC 18f452 procesora u EEprom 24C64

Code: Select all

'PIC18F452


DEFINE OSC 4			'OSC speed, you may have to tweak the 'strobe'
				'routine's e_pause constant for other speeds
ADCON1	= 7			'Make all pins digital, you may adjust as needed





dat	 VAR 	PORTD		'LCD bus Pins 7-14 LSB-MSB
scl	 VAR 	PORTC.3		'I2C SCL  for ext eeprom 
sda	 VAR	PORTC.4		'I2C SDA for ext eeprom
e	 VAR 	PORTB.4		'Enable pin on LCD
cd	 VAR	PORTB.2		'Data/Command Pin 4 on LCD
rw	 VAR 	PORTB.3		'Read/Write Pin 5 on LCD
cs1	 VAR 	PORTB.0		'ChipSelect1 Pin 15 on LCD
cs2	 VAR	PORTB.1		'ChipSelect2 Pin 16 on LCD
rst	 VAR	PORTB.5		'Reset Pin 17 on LCD

'Set pins for output
TRISA=%0000000
TRISB.0  = 0    'CS1
TRISB.1  = 0   'CS2
TRISD	 = 0  'DATA PORT
TRISB.4	 = 0   'ENABLE
TRISB.3	 = 0  'RW
TRISB.2	 = 0 'DATA COMAND
TRISC.3	 = 0 'SCL
TRISC.4	 = 0  'SDA
TRISB.5	 = 0 'RESET


'Constants used
ctl       CON    $A0		'EEprom control code

'Word variables used
addr     VAR    WORD

'Byte Variables used
in_byte    VAR  BYTE	'The incoming byte
k	   VAR  BYTE	'General counter


'Initialize variables
in_byte    = 0
addr = 0










 
main:
'COOL KAT SLIKA
PORTA.0=1

for k = 0 to 255
lookup k,[_ 
$00, $00, $00, $00, $00, $00, $00, $80, $C0, $40, $40, $60, $20, $20, $30, $10,_ 
$10, $10, $10, $10, $10, $10, $10, $10, $10, $10, $10, $10, $08, $08, $08, $08,_ 
$08, $08, $08, $08, $08, $08, $08, $18, $10, $10, $10, $10, $10, $10, $10, $10,_ 
$10, $10, $10, $10, $10, $30, $20, $20, $20, $20, $20, $60, $40, $80, $80, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $FC, $03, $00, $00, $00, $00, $FC, $00, $80, $40, $30,_ 
$08, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $F0, $00, $00, $C0, $20, $10, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $F8, $04, $F8, $00, $00, $00, $01, $07,_ 
$EC, $30, $00, $00, $00, $00, $00, $00, $00, $00, $18, $E8, $90, $30, $70, $D0,_ 
$30, $20, $60, $40, $C0, $80, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $80, $80,_ 
$40, $40, $20, $A0, $A0, $E0, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00_ 
],in_byte
gosub eep_loop
next

for k = 0 to 255
lookup k,[_ 
$00, $00, $00, $00, $00, $7F, $C0, $80, $00, $00, $00, $3F, $02, $03, $0C, $10,_ 
$20, $00, $1E, $21, $21, $1E, $00, $1E, $21, $21, $1E, $00, $3F, $20, $20, $20,_ 
$00, $00, $00, $00, $7F, $02, $0D, $30, $40, $00, $70, $18, $16, $18, $60, $02,_ 
$02, $7E, $02, $02, $02, $00, $00, $80, $5F, $86, $01, $00, $F0, $18, $06, $03,_ 
$01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $03, $3C, $E4, $9C, $71,_ 
$06, $7C, $C0, $00, $00, $01, $03, $9E, $D0, $50, $50, $50, $50, $CC, $8C, $18,_ 
$18, $08, $18, $90, $90, $B0, $E0, $C0, $20, $30, $08, $0C, $06, $01, $C1, $60,_ 
$F8, $2C, $36, $F5, $18, $07, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $01, $03, $06, $0C, $18, $10, $30, $20, $20,_ 
$40, $40, $40, $40, $40, $40, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80,_ 
$80, $80, $80, $80, $80, $80, $C0, $C0, $40, $40, $40, $40, $20, $20, $10, $10,_ 
$10, $08, $08, $08, $08, $08, $08, $08, $09, $04, $04, $04, $05, $05, $06, $06,_ 
$04, $04, $80, $C0, $40, $60, $20, $20, $20, $20, $20, $20, $20, $20, $63, $46,_ 
$44, $78, $CF, $80, $80, $00, $FC, $83, $00, $7C, $76, $7E, $00, $00, $39, $1F,_ 
$06, $03, $F9, $ED, $FC, $00, $20, $01, $06, $FC, $00, $00, $DC, $23, $30, $17,_ 
$18, $04, $83, $81, $80, $80, $80, $80, $80, $80, $80, $80, $80, $00, $00, $00_ 
],in_byte
gosub eep_loop
next 

for k = 0 to 255
lookup k,[_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$02, $C3, $72, $1A, $0E, $86, $84, $80, $C0, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $50, $00, $00, $01, $11, $22, $06, $88, $3C, $7F, $FF, $FF, $7F, $FF,_ 
$FD, $F2, $E6, $EC, $F8, $20, $12, $1A, $01, $08, $08, $8C, $85, $02, $82, $01,_ 
$01, $01, $00, $00, $00, $04, $06, $0A, $1A, $33, $C1, $81, $01, $00, $00, $00,_ 
$00, $00, $F0, $08, $08, $88, $88, $80, $00, $00, $F8, $00, $00, $00, $00, $00,_ 
$A0, $00, $00, $00, $F8, $88, $88, $88, $70, $00, $00, $00, $08, $F8, $08, $00,_ 
$00, $F0, $08, $08, $08, $08, $10, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $03, $03, $01, $01, $FF, $01, $00, $80, $C0, $C0, $40, $60, $20, $20, $30,_ 
$10, $10, $1A, $18, $38, $48, $86, $80, $00, $01, $00, $10, $00, $01, $E1, $F1,_ 
$83, $83, $03, $0B, $01, $00, $80, $81, $60, $22, $38, $0F, $08, $10, $10, $30,_ 
$60, $C0, $E0, $22, $42, $C1, $07, $0D, $39, $E2, $02, $03, $00, $00, $00, $00_ 
],in_byte
gosub eep_loop
next 

for k = 0 to 255
lookup k,[_  
$00, $00, $83, $44, $04, $04, $84, $83, $00, $00, $47, $84, $04, $04, $00, $00,_ 
$07, $80, $80, $80, $07, $00, $00, $00, $80, $80, $80, $00, $04, $87, $04, $00,_ 
$00, $83, $04, $04, $84, $84, $82, $00, $00, $00, $00, $80, $80, $80, $00, $80,_ 
$00, $00, $00, $80, $00, $00, $80, $80, $80, $00, $00, $00, $00, $80, $00, $00,_ 
$00, $00, $80, $00, $00, $07, $06, $03, $81, $80, $80, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $01, $07, $05, $0C, $39, $C1, $84, $1C,_ 
$30, $61, $81, $03, $07, $0D, $71, $C0, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $03, $00, $00, $00, $01, $02, $03, $01, $00, $00, $00, $00, $00, $00,_ 
$00, $07, $08, $10, $00, $07, $08, $08, $05, $00, $10, $08, $07, $00, $00, $00,_ 
$0F, $10, $10, $10, $09, $00, $00, $0F, $10, $10, $10, $0F, $00, $1F, $02, $04,_ 
$02, $1F, $00, $00, $1F, $04, $04, $03, $00, $00, $11, $12, $12, $0C, $00, $00,_ 
$01, $1E, $01, $00, $00, $11, $12, $12, $0C, $00, $00, $00, $00, $1F, $10, $10,_ 
$00, $00, $1F, $10, $10, $00, $00, $0F, $10, $10, $10, $09, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $03, $06,_ 
$0C, $18, $21, $22, $20, $20, $10, $1F, $00, $00, $00, $00, $00, $00, $00, $00_ 
],in_byte
gosub eep_loop
next 
'********************************************************************************
'SLIKA 2 

 for k = 0 to 255
lookup k,[_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $40, $E0, $F8, $70, $38, $F8, $58, $D8,_ 
$D8, $D8, $F8, $F8, $F8, $F0, $E0, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $80, $C0, $E0, $20, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $10, $20, $20, $60, $60, $60, $C0, $40, $C0, $C0, $C0,_ 
$C0, $E0, $E0, $E0, $E0, $E0, $C0, $C0, $D0, $C0, $F0, $E0, $E0, $E0, $E0, $E0,_ 
$C0, $C0, $C0, $C0, $80, $80, $00, $00, $01, $03, $07, $0F, $1F, $7F, $FD, $FF,_ 
$F9, $F3, $F3, $E1, $81, $01, $00, $00, $00, $00, $00, $00, $00, $C0, $C0, $F0,_ 
$E0, $FF, $F7, $FF, $FF, $FC, $F8, $E0, $E0, $F0, $60, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00_ 
],in_byte
gosub eep_loop
next  


 for k = 0 to 255
lookup k,[_
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $38, $3C, $FE,_ 
$FE, $EE, $FE, $FE, $BF, $FE, $BE, $BE, $BE, $BC, $C0, $C0, $C0, $C0, $C0, $C1,_ 
$C1, $E1, $E3, $E3, $E3, $E3, $E7, $C7, $C7, $CF, $CE, $FE, $FE, $FE, $FD, $FD,_ 
$FD, $FF, $F9, $F9, $FF, $FF, $FF, $FE, $FE, $FE, $7C, $7C, $7C, $7E, $7F, $7F,_ 
$7F, $7F, $7F, $FF, $FF, $F8, $FC, $FC, $FC, $F8, $FC, $FE, $FF, $FF, $FF, $FF,_ 
$FF, $FB, $F9, $F8, $FF, $FF, $7F, $1F, $1F, $87, $81, $80, $80, $80, $C0, $C0,_ 
$E0, $F0, $F8, $78, $1C, $0C, $0E, $3E, $7E, $7E, $FE, $FE, $FE, $FE, $66, $7E,_ 
$7C, $38, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $80, $80, $81, $C1, $C1, $C1, $C1, $E1, $E0, $E0, $E0, $F0, $F0, $F1, $F1,_ 
$F1, $F1, $F1, $F3, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $7F, $1F, $0D, $0F,_ 
$03, $03, $01, $01, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $01, $01, $03, $07, $05, $0F,_ 
$1F, $3F, $7F, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $EF, $E7, $E7, $E3, $E3,_ 
$C1, $C1, $C0, $C0, $E0, $40, $E0, $E0, $E0, $C0, $E0, $C0, $C0, $E0, $E0, $F0,_ 
$70, $70, $30, $30, $10, $10, $10, $00, $10, $10, $00, $00, $00, $00, $00, $00_ 
],in_byte
gosub eep_loop
next  

 for k = 0 to 255
lookup k,[_
$00, $00, $00, $00, $00, $00, $00, $40, $40, $40, $40, $40, $60, $70, $70, $78,_ 
$3C, $3C, $3C, $3E, $3F, $3F, $1F, $1F, $1F, $1D, $1D, $0D, $1E, $1E, $9E, $8F,_ 
$8F, $DF, $CF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $F8, $E0, $C0, $80,_ 
$80, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $80, $80,_ 
$C0, $F0, $F8, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $9F, $9F, $9F, $1F, $1F,_ 
$1D, $1D, $1D, $1D, $1D, $1F, $1F, $1F, $1F, $0F, $0F, $0F, $05, $05, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $60, $70, $F8,_ 
$F8, $98, $98, $F8, $F8, $F8, $F8, $78, $F0, $80, $80, $C0, $FC, $FE, $3F, $1F,_ 
$0F, $0F, $07, $07, $03, $03, $03, $03, $E7, $F7, $FF, $FF, $FF, $FF, $7F, $7F,_ 
$FF, $FF, $FE, $FE, $FE, $FE, $FC, $FC, $FC, $FC, $F8, $F8, $F8, $F8, $F8, $F8,_ 
$F8, $F8, $F8, $F8, $F8, $FC, $FC, $FC, $FE, $FE, $FE, $FE, $FF, $FF, $FF, $FF,_ 
$FF, $FF, $FF, $FF, $FF, $E7, $C7, $87, $87, $07, $07, $0F, $0F, $0F, $0F, $0F,_ 
$07, $0F, $0E, $0E, $0E, $06, $06, $76, $F6, $FE, $FE, $FE, $F6, $FE, $8E, $FC,_ 
$FC, $F8, $F8, $70, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00_ 
],in_byte
gosub eep_loop
next  



 for k = 0 to 255
lookup k,[_
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $01,_ 
$01, $03, $03, $03, $07, $07, $03, $03, $03, $03, $01, $01, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $11, $1F, $06, $0F, $3F, $7F, $F8, $F8, $FC,_ 
$FF, $3F, $3F, $1F, $07, $03, $00, $00, $00, $00, $00, $00, $03, $07, $0F, $1F,_ 
$1F, $39, $7F, $FD, $F0, $E0, $C0, $80, $01, $01, $03, $07, $07, $0F, $0F, $1E,_ 
$1E, $1C, $1D, $3D, $7F, $5F, $1F, $1F, $1F, $1F, $1E, $1E, $1C, $1C, $18, $38,_ 
$30, $30, $30, $60, $C0, $00, $00, $00, $00, $00, $01, $01, $01, $01, $01, $01,_ 
$01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $11, $0B, $0F,_ 
$07, $00, $00, $00, $00, $00, $00, $00, $00, $00, $0E, $1E, $3F, $3F, $7F, $7F,_ 
$3D, $7D, $73, $37, $35, $39, $3F, $1F, $07, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00_ 
],in_byte
gosub eep_loop
next 

'*****************************************************************************************
 for k = 0 to 255
lookup k,[_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $80, $80, $80, $C0, $C0, $C0, $C0, $E0, $E0, $E0, $E0, $E0, $E0,_ 
$70, $70, $F0, $F0, $B0, $B0, $B8, $B8, $98, $98, $9C, $0C, $0C, $0C, $06, $06,_ 
$02, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $C0, $C0, $80, $80, $C0, $C0, $E0, $F8, $FC, $FE, $FE, $FF, $FF,_ 
$FF, $EF, $EF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $7F, $7F,_ 
$7F, $7F, $7F, $7F, $7F, $6F, $6F, $6F, $6F, $EF, $FE, $FE, $FC, $FC, $DC, $FC,_ 
$BC, $FC, $7C, $F8, $E0, $E0, $C0, $80, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00],in_byte
gosub eep_loop
next  


  for k = 0 to 255
lookup k,[_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $38, $7C, $FE, $7F, $3F,_ 
$3F, $1F, $3F, $2F, $3F, $3F, $3F, $3F, $37, $3F, $3F, $3F, $2F, $7F, $3F, $1F,_ 
$1F, $0F, $0F, $0F, $0F, $0F, $1F, $1F, $03, $01, $01, $00, $00, $00, $00, $00,_ 
$80, $80, $C0, $C0, $C0, $E0, $E0, $E0, $F0, $F0, $F8, $FC, $FF, $FF, $FF, $FF,_ 
$FF, $FF, $FF, $F9, $FF, $3F, $0F, $3F, $7F, $60, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $80, $80, $C0, $C0, $E0,_ 
$E0, $F0, $F0, $F0, $F8, $F8, $F8, $FC, $FC, $FC, $FE, $7E, $7F, $7F, $3F, $3F,_ 
$1F, $1F, $9F, $9F, $9F, $9F, $9F, $8F, $8F, $8F, $87, $87, $83, $83, $85, $87,_ 
$83, $03, $01, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00],in_byte
gosub eep_loop
next  


   for k = 0 to 255
lookup k,[_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $F0, $F8, $FE, $FF, $FF, $FF, $3F, $FF, $FF, $FF,_ 
$FF, $FF, $07, $03, $0F, $07, $07, $03, $01, $01, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $01, $01, $01, $01, $01, $01, $01, $01, $03, $03, $03, $07, $0F, $1F,_ 
$1F, $3F, $7F, $FF, $FF, $EF, $9E, $3E, $7E, $FC, $FC, $F8, $F8, $F0, $F0, $E0,_ 
$C0, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $03, $0F, $0F, $07, $0F, $1F, $3F, $79, $73, $EF,_ 
$CF, $DF, $BF, $BE, $FC, $78, $F8, $D8, $D8, $C0, $80, $80, $80, $80, $80, $C0,_ 
$C0, $C0, $C0, $C0, $E0, $E0, $E0, $80, $80, $80, $80, $80, $C0, $E0, $E0, $FE,_ 
$FC, $FC, $FC, $7C, $FF, $BF, $FF, $FF, $FF, $FE, $FF, $FF, $7F, $00, $03, $0F,_ 
$0F, $0C, $08, $08, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00],in_byte
gosub eep_loop
next 


  for k = 0 to 255
lookup k,[_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $01, $01, $FB, $FB, $F3, $F3, $E7, $E7, $C7, $C7, $C7, $C7, $C7, $CF, $CF,_ 
$CF, $CF, $CF, $CF, $CF, $CF, $CF, $CF, $CF, $EF, $EF, $E5, $E7, $F7, $F7, $F6,_ 
$FE, $7F, $7F, $7F, $3F, $3F, $1F, $1F, $0F, $07, $03, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $07, $1F, $1F, $3F, $78, $71, $71, $EF, $DF, $FF, $F7, $F7, $E7,_ 
$E6, $E7, $E3, $E3, $E3, $C3, $E3, $E3, $E1, $61, $61, $21, $31, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00],in_byte
gosub eep_loop
next  

 '****************************************************************************************
 
   for k = 0 to 255
lookup k,[_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $80, $00, $00,_ 
$00, $80, $80, $00, $80, $00, $00, $80, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $80, $80, $80, $80, $40, $00, $00, $60, $00, $00, $B0, $70, $30, $10,_ 
$70, $E0, $E0, $C0, $C4, $C4, $A6, $22, $00, $20, $20, $29, $6A, $6E, $6F, $FC,_ 
$95, $87, $83, $B7, $3F, $B7, $BF, $B3, $96, $98, $08, $40, $31, $68, $C3, $06,_ 
$02, $F2, $E2, $EA, $E6, $FA, $D0, $F2, $BE, $B0, $FE, $F8, $90, $F0, $90, $10,_ 
$B0, $B8, $98, $98, $A0, $60, $20, $00, $00, $00, $00, $00, $00, $00, $00, $00],in_byte
gosub eep_loop
next  
 


  for k = 0 to 255
lookup k,[_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $30, $78, $78, $78, $FC,_ 
$FC, $F0, $FC, $54, $FC, $90, $F8, $9C, $F0, $F2, $F6, $F6, $F6, $F4, $F4, $F0,_ 
$E3, $F3, $F2, $F0, $71, $71, $19, $0C, $00, $00, $00, $00, $03, $0F, $1C, $38,_ 
$70, $F0, $F1, $E3, $83, $03, $03, $07, $1F, $1E, $3C, $78, $E0, $C0, $80, $80,_ 
$C1, $E3, $73, $31, $39, $19, $ED, $ED, $9F, $3B, $34, $10, $C2, $6F, $61, $00,_ 
$00, $80, $C6, $C6, $EF, $FF, $FF, $FF, $FF, $FD, $FB, $79, $99, $1B, $0B, $9C,_ 
$19, $18, $7F, $3F, $1E, $0A, $10, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $80, $40, $40, $30, $19,_ 
$89, $C5, $E5, $FC, $3E, $1E, $0E, $0F, $03, $02, $00, $04, $84, $0F, $15, $03,_ 
$03, $07, $07, $C1, $80, $00, $00, $00, $00, $00, $01, $03, $06, $1C, $2C, $FC,_ 
$C0, $80, $01, $03, $07, $0E, $FC, $F0, $E0, $00, $00, $80, $BE, $3F, $07, $21,_ 
$7C, $F8, $00, $00, $00, $C0, $C1, $03, $03, $01, $E0, $F0, $F8, $FC, $FE, $7E,_ 
$9F, $8D, $8F, $03, $81, $83, $C2, $3F, $1F, $07, $07, $07, $01, $03, $00, $00,_ 
$01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00],in_byte
gosub eep_loop
next  
 

  for k = 0 to 255
lookup k,[_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$80, $C0, $80, $E0, $F0, $70, $78, $3C, $9C, $86, $C1, $40, $60, $3C, $1E, $0F,_ 
$03, $01, $01, $00, $00, $00, $00, $80, $00, $00, $0C, $1E, $3F, $07, $00, $00,_ 
$00, $00, $10, $79, $7F, $DE, $CC, $80, $00, $00, $00, $00, $00, $00, $00, $01,_ 
$01, $0F, $3C, $78, $00, $04, $09, $0F, $07, $02, $03, $83, $E7, $FF, $BF, $02,_ 
$00, $00, $00, $E0, $C4, $8E, $8F, $03, $00, $01, $0F, $1F, $3F, $FD, $FF, $FC,_ 
$F8, $F1, $F1, $FF, $F3, $E1, $C0, $80, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $80, $40, $20, $10, $08, $86, $C2, $41,_ 
$26, $F3, $31, $31, $18, $08, $0E, $67, $C3, $01, $01, $00, $80, $80, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $18, $3E, $7F, $1E, $18, $10, $10, $00, $00, $00,_ 
$00, $00, $30, $FC, $FE, $D7, $03, $00, $00, $00, $10, $18, $18, $30, $3C, $1C,_ 
$1C, $27, $03, $00, $00, $00, $00, $00, $04, $04, $0D, $0D, $1D, $1B, $1B, $33,_ 
$36, $6E, $2E, $1C, $1C, $18, $31, $31, $27, $0C, $00, $00, $80, $81, $03, $07,_ 
$07, $07, $0F, $0F, $07, $17, $2F, $0E, $CE, $0E, $4C, $1C, $48, $10, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00],in_byte
gosub eep_loop
next  
 


     for k = 0 to 255
lookup k,[_ 
$00, $00, $00, $00, $00, $00, $00, $00, $01, $08, $1E, $0E, $07, $39, $78, $9C,_ 
$8F, $83, $80, $00, $00, $00, $00, $00, $01, $1F, $FE, $FC, $C0, $81, $03, $07,_ 
$0E, $1E, $3C, $7C, $78, $60, $E0, $C0, $C0, $C0, $C0, $E0, $60, $E0, $E0, $F2,_ 
$F2, $F3, $D3, $D1, $F9, $E8, $E8, $68, $6C, $64, $64, $64, $22, $22, $22, $02,_ 
$02, $02, $80, $80, $80, $C0, $C0, $E0, $E0, $20, $20, $10, $00, $00, $20, $00,_ 
$10, $00, $00, $08, $04, $04, $00, $00, $00, $00, $00, $00, $00, $00, $00, $02,_ 
$02, $04, $04, $04, $04, $04, $04, $04, $02, $02, $03, $01, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $01, $01, $01, $02, $02, $02, $04, $04, $07, $07, $0F, $08, $08,_ 
$08, $08, $18, $10, $10, $10, $10, $10, $10, $00, $10, $20, $21, $20, $00, $20,_ 
$20, $21, $20, $20, $30, $30, $38, $28, $28, $28, $2C, $3C, $34, $3C, $3A, $3C,_ 
$3E, $0E, $1F, $1F, $17, $13, $13, $09, $08, $08, $0C, $02, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00],in_byte
gosub eep_loop
next  
 
toggle PORTA.0
PAUSE 10000
GOTO MAIN

 eep_loop:
	          
	        I2CWRITE sda,scl,ctl,addr,[in_byte]
	        pause 10
	        addr=addr+1 
               
           RETURN 
           
           
END


Citanje slike i prikaz na GLCD displayu,jedna slike se nalazi u procesoru ,a 4 slike u memoriji 24c64

Code: Select all

'PIC18F452


DEFINE OSC 4			'OSC speed, you may have to tweak the 'strobe'
				'routine's e_pause constant for other speeds
ADCON1	= 7			'Make all pins digital, you may adjust as needed





dat	 VAR 	PORTD		'LCD bus Pins 7-14 LSB-MSB
scl	 VAR 	PORTC.3		'I2C SCL  for ext eeprom 
sda	 VAR	PORTC.4		'I2C SDA for ext eeprom
e	 VAR 	PORTB.4		'Enable pin on LCD
cd	 VAR	PORTB.2		'Data/Command Pin 4 on LCD
rw	 VAR 	PORTB.3		'Read/Write Pin 5 on LCD
cs1	 VAR 	PORTB.0		'ChipSelect1 Pin 15 on LCD
cs2	 VAR	PORTB.1		'ChipSelect2 Pin 16 on LCD
rst	 VAR	PORTB.5		'Reset Pin 17 on LCD

'Set pins for output
TRISB.0  = 0    'CS1
TRISB.1  = 0   'CS2
TRISD	 = 0  'DATA PORT
TRISB.4	 = 0   'ENABLE
TRISB.3	 = 0  'RW
TRISB.2	 = 0 'DATA COMAND
TRISC.3	 = 0 'SCL
TRISC.4	 = 0  'SDA
TRISB.5	 = 0 'RESET

'Constants used

ctl       CON    $A0		'EEprom control code
row 	  CON	 $b8		'LCD page 0
last_row  CON    $bf		'LCD page 7
col	  CON    $40	        'Line byte position 0
last_col  CON    63             'Last column (1-64)
first_col CON    0		'First column
max_col   CON    128            'Last column (1-127)
max_line  CON    8		'Line 8 (based on 1-8)
max_pos   CON    64             'Column 64 positon per side (1-64)

disp_on   CON    $3f		'LCD Display ON
disp_off  CON    $3e            'LCD Display OFF
disp_ram  CON    $c0            'Ram Display 0 (Page 0 at top of display) 
blank     CON    $00		'Blank character
e_pause	  CON    10		'Pauseus 6 for Strobe routine

'Word variables used
eepaddr  VAR    WORD
addr     VAR    WORD

'Arrays used
in_array VAR    byte[64]
in_ctl   VAR    byte[8]

'Byte Variables used



buf_cnt    VAR  BYTE	'buffer counter
byte_pos   VAR  BYTE	'To keep track of a byte's position
in_byte    VAR  BYTE	'The incoming byte
index	   VAR	BYTE	'Index for arrays
j	   VAR  BYTE	'General counter
k	   VAR  BYTE	'General counter
line	   VAR  BYTE	'An LCD row
delay      VAR  BYTE	'Execution delay, used with 'pause'

'Initialize variables

byte_pos   = 0
delay      = 10
in_byte    = 0
index      = 0


'Reset LCD
dat = 0	' Clear PORTD
cd =  0
rw =  0
e =   0
cs1 = 0
cs2 = 1
rst = 1
pause 100	'Let things  stabilize
rst = 0
pause 10	' Reset LCD
rst = 1
pause  500


'Jump over subroutines to main program
goto main

' **** (GO)SUB ROUTINES ****

strobe:
	e = 1
	pauseus e_pause
	e = 0
return

clearall:
	cd = 0		' Command mode
	dat = disp_off	' Display Off
	gosub strobe
	cs1=0
	cs2=1
	for index = 1 to 2
          for j = row to last_row
	        cd = 0	        'Command mode
 	        gosub strobe	' Write the data
	        dat = col	' Column address = 0
	        gosub strobe
	        dat = j
	        gosub strobe	
	        cd = 1		' Write mode
	          for k = first_col to last_col
	             dat = blank
	             gosub strobe
	          next
	  next
	  swap cs1,cs2
        next

	cs1=1
	cs2=0
	cd=0
	dat=row
	gosub strobe
	dat = disp_ram	' Ram Line 0
	gosub strobe
	dat=col
	gosub strobe
	dat = disp_on	'display on
	gosub strobe
	cs1=0
	cs2=1
	dat=row
	gosub strobe
	dat = disp_ram	' Ram Line 0
	gosub strobe
	dat=col
	gosub strobe
	dat = disp_on	'display on
	gosub strobe
	cd = 1		' Set Data command
	cs1 = 0		' Left side active
	cs2 = 1

return	


init:			'Initialization

	cd = 0			' Set command mode
	cs1 = 0			' Left Side on
	cs2 = 1			' Right Side off	
         for index = 1 to 2
	   dat = disp_off	' Display Off
	   dat = disp_ram	' Ram Line 0
	   gosub strobe		' Write the data
	   dat = col		' Y address = 0
	   gosub strobe
	   dat = row		' Page = 0
	   gosub strobe
	   dat = disp_on	' Display On
	   gosub strobe
	   swap cs1,cs2
         next
	cs1=0
	cs2=1


return

'****Place char on LCD Routine *****
'Place byte of data on lcd assumes in_byte, byte_pos and line (line)
'Char position on LCD byte_pos = 0-127 (Horiz), ROW 0-7 (vert)

putbyte: 
	dat = in_byte		'Display the byte
	gosub strobe   
	byte_pos=byte_pos+1	'Increment position

	'Now do some LCD house cleaning and adjust counters
	if byte_pos=max_pos then
	   cs1=1
	   cs2=0
	   cd = 0
	   dat = col
	   gosub strobe
	   dat = disp_ram
	   gosub strobe
	   dat = row + line
	   gosub strobe
	   cd = 1
	endif
     if byte_pos = max_col then	'Check if
	   line = line + 1		'New Line
              if line = max_line then
	        line = 0
              endif
    	byte_pos = 0		'Reset byte_pos
        cs1=0
	cs2=1
	cd = 0
	dat=col
	gosub strobe
	dat = row + line
	gosub strobe
	dat = disp_ram
	gosub strobe
        cd =1 
     endif
  
return



'===============================
' **** BEGIN MAIN PROGRAM ******
'===============================
	
main:
	gosub init	' Initialize LCD
	gosub clearall	' Clear all pages
byte_pos = 0
line = 0
gosub lookup_img
pause 10000 
 gosub logo
goto MAIN
'***********************************************************************************************
logo:	
    gosub init	' Initialize LCD
	gosub clearall	' Clear all pages
	byte_pos=0
	line =0
	for addr = 0 to 4096  '8192
        I2CREAD sda,scl,ctl,addr,[in_byte]
	gosub putbyte

        if (addr=1024) OR (addr=2048) OR (addr= 3072)then ' OR (addr=4096)   OR (addr=5120) OR (addr=6144) _
        'OR (addr=7168) OR (addr=8192) 
	pause 4000

	gosub init
	gosub clearall
	endif
	next
        pause 4000
	gosub init
	gosub clearall
goto main

'******************************************************************************


eep_loop:
	 
	        I2CWRITE sda,scl,ctl,addr,[in_byte]
	        pause 5
                addr=addr+1                

goto eep_loop

'0 to 255 bytes
lookup_img:
for k = 0 to 255
lookup k,[_ 
$00, $00, $F8, $04, $04, $24, $E0, $00, $FC, $00, $00, $00, $E8, $00, $00, $FC,_
$44, $44, $38, $00, $04, $FC, $04, $00, $00, $F8, $04, $04, $04, $88, $00, $00,_ 
$00, $00, $00, $C0, $E0, $F0, $A8, $F4, $E2, $32, $84, $1F, $97, $A1, $00, $02,_ 
$32, $3C, $34, $08, $08, $18, $78, $60, $40, $80, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $F0, $08, $64, $94, $94, $04, $08, $F0, $00, $00, $F0,_ 
$08, $08, $08, $90, $00, $00, $F0, $08, $08, $08, $F0, $00, $00, $F8, $10, $20,_ 
$20, $10, $F8, $00, $F8, $48, $48, $48, $30, $00, $90, $28, $48, $90, $00, $E0,_ 
$00, $00, $E0, $00, $60, $50, $D0, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $01, $01, $01, $01, $00, $01, $01, $01, $00, $01, $00, $00, $01,_ 
$00, $00, $00, $00, $01, $01, $01, $00, $00, $00, $01, $01, $01, $00, $C0, $F0,_ 
$F8, $FC, $7F, $F7, $7F, $78, $B8, $C3, $73, $F3, $F3, $F3, $6B, $7B, $7C, $40,_ 
$00, $00, $00, $04, $04, $74, $AC, $C2, $01, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $01, $02, $02, $02, $02, $01, $00, $00, $00, $00,_ 
$01, $01, $01, $00, $00, $00, $00, $01, $01, $01, $00, $00, $00, $01, $00, $40,_ 
$40, $40, $41, $80, $01, $80, $40, $40, $40, $80, $00, $81, $41, $40, $40, $84,_ 
$09, $49, $47, $40, $41, $81, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00],in_byte
gosub putbyte
next k


for k = 0 to 255
lookup k,[_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $01, $7F,_ 
$F7, $BF, $FF, $FF, $F7, $F7, $3F, $0F, $0E, $07, $07, $06, $06, $06, $08, $0C,_ 
$18, $18, $70, $C0, $20, $40, $41, $03, $CF, $FE, $8C, $08, $10, $F0, $60, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $0C,_ 
$0A, $0B, $09, $08, $00, $07, $08, $08, $08, $07, $00, $07, $08, $08, $08, $07,_ 
$00, $0C, $0A, $0B, $09, $08, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $C1, $71, $1D, $07, $00, $00, $00, $80, $C0, $C0, $F0, $F8, $FC, $EC, $E4,_ 
$E0, $F0, $D0, $CF, $C7, $C0, $C0, $40, $60, $30, $FD, $06, $03, $01, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $80, $80, $40, $40, $20, $20,_ 
$10, $10, $18, $08, $04, $04, $04, $04, $04, $04, $08, $18, $30, $60, $80, $40,_ 
$20, $20, $20, $40, $80, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00],in_byte
gosub putbyte
next k

for k = 0 to 255
lookup k,[_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $C0, $40, $10, $08, $04,_ 
$03, $01, $80, $E0, $10, $08, $04, $02, $01, $01, $03, $0F, $0F, $FF, $FF, $7F,_ 
$FF, $C7, $87, $03, $13, $11, $00, $08, $14, $0E, $0B, $0C, $04, $04, $08, $80,_ 
$C0, $70, $28, $18, $18, $0C, $04, $02, $02, $01, $01, $00, $00, $00, $00, $00,_ 
$00, $80, $C0, $E0, $F0, $F0, $F8, $E0, $C0, $00, $00, $00, $00, $00, $00, $03,_ 
$02, $0C, $10, $20, $40, $81, $02, $04, $08, $10, $30, $20, $C0, $80, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $C0, $F0, $1C, $07, $00, $00, $80, $C0, $60,_ 
$10, $0C, $07, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $07, $3C,_ 
$7D, $FF, $3F, $7E, $E0, $88, $98, $04, $8C, $66, $F6, $1E, $03, $01, $01, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $80, $40, $60, $30, $18, $0E,_ 
$0F, $07, $07, $03, $03, $01, $01, $01, $00, $01, $02, $04, $08, $08, $10, $20,_ 
$40, $40, $00, $00, $00, $01, $03, $04, $08, $30, $40, $40, $80, $81, $01, $02,_ 
$04, $08, $10, $20, $40, $40, $80, $00, $00, $00, $00, $00, $00, $00, $00, $00_ 
],in_byte
gosub putbyte
next k

for k = 0 to 255
lookup k,[_  
$40, $C0, $C0, $C0, $80, $A0, $C0, $C0, $C0, $C0, $C0, $C0, $E0, $E0, $20, $A0,_ 
$A0, $90, $10, $10, $30, $18, $0E, $87, $C0, $70, $38, $0E, $03, $01, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $20, $00, $00, $00, $28, $28, $28, $28, $38,_ 
$A8, $F9, $BB, $AF, $EF, $FB, $F3, $FF, $FD, $FC, $FF, $DC, $F0, $E0, $E0, $E0,_ 
$C0, $E0, $E0, $E0, $F0, $F0, $E8, $E4, $E0, $F2, $E1, $E8, $F8, $F8, $F8, $E8,_ 
$F8, $F8, $F8, $E8, $E8, $E0, $E0, $E8, $C0, $C0, $C0, $E0, $E0, $C0, $C0, $C0,_ 
$C0, $C0, $C0, $40, $01, $02, $00, $04, $08, $10, $E0, $C0, $C1, $63, $63, $36,_ 
$1A, $10, $14, $28, $48, $90, $F0, $31, $3B, $8E, $04, $04, $08, $10, $00, $00,_ 
$02, $02, $03, $03, $01, $07, $07, $07, $07, $07, $0F, $0F, $0F, $0F, $0F, $0F,_ 
$0F, $0F, $0F, $0F, $07, $07, $07, $07, $07, $07, $07, $07, $03, $02, $00, $00,_ 
$00, $00, $00, $00, $00, $00, $00, $00, $06, $04, $04, $05, $05, $05, $05, $05,_ 
$07, $07, $07, $07, $07, $07, $07, $07, $07, $07, $07, $07, $07, $07, $07, $07,_ 
$07, $07, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03,_ 
$03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $01,_ 
$01, $01, $01, $08, $08, $0C, $0C, $0C, $1C, $1C, $1C, $1F, $38, $3B, $3A, $3A,_ 
$78, $78, $78, $70, $70, $74, $71, $31, $3E, $7E, $7E, $7E, $3E, $3E, $00, $00_ 
],in_byte
gosub putbyte
next k
return

'*********** E N D ************
end





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

Re: Zadatak: Napisati program za GLCD

Post by febo26 »

Pedja ne radi ni ovaj posljedni primjer.
Mozda je greska u include "glcd.pbp" fajlu.
Desava se to da ako u jednom redu imam ispisan STRING : VARIJABLA : STRING onda radi sve bez problema ali ako hocu u istom redu da ispisem
VARIJABLA : STRING: VARIJABLA onda dobim spojen ispis varijabli bez stringa
Kao da se svadjaju dvije varijable u istom redu i ne mogu razdvojiti varijable bez obzira koju vrijednost upisem pod "x", vrijednost.
febo26
Pravo uznapredovao :)
Pravo uznapredovao :)
Posts: 207
Joined: 12-08-2008, 19:58

Re: Zadatak: Napisati program za GLCD

Post by febo26 »

Ovo vise nema veze s logikom,nakon pisanja proslog posta,obrisem sve fajlove s kojima sam experimentirao restartam racunalo popijem jedno pivce i iz pocetka ispisem program bez ikakvih prepravki izkompajliram to sve i sve radi.
Imam ispis u istom redu STRING -VAR-STR-VAR-STR-VAR
TIME: 12 : 00 : 00

Uopce mi nije jasno sto me je zezalo i zasto nisam mogao imati dvije varijable u istom redu.


Evo i koda koji me ubijao u pojam: :azdaja:

Code: Select all

    '****************************************************************
    '*  Name    : UNTITLED.BAS                                      *
    '*  Author  : [select VIEW...EDITOR OPTIONS]                    *
    '*  Notice  : Copyright (c) 2012 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 14.12.2012                                        *
    '*  Version : 1.0                                               *
    '*  Notes   :                                                   *
    '*          :                                                   *
    '****************************************************************
      @ ERRORLEVEL -306 ; turn off crossing page boundary message
       define OSC 4
      include "glcd.pbp"

       
       
       TRISA = $00     'Postavi sve pinove porta A kao IZLAZNI 
       TRISB = %00000000  'Postavi sve pinove porta B kao izlazni
       TRISC = $00     'Postavi sve pinove porta C kao IZLAZNI
       TRISD = $00     'Postavi sve pinove porta D kao izlazne
       TRISE = %000    'Postavi sve pinove porta E kao izlazni
       ADCON1 = 7      ' PORTA i PORTE su digitalni  ISKLJUCI KOMPARATORE I ANALOGNE ULAZE
       Hour var word
      minute var word
       second var word
       Hour =0
       minute =0
       second=0
       
       
       START:
    
     
      second  = second +1
      if second = 60 then
      second = 00
      minute=minute+1
      endif
      
      if minute = 60 then
      minute = 00
      hour=hour+1
      endif
      
      if hour = 24 then hour = 0
      
 
     @ PrintStr 1,4, "TIME: "
     @ PrintVar 30,4, _Hour
     @ PrintStr 42,4, ": "
     @ PrintVar 48,4, _minute
     @ PrintStr 60,4, ": "
     @ PrintVar 66,4, _second
     
        pause 1000
       
        goto start
        END
Post Reply