
Daha önceki yazılarda nokia 3310 lcd kullanımı ile ilgili bir çok proje paylaşılmıştı 3310 lcd için bir çok programlama dilinin kütüphane library dosyası var jal içinde hazırlanmış.
Andremiller.net sitesinde “andre” jal için kütüphane dosyası hazırlamış jal kullanıcıları için büyük kolaylık sağlar ayrıca uygulama örneği ve 5×7 font dosyasıda bulunuyor dosyalar: Nokia 3310 LCD Driver JAL PIC Library
nokia_lcd.jal içeriği
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Nokia 3310 LCD JAL Library by Andre Miller
;; (andre@100acre.org)
;;
;; Based on the following C source libraries:
;;
;; - Various projects using LPH7779 with PICC by Michel Bavin
;; http://users.skynet.be/bk317494/index.htm
;; - Nokia LCD Lib for AVR by Louis Frigon
;; http://www.microsyl.com/nokialcd/nokialcd.html
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Procedures
;;
;; Write a byte to the LCD
;; Command: mode = false
;; Data: mode = true
procedure NLCD_Write (byte in data, bit in mode) is
;; Pull nok_dc high or low depending on mode
if (mode) then
nok_dc = high
else
nok_dc = low
end if
nok_cs = low
;; Clock in 8 bits of data
for 8 loop
nok_sclk = low
if ( (data & 0x80) == 0 )then
nok_sda = low
else
nok_sda = high
end if
nok_sclk = high
data = data << 1
end loop
nok_cs = high
end procedure
;; Set the current position for data (x = 0->83, y = 0->5)
procedure NLCD_GotoXY (byte in xnokia, byte in ynokia) is
NLCD_Write ( 0x40 | ( ynokia & 0x07 ), false)
NLCD_Write ( 0x80 | ( xnokia & 0x7f ), false)
end procedure
; 16 bit addition
; a = a + b, result in a
; by Vasile
; http://www.geocities.com/vsurducan/electro/PIC/lib.html
procedure _16b_add(
byte in b_hi, byte in b_lo,
byte in out a_hi, byte in out a_lo
) is assembler
bank MOVF b_lo,W
bank ADDWF a_lo,f
bank MOVF b_hi,W
BTFSC status_C
INCFSZ b_hi,W
bank ADDWF a_hi,f
end assembler end procedure
;; Clear the LCD data memory
procedure NLCD_Clear is
nok_sda = low ;; Data bit is low
nok_dc = high ;; Data mode
nok_cs = low
for 6 loop
;; 6 rows
for 84 loop
;; 84 columns or 'pages'
for 8 loop
;; Clock for the 8 bits of the 'page'
nok_sclk = low
nok_sclk = high
end loop
end loop
end loop
end procedure
;; Send LCD Initialization
procedure NLCD_Init is
;; Set initial status of LCD pins
nok_sclk = low
nok_sda = low
nok_dc = low
nok_cs = low
nok_res = low
;; Toggle LCD Reset
delay_1ms (10)
nok_res = low
delay_1ms (250)
nok_res = high
nok_cs = high
NLCD_Write (0x21, false);; Extended commands
NLCD_Write (0xc5, false);; LCD Vop
NLCD_Write (0x06, false);; Temp coef
NLCD_Write (0x13, false);; LCD Bias 1:48
NLCD_Write (0x20, false);; Standard commands
NLCD_Write (0x0c, false);; Normal Mode
;; Clear and position at top of LCD
NLCD_Clear();
NLCD_GotoXY (0,0);
end procedure
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Some test patterns
procedure NLCD_Test_1 is
;; Produce a 1 x 1 checkerboard pattern
NLCD_GotoXY (0,0)
for 42 loop ; columns / 2
for 6 loop
NLCD_Write (0b_1010_1010, true)
NLCD_Write (0b_0101_0101, true)
end loop
end loop
end procedure
procedure NLCD_Test_2 is
;; Produce a border outline
NLCD_GotoXY (0,0)
NLCD_Write (0b_1111_1111, true)
for 82 loop
NLCD_Write (0b_0000_0001, true)
end loop
NLCD_Write (0b_1111_1111, true)
for 4 loop
NLCD_Write (0b_1111_1111, true)
for 82 loop
NLCD_Write (0b_0000_0000, true)
end loop
NLCD_Write (0b_1111_1111, true)
end loop
NLCD_Write (0b_1111_1111, true)
for 82 loop
NLCD_Write (0b_1000_0000, true)
end loop
NLCD_Write (0b_1111_1111, true)
end procedure
Yazar: gevv Tarih: 5/11/2009 Etiketler: 3310 jal, jal, jal 5x7, jal lcd kütüphanesi, jal nokia, nokia 3310
Yorumlar