176b5a6e8SMauro Carvalho Chehab=================================== 276b5a6e8SMauro Carvalho Chehabcfag12864b LCD Driver Documentation 376b5a6e8SMauro Carvalho Chehab=================================== 476b5a6e8SMauro Carvalho Chehab 576b5a6e8SMauro Carvalho Chehab:License: GPLv2 6*c131bd0bSMiguel Ojeda:Author & Maintainer: Miguel Ojeda <ojeda@kernel.org> 776b5a6e8SMauro Carvalho Chehab:Date: 2006-10-27 876b5a6e8SMauro Carvalho Chehab 976b5a6e8SMauro Carvalho Chehab 1076b5a6e8SMauro Carvalho Chehab 1176b5a6e8SMauro Carvalho Chehab.. INDEX 1276b5a6e8SMauro Carvalho Chehab 1376b5a6e8SMauro Carvalho Chehab 1. DRIVER INFORMATION 1476b5a6e8SMauro Carvalho Chehab 2. DEVICE INFORMATION 1576b5a6e8SMauro Carvalho Chehab 3. WIRING 1676b5a6e8SMauro Carvalho Chehab 4. USERSPACE PROGRAMMING 1776b5a6e8SMauro Carvalho Chehab 1876b5a6e8SMauro Carvalho Chehab1. Driver Information 1976b5a6e8SMauro Carvalho Chehab--------------------- 2076b5a6e8SMauro Carvalho Chehab 2176b5a6e8SMauro Carvalho ChehabThis driver supports a cfag12864b LCD. 2276b5a6e8SMauro Carvalho Chehab 2376b5a6e8SMauro Carvalho Chehab 2476b5a6e8SMauro Carvalho Chehab2. Device Information 2576b5a6e8SMauro Carvalho Chehab--------------------- 2676b5a6e8SMauro Carvalho Chehab 2776b5a6e8SMauro Carvalho Chehab:Manufacturer: Crystalfontz 2876b5a6e8SMauro Carvalho Chehab:Device Name: Crystalfontz 12864b LCD Series 2976b5a6e8SMauro Carvalho Chehab:Device Code: cfag12864b 3076b5a6e8SMauro Carvalho Chehab:Webpage: http://www.crystalfontz.com 3176b5a6e8SMauro Carvalho Chehab:Device Webpage: http://www.crystalfontz.com/products/12864b/ 3276b5a6e8SMauro Carvalho Chehab:Type: LCD (Liquid Crystal Display) 3376b5a6e8SMauro Carvalho Chehab:Width: 128 3476b5a6e8SMauro Carvalho Chehab:Height: 64 3576b5a6e8SMauro Carvalho Chehab:Colors: 2 (B/N) 3676b5a6e8SMauro Carvalho Chehab:Controller: ks0108 3776b5a6e8SMauro Carvalho Chehab:Controllers: 2 3876b5a6e8SMauro Carvalho Chehab:Pages: 8 each controller 3976b5a6e8SMauro Carvalho Chehab:Addresses: 64 each page 4076b5a6e8SMauro Carvalho Chehab:Data size: 1 byte each address 4176b5a6e8SMauro Carvalho Chehab:Memory size: 2 * 8 * 64 * 1 = 1024 bytes = 1 Kbyte 4276b5a6e8SMauro Carvalho Chehab 4376b5a6e8SMauro Carvalho Chehab 4476b5a6e8SMauro Carvalho Chehab3. Wiring 4576b5a6e8SMauro Carvalho Chehab--------- 4676b5a6e8SMauro Carvalho Chehab 4776b5a6e8SMauro Carvalho ChehabThe cfag12864b LCD Series don't have official wiring. 4876b5a6e8SMauro Carvalho Chehab 4976b5a6e8SMauro Carvalho ChehabThe common wiring is done to the parallel port as shown:: 5076b5a6e8SMauro Carvalho Chehab 5176b5a6e8SMauro Carvalho Chehab Parallel Port cfag12864b 5276b5a6e8SMauro Carvalho Chehab 5376b5a6e8SMauro Carvalho Chehab Name Pin# Pin# Name 5476b5a6e8SMauro Carvalho Chehab 5576b5a6e8SMauro Carvalho Chehab Strobe ( 1)------------------------------(17) Enable 5676b5a6e8SMauro Carvalho Chehab Data 0 ( 2)------------------------------( 4) Data 0 5776b5a6e8SMauro Carvalho Chehab Data 1 ( 3)------------------------------( 5) Data 1 5876b5a6e8SMauro Carvalho Chehab Data 2 ( 4)------------------------------( 6) Data 2 5976b5a6e8SMauro Carvalho Chehab Data 3 ( 5)------------------------------( 7) Data 3 6076b5a6e8SMauro Carvalho Chehab Data 4 ( 6)------------------------------( 8) Data 4 6176b5a6e8SMauro Carvalho Chehab Data 5 ( 7)------------------------------( 9) Data 5 6276b5a6e8SMauro Carvalho Chehab Data 6 ( 8)------------------------------(10) Data 6 6376b5a6e8SMauro Carvalho Chehab Data 7 ( 9)------------------------------(11) Data 7 6476b5a6e8SMauro Carvalho Chehab (10) [+5v]---( 1) Vdd 6576b5a6e8SMauro Carvalho Chehab (11) [GND]---( 2) Ground 6676b5a6e8SMauro Carvalho Chehab (12) [+5v]---(14) Reset 6776b5a6e8SMauro Carvalho Chehab (13) [GND]---(15) Read / Write 6876b5a6e8SMauro Carvalho Chehab Line (14)------------------------------(13) Controller Select 1 6976b5a6e8SMauro Carvalho Chehab (15) 7076b5a6e8SMauro Carvalho Chehab Init (16)------------------------------(12) Controller Select 2 7176b5a6e8SMauro Carvalho Chehab Select (17)------------------------------(16) Data / Instruction 7276b5a6e8SMauro Carvalho Chehab Ground (18)---[GND] [+5v]---(19) LED + 7376b5a6e8SMauro Carvalho Chehab Ground (19)---[GND] 7476b5a6e8SMauro Carvalho Chehab Ground (20)---[GND] E A Values: 7576b5a6e8SMauro Carvalho Chehab Ground (21)---[GND] [GND]---[P1]---(18) Vee - R = Resistor = 22 ohm 7676b5a6e8SMauro Carvalho Chehab Ground (22)---[GND] | - P1 = Preset = 10 Kohm 7776b5a6e8SMauro Carvalho Chehab Ground (23)---[GND] ---- S ------( 3) V0 - P2 = Preset = 1 Kohm 7876b5a6e8SMauro Carvalho Chehab Ground (24)---[GND] | | 7976b5a6e8SMauro Carvalho Chehab Ground (25)---[GND] [GND]---[P2]---[R]---(20) LED - 8076b5a6e8SMauro Carvalho Chehab 8176b5a6e8SMauro Carvalho Chehab 8276b5a6e8SMauro Carvalho Chehab4. Userspace Programming 8376b5a6e8SMauro Carvalho Chehab------------------------ 8476b5a6e8SMauro Carvalho Chehab 8576b5a6e8SMauro Carvalho ChehabThe cfag12864bfb describes a framebuffer device (/dev/fbX). 8676b5a6e8SMauro Carvalho Chehab 8776b5a6e8SMauro Carvalho ChehabIt has a size of 1024 bytes = 1 Kbyte. 8876b5a6e8SMauro Carvalho ChehabEach bit represents one pixel. If the bit is high, the pixel will 8976b5a6e8SMauro Carvalho Chehabturn on. If the pixel is low, the pixel will turn off. 9076b5a6e8SMauro Carvalho Chehab 9176b5a6e8SMauro Carvalho ChehabYou can use the framebuffer as a file: fopen, fwrite, fclose... 9276b5a6e8SMauro Carvalho ChehabAlthough the LCD won't get updated until the next refresh time arrives. 9376b5a6e8SMauro Carvalho Chehab 9476b5a6e8SMauro Carvalho ChehabAlso, you can mmap the framebuffer: open & mmap, munmap & close... 9576b5a6e8SMauro Carvalho Chehabwhich is the best option for most uses. 9676b5a6e8SMauro Carvalho Chehab 9776b5a6e8SMauro Carvalho ChehabCheck samples/auxdisplay/cfag12864b-example.c 9876b5a6e8SMauro Carvalho Chehabfor a real working userspace complete program with usage examples. 99