Jump to content
ELFORUM - Forumul Electronistilor
Sign in to follow this  
78ATI

LCD Nokia 3310 - Driver

Recommended Posts

Buna tuturor! A trecut o vreme de la prima programare de PIC, multumita dvs, am reusit sa fac si stergerea :). Am acum o mare rugaminte: MA intereseaza driverul sau libraria LCD-ului de la Nokia 3310. Mentionez ca lucrez in MikroBasic, si pana in acest moment nu am gasit nimic.Orice ajutor in programarea afisarii diferitelor date pe un astfel de LCD este bine venit!Va multumesc!

Share this post


Link to post
Share on other sites

Buna din nou!Nu are nimeni un "driver", sau codurile de initializare/comanda a unui LCD de Nokia 3310? (LPH7779 cu PCD8544). Indiferent in ce limbaj este scris. mikroBasic, mikroC sau mikroPascal.Mi-ar fi de foarte mare folos! Astept un raspuns, si va multumesc pentru atentie si rabdare!

Share this post


Link to post
Share on other sites

Aici gasesti ceea ce doresti:

 

http://free-vz.htnet.hr/Ivica-Novakovic ... ar-eng.htm

http://www.100acre.org/elec/nokia_lcd/

http://sandiding.tripod.com/lcd.html

 

1. program Nokia_JVMBOTS

2. 'LCD Nokia 3310 ****************************************************************

3. 'Este codigo muestra graficos y texto sobre una pantalla LCD de Nokia 3310

4. 'La pantalla LCD es capaz de mostrar una resolucion de 84 x 48 pixeles

5. 'permitiendo graficos y librerias compuestas de tipos de fuente de letra.

6. 'se ha testeado con la version Mikrobasic 5.0.0.0

7. '

8. 'Verificado por: Julio Montagut

9. 'Web: http://www.jvmbots.com

10. '

11. '-HARDWARE:

12. ' MCU: PIC 18F452

13. ' Cristal: 4 Mhz

14. '

15. '-PINEADO (PIC-LCD):

16. ' PORTC.0 - 5

17. ' PORTC.1 - 8

18. ' PORTC.4 - 2

19. ' PORTC.5 - 4

20. ' PORTC.6 - 5

21. '

22. '-USO:

23. ' NOK_Out(x,y,texto) "x" es el ofsset de corrdenada - "y" la linea

24. '*******************************************************************************

25.

26. include "NOKIA_LCD_18.pbas" 'Libreria del LCD

27. include "LOGO.pbas" 'imagen del logotipo

28.

29. dim l as word

30.

31. main:

32. TRISC = 0

33. PORTC = 0

34. intcon = 0

35.

36. NOK_Init

37. for l = 0 to 503

38. NOK_Write(picture1[l],1) 'Presentamos los pixels del logo

39. next l

40. Delay_ms(5000)

41.

42. NOK_Clear

43. NOK_Out(0,0,"NOKIA-3210 LCD") '14 caracteres max.

44. NOK_Out(15,2,"JVM-BOTS")

45. end.

 

Exemplul se gaseste aici:

http://www.jvmbots.com/viewtopic.php?t=79

Share this post


Link to post
Share on other sites

in codul ala lipseste listarea pt NOKIA_LCD_18.pbas

vad ca tipu ala o pastreaza doar pt el...

 

aici e un cod pt PBP

 

http://www.todopic.com.ar/foros/index.p ... ic=13812.0

 

 

GeSHi (freebasic):

module NOKIA_LCD_18

 

' Written by ANTON RIECKERT

' [email protected]

 

' PORTC,0 - CS - Chip Enable

' PORTC,1 - RES - Reset Input

' PORTC,4 - SCLK - Serial Clock Input

' PORTC,5 - DC - Data / Command

' PORTC,6 - SDA - Serial Data Input

 

 

' 6x8 Font Table

const font1 as byte[460] =

(0x00, 0x00, 0x00, 0x00, 0x00 , ' space

0x00, 0x00, 0x2f, 0x00, 0x00 , ' !

0x00, 0x07, 0x00, 0x07, 0x00 , ' "

0x14, 0x7f, 0x14, 0x7f, 0x14 , ' #

0x24, 0x2a, 0x7f, 0x2a, 0x12 , ' $

0x62, 0x64, 0x08, 0x13, 0x23 , ' %

0x36, 0x49, 0x55, 0x22, 0x50 , ' &

0x00, 0x05, 0x03, 0x00, 0x00 , ' '

0x00, 0x1c, 0x22, 0x41, 0x00 , ' (

0x00, 0x41, 0x22, 0x1c, 0x00 , ' )

0x14, 0x08, 0x3E, 0x08, 0x14 , ' *

0x08, 0x08, 0x3E, 0x08, 0x08 , ' +

0x00, 0x00, 0xA0, 0x60, 0x00 , ' ,

0x08, 0x08, 0x08, 0x08, 0x08 , ' -

0x00, 0x60, 0x60, 0x00, 0x00 , ' .

0x20, 0x10, 0x08, 0x04, 0x02 , ' /

0x3E, 0x51, 0x49, 0x45, 0x3E , ' 0

0x00, 0x42, 0x7F, 0x40, 0x00 , ' 1

0x42, 0x61, 0x51, 0x49, 0x46 , ' 2

0x21, 0x41, 0x45, 0x4B, 0x31 , ' 3

0x18, 0x14, 0x12, 0x7F, 0x10 , ' 4

0x27, 0x45, 0x45, 0x45, 0x39 , ' 5

0x3C, 0x4A, 0x49, 0x49, 0x30 , ' 6

0x01, 0x71, 0x09, 0x05, 0x03 , ' 7

0x36, 0x49, 0x49, 0x49, 0x36 , ' 8

0x06, 0x49, 0x49, 0x29, 0x1E , ' 9

0x00, 0x36, 0x36, 0x00, 0x00 , ' :

0x00, 0x56, 0x36, 0x00, 0x00 , '

0x08, 0x14, 0x22, 0x41, 0x00 , ' <

0x14, 0x14, 0x14, 0x14, 0x14 , ' =

0x00, 0x41, 0x22, 0x14, 0x08 , ' >

0x02, 0x01, 0x51, 0x09, 0x06 , ' ?

0x32, 0x49, 0x59, 0x51, 0x3E , ' @

0x7C, 0x12, 0x11, 0x12, 0x7C , ' A

0x7F, 0x49, 0x49, 0x49, 0x36 , ' B

0x3E, 0x41, 0x41, 0x41, 0x22 , ' C

0x7F, 0x41, 0x41, 0x22, 0x1C , ' D

0x7F, 0x49, 0x49, 0x49, 0x41 , ' E

0x7F, 0x09, 0x09, 0x09, 0x01 , ' F

0x3E, 0x41, 0x49, 0x49, 0x7A , ' G

0x7F, 0x08, 0x08, 0x08, 0x7F , ' H

0x00, 0x41, 0x7F, 0x41, 0x00 , ' I

0x20, 0x40, 0x41, 0x3F, 0x01 , ' J

0x7F, 0x08, 0x14, 0x22, 0x41 , ' K

0x7F, 0x40, 0x40, 0x40, 0x40 , ' L

0x7F, 0x02, 0x0C, 0x02, 0x7F , ' M

0x7F, 0x04, 0x08, 0x10, 0x7F , ' N

0x3E, 0x41, 0x41, 0x41, 0x3E , ' O

0x7F, 0x09, 0x09, 0x09, 0x06 , ' P

0x3E, 0x41, 0x51, 0x21, 0x5E , ' Q

0x7F, 0x09, 0x19, 0x29, 0x46 , ' R

0x46, 0x49, 0x49, 0x49, 0x31 , ' S

0x01, 0x01, 0x7F, 0x01, 0x01 , ' T

0x3F, 0x40, 0x40, 0x40, 0x3F , ' U

0x1F, 0x20, 0x40, 0x20, 0x1F , ' V

0x3F, 0x40, 0x38, 0x40, 0x3F , ' W

0x63, 0x14, 0x08, 0x14, 0x63 , ' X

0x07, 0x08, 0x70, 0x08, 0x07 , ' Y

0x61, 0x51, 0x49, 0x45, 0x43 , ' Z

0x00, 0x7F, 0x41, 0x41, 0x00 , ' [

0x55, 0x2A, 0x55, 0x2A, 0x55 , ' /

0x00, 0x41, 0x41, 0x7F, 0x00 , ' ]

0x04, 0x02, 0x01, 0x02, 0x04 , ' ^

0x40, 0x40, 0x40, 0x40, 0x40 , ' _

0x00, 0x01, 0x02, 0x04, 0x00 , ' '

0x20, 0x54, 0x54, 0x54, 0x78 , ' a

0x7F, 0x48, 0x44, 0x44, 0x38 , ' b

0x38, 0x44, 0x44, 0x44, 0x20 , ' c

0x38, 0x44, 0x44, 0x48, 0x7F , ' d

0x38, 0x54, 0x54, 0x54, 0x18 , ' e

0x08, 0x7E, 0x09, 0x01, 0x02 , ' f

0x18, 0xA4, 0xA4, 0xA4, 0x7C , ' g

0x7F, 0x08, 0x04, 0x04, 0x78 , ' h

0x00, 0x44, 0x7D, 0x40, 0x00 , ' i

0x40, 0x80, 0x84, 0x7D, 0x00 , ' j

0x7F, 0x10, 0x28, 0x44, 0x00 , ' k

0x00, 0x41, 0x7F, 0x40, 0x00 , ' l

0x7C, 0x04, 0x18, 0x04, 0x78 , ' m

0x7C, 0x08, 0x04, 0x04, 0x78 , ' n

0x38, 0x44, 0x44, 0x44, 0x38 , ' o

0xFC, 0x24, 0x24, 0x24, 0x18 , ' p

0x18, 0x24, 0x24, 0x18, 0xFC , ' q

0x7C, 0x08, 0x04, 0x04, 0x08 , ' r

0x48, 0x54, 0x54, 0x54, 0x20 , ' s

0x04, 0x3F, 0x44, 0x40, 0x20 , ' t

0x3C, 0x40, 0x40, 0x20, 0x7C , ' u

0x1C, 0x20, 0x40, 0x20, 0x1C , ' v

0x3C, 0x40, 0x30, 0x40, 0x3C , ' w

0x44, 0x28, 0x10, 0x28, 0x44 , ' x

0x1C, 0xA0, 0xA0, 0xA0, 0x7C , ' y

0x44, 0x64, 0x54, 0x4C, 0x44 , ' z

0x14, 0x14, 0x14, 0x14, 0x14) ' horiz lines

 

sub procedure NOK_Write (dim data as byte, dim mode as byte)

dim i as short

' Pull DC high for DATA or low for COMMAND

If TestBit(mode,0) = 1 then

SetBit(PortC,5)

end if

If TestBit(mode,0) = 0 then

ClearBit(PortC,5)

end if

 

ClearBit(PortC,0) ' CS = low

 

' Clock in 8 bits of data - Highst bit first

for i = 7 to 0 step -1

ClearBit(PortC,4) ' SCLK = low

If TestBit(Data,i) = 0 then

ClearBit(PortC,6) ' SDA = low

else

SetBit(PortC,6) ' SDA = high

end if

SetBit(PortC,4) ' SCLK = high

next i

SetBit(PortC,0) ' CS = high

end sub

 

' Draws a character on screen at current possition

sub procedure NOK_Chr(dim symlcd as byte)

dim l as byte

dim m as word

 

NOK_Write(0x00,1) ' Space between characters

for l = 1 to 5

m = (symlcd - 32)

m = m * 5

m = m + l

m = m - 1

NOK_Write(Font1[m],1)

next l

end sub

 

' Set the current position for data (0<= x <= 84, 0<= y <= 5)

sub procedure NOK_GotoXY(dim x as byte, dim y as byte)

dim n as byte

dim o as byte

 

n = x

o = y

SetBit(n,7)

SetBit(o,6)

NOK_Write (o,0)

NOK_Write (n,0)

end sub

 

' Inverts Display - Here is still a bug. It only inverst once and doesn't

' want to invert back again

sub procedure NOK_Invert

NOK_Write(0x0D,0)

end sub

 

' Clear the LCD Data memory

sub procedure NOK_Clear

dim p as byte

dim q as byte

dim r as byte

 

ClearBit(PortC,6) ' SDA = low - Data bit is low

SetBit(PortC,5) ' DC = high - Data mode

ClearBit(PortC,0) ' CS = low - Chip Enable

 

for p = 1 to 6 ' for 6 rows

for q = 1 to 84 ' for 84 colums

for r = 1 to 8 ' for 8 loop (8 bits)

ClearBit(PortC,4) ' SCLK = low - Serial Clock Input

SetBit(PortC,4) ' SCLK = high - Serial Clock Input

next r

next q

next p

end sub

 

' Writes a string at x, y position (maks 14 char per row) (0 <= x <= 84 , 0 <= y <= 5)

sub procedure NOK_Out(dim x as byte, dim y as byte, dim byref sentance as char[14])

dim v as byte

NOK_GotoXY(x,y)

for v = 0 to length(sentance)

NOK_Chr(sentance[v])

next v

end sub

 

' LCD Initialization

sub procedure NOK_Init

' Set initial status of LCD pins

ClearBit(PortC,4) ' SCLK = low

ClearBit(PortC,6) ' SDA = low

ClearBit(PortC,5) ' DC = low

ClearBit(PortC,0) ' CS = low

ClearBit(PortC,1) ' RES = low

 

' Toggle LCD reset

Delay_ms(20)

ClearBit(PortC,1) ' RES = low

Delay_ms(500)

SetBit(PortC,1) ' RES = high

 

SetBit(PortC,0) ' CS = high

NOK_Write(0x21,0) ' Extended commands

NOK_Write(0xc5,0) ' LCD Vop

NOK_Write(0x06,0) ' Temp coef

NOK_Write(0x13,0) ' LCD Bias 1:48

NOK_Write(0x20,0) ' Standard commands

NOK_Write(0x0c,0) ' Normal Mode

 

' Clear and position at top of LCD

NOK_Clear

NOK_GotoXY(0,0)

end sub

 

end.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.