Home

Manual for Nokia 128x128 LCD Development Board

image

Contents

1. WriteSpiCommand PASET WriteSpiData 20 WriteSpiData 27 WriteSpiCommand CASET WriteSpiData 20 WriteSpiData 27 set the row drawing limits limit rows to 20 27 set the column drawing limits limit columns to 20 27 When the algorithm completes col 27 the column address wraps back to 20 At the same time the row address increases by one this is done by the controller We walk through each row two pixels at a time The purpose is to create three data bytes representing these two pixels in the following format as specified by Philips for RGB 4 4 RRRRGGGGBBBB RRRRGGGGBBBB Data for pixel 0 Data for Pixel 1 WriteSpiCommand RAMWR WriteSpiData RRRRGGGG WriteSpiData BBBBRRRR WriteSpiData GGGGBBBB and so on until all pixels displayed WriteSpiCommand NOP Author James P Lynch July 7 2007 4 format see page 62 of PCF8833 controller manual start a memory write 96 data bytes to follow first pixel red and green data first pixel blue data second pixel red data second pixel green and blue data this will terminate the RAMWR command gt K gt lt ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok R K KR FK FK K FK K FK K K ok FK K R FK R ook oe ok ok ok ok K ok ok ok ok ok ok ok ok ok FK ok FK R FK K K K KOR K R R K FK FK K ORO FK K OR OR O
2. ok ok ok ok ok ok ok ok ok 2K FK FK FK ok FK ok ok ok ok ok ok ok ok R ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok 2K FK K ok R OK lcd c Nokia 6610 LCD Display Driver PCF8833 Controller Controller used for LCD Display is a Philips PCF8833 STN RGB 132x132x3 driver Note Leadis 105176 controller GE 12 is 100 compatible with Philips 8833 Nokia 6610 has a 132 x 132 pixel matrix each pixel has 12 bits of color information 131 131 Nokia 6610 Display Note In general you can t view Row 0 or Row 131 and Column 0 and Column 131 132 x 132 pixel matrix has three methods to specify the color info 15 12 bits per pixel requires command and 1 5 data bytes to specify a single pixel 3 data bytes can specify 2 pixels 8 bits per pixel requires one command and one data byte to specify the single pixel note pixel data byte converted by RGB table to 12 bit format above 16 bits per pixel requires one command and two data bytes to specify the single pixel note pixel data bytes converted by dithering circuitry to 12 bit format above THIS IMPLEMENTATION USES THE 12 BITS PER PIXEL METHOD To orient the LCD display so that the origin 0 0 is at the opposite corner from the connector
3. LCDSetPixel LCDSetPixel x0 LCDSetPixel color color color color color color color color gt K gt lt ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok 2K FK R K KR K 2K R FK K R ok K R ook R R ok ok ok K ok ok ok ok ok ok ok ok ok R R FK 2K K FK K K K R R R FK R OR KOR OR OR OR OR LCDPutChar c Draws an ASCII character at the specified x y address and color Inputs c y size fcolor bcolor Returns Notes LCDPutChar E 20 20 MEDIUM WHITE BLACK 27 20 s V 7 20 20 The most efficient way to display a character is to make use of the wrap around feature of the Philips PCF8833 LCD controller chip Assume that we position the character at 20 20 that s row col specification With the row and column address set commands you can specify an 8x8 box for the SMALL and MEDIUM characters or a 16x8 box for the LARGE characters character to be displayed row address 0 131 column address 0 131 font pitch SMALL MEDIUM LARGE 12 bit foreground color value 12 bit background color value rrrrggggbbbb rrrrggggbbbb nothing Here s an example to display E at address 20 20 27 27 HR dk Xk dk HE 20 27
4. row address 0 131 column address 0 131 0 fill 1 fill entire rectangle 12 bit color value for lines rrrrggggbbbb rrrr 1111 full red 0000 red is off gggg 1111 full green 0000 green is off bbbb 1111 full blue 0000 blue is off Returns nothing Notes The best way to fill a rectangle is to take advantage of the wrap around featute built into the Epson S1D15G00 controller By defining a drawing box the memory can be simply filled by successive memory writes until all pixels have been illuminated 1 Given the coordinates of two opposing corners x0 y0 1 y1 calculate the minimums and maximums of the coordinates xmin xmax ymin ymax x0 lt x0 x1 x0 x1 lt y1 yO yl gt yO yl 2 Now set up the drawing box to be the desired rectangle WriteSpiCommand PASET set the row boundaries WriteSpiData xmin WriteSpiData xmax WriteSpiCommand CASET set the column boundaries WriteSpiData ymin WriteSpiData ymax 3 Calculate the number of pixels to be written divided by 2 NumPixels xmax xmin 1 ymax ymin 1 2 1 You may notice that I added one pixel to the formula This covers the case where the number of pixels is odd and we would lose one pixel due to rounding error In the case of odd pixels the number of pixels is exact in the case of even pixels we have o
5. P3 0x00 no inversely highlighted lines COM scan WriteSpiCommand COMSCN WriteSpiData 1 P1 0x01 Scan 1 580 160 81 Internal oscilator ON WriteSpiCommand 05 0 Sleep out WriteSpiCommand SLPOUT Power control WriteSpiCommand PWRCTR WriteSpiData 0xO0f reference voltage regulator on circuit voltage follower on BOOST ON Inverse display WriteSpiCommand DISINV Data control WriteSpiCommand DATCTL WriteSpiData 0x01 P1 0x01 page address inverted column address normal address scan in column direction WriteSpiData 0x00 P2 0x00 RGB sequence default value WriteSpiData 0x02 P3 0x02 Grayscale 16 selects 12 bit color type A Voltage control contrast setting WriteSpiCommand VOLCTR WriteSpiData 32 Pl WriteSpiData 3 P2 32 volume value experiment with this value to get the best contrast 3 resistance ratio only value that works allow power supply to stabilize Delay 100000 turn on the display WriteSpiCommand DISON ok ok ok ok K ok ok ok ok K ok ok ok ok K ok F LCDWritel30x130bmp c Writes the entire screen from a bmp file Uses Olimex BmpToArray exe utility Inputs picture in bmp h Author Olimex James P Lynch August 30 2007 ok ok ok ok K ok ok o
6. 0x00 0x7E 0x33 0x33 0x3E 0x33 0x33 0x7E 0x00 Ox1E 0x33 0x60 0x60 0x60 0x33 0x1E 0x00 OWPranvil A 0 7 0 36 0 33 0 33 0 33 0 36 0 7 0 00 0x7F 0x31 0x34 0x3C 0x34 0x31 0x7F 0x00 0 7 0x31 0x34 0x3C 0x34 0x30 0x78 0x00 Ox1E 0x33 0x60 0x60 0x67 0x33 0x1F 0x00 0x66 0x66 0x66 0 7 0x66 0x66 0x66 0x00 0x3C 0x18 0x18 0x18 0x18 0x18 0x3C 0x00 OxOF 0x06 0x06 0x06 0x66 0x66 Ox3C 0x00 0x73 0x33 0x36 0x3C 0x36 0x33 0x73 0x00 0x78 0x30 0x30 0x30 0x31 0x33 0x7F 0x00 0x63 0x77 0x7F Ox7F Ox6B 0x63 0x63 0x00 0x63 0x73 0x7B Ox6F 0x67 0x63 0x63 0x00 0 0x63 0x63 0x63 0x63 0x63 0x3E 0x00 0 7 0x33 0x33 0x30 0x30 0x78 0x00 0x3C 0x66 0x66 0x66 0x6E 0x0E 0x00 0 7 0x33 0x33 0x36 0x33 0x73 0x00 0x3C 0x66 0x30 0x18 0x0C 0x66 0x3C 0x00 0x7E 0x5A 0x18 0x18 0x18 0x18 0x3C 0x00 0x66 0x66 0x66 0x66 0x66 0x66 0 7 0x00 0x66 0x66 0x66 0x66 0x66 Ox3C 0x18 0x00 0x63 0x63 0x63 0x6B 0 7 0x77 0x63 0x00 0x63 0x63 0x36 0x1C 0x1C 0x36 0x63 0x00 0x66 0x66 0x66 0x18 0x18 0x3C 0x00 0 7 0x63 0x46 0x0C 0x19 0x33 0x7F 0x00 0x3C 0x30 0x30 0x30 0x30 0x30 0x3C 0x00 0x60 0x30 0x18 0x0C 0x06 0x03 0x01 0x00 0x3C 0x0C 0x0C OxOC 0x3C 0x00 0x08 0x1C 0x36 0x63 0x00 0x00 0x00 0x00 0x00 0
7. 0x00 0x00 0x00 0x00 0x00 0x00 0xC3 0xC3 0x66 0x3C 0x18 0x18 0x3C 0x66 0xC3 0xC3 0x00 0x00 0x00 0x00 0x00 0x00 0xC3 0xC3 0xC3 0x66 0x3C 0x18 0x18 0x18 0x18 0x3C 0x00 0x00 0x00 0x00 0x00 0x00 0x7F 0x63 0x43 0x06 0x0C 0x18 0x30 0 61 0 63 0 7 0x00 0x00 0x00 0x00 0x00 0x00 0x3C 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x3C 0x00 0x00 0x00 0x00 0x00 0x00 0x80 0xCO OxEO 0x70 0x38 Ox1C OxOE 0x07 0x03 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x3C 0x0C 0x0C OxOC OxOC OxOC OxOC Ox3C 0x00 Ox0O 0x00 0x00 0x08 0x1C 0x36 0x63 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 OxFF 0x00 0x00 0x00 0x18 0x18 0x0C 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x3C 0x46 0x06 Ox3E 0x66 0x66 0x3B 0x00 0x00 0x00 0x00 0x00 0x00 0x70 0x30 0x30 0x3C 0x36 0x33 0x33 0x33 0x33 0x6E 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 Ox3E 0x63 0x60 0x60 0x60 0x63 0x3E 0x00 0x00 0x00 0x00 0x00 0x00 OxOE 0x06 0x06 Ox1E 0x36 0x66 0x66 0x66 0x66 0 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 Ox3E 0x63 0x63 0x7E 0x60 0x63 Ox3E 0x00 0x00 0x00 0x00 0x00 0x00 0x1C 0x36 0x32 0x30 0x7C 0x30 0x30 0x30 0x30 0x78 0x00 0x00 0x00 0x00 0x00
8. 0x18 0x18 0x18 0x18 0x18 0x3C 0x00 0x00 0x00 0x00 0x00 0x00 0x63 0x63 0x63 0x63 0x63 0x63 0x63 0x63 0x63 0x3E 0x00 0x00 0x00 0x00 0x00 0x00 0x63 0x63 0x63 0x63 0x63 0x63 0x63 0x36 0x1C 0x08 0x00 0x00 0x00 0x00 0x00 0x00 0x63 0x63 0x63 0x63 0x63 0x6B Ox6B 0x7F 0x36 0x36 0x00 0x00 0x00 0x00 0x00 0x00 0xC3 0xC3 0x66 Ox3C 0x18 0x18 0x3C 0x66 0xC3 0xC3 0x00 0x00 0x00 0x00 0x00 0x00 0xC3 0xC3 0xC3 0x66 0x3C 0x18 0x18 0x18 0x18 0x3C 0x00 0x00 0x00 0x00 0x00 0x00 0x7F 0x63 0x43 0x06 0x0C 0x18 0x30 0x61 0x63 0 7 0x00 0x00 0x00 0x00 0x00 0x00 0x3C 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x3C 0x00 0x00 0x00 0x00 0x00 0x00 0x80 0xC0 OxEO 0x70 0x38 0x1C OxOE 0x07 0x03 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x3C 0x0C 0xOC OxOC OxOC OxOC OxOC OxOC 0x00 0x00 0x00 0x00 0x08 0x1C 0x36 0x63 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 OxFF 0x00 0x00 0x00 0x18 0x18 0x0C 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x3C 0x46 0x06 0x3E 0x66 0x66 0x3B 0x00 0x00 0x00 0x00 0x00 0x00 0x70 0x30 0x30 0x3C 0x36 0x33 0x33 0x33 0x33 0 6 0x00 0x
9. LCD RESET HIGH Delay 20000 The controller boots into SLEEPIN mode which keeps the booster circuits off We need to exit sleep mode which will also turn on all the voltage booster circuits Sleep out command 0x11 WriteSpiCommand SLEEPOUT This is still a mystery to me but had to invert the display and reverse the RGB setting to get the colors to work correctly in this particular display If you have trouble consider removing this command Inversion on command 0x20 WriteSpiCommand INVON seems to be required for this controller For this driver elected to use the 12 bit color pixel format exclusively Color Interface Pixel Format command 0x34 WriteSpiCommand COLMOD WriteSpiData 0x03 0 03 12 bits per pixel In setting up the memory access controller elected to use the mirror x and mirror y commands to reorient the x and y axes to agree with the silk screen lettering on the Olimex board If you want the default orientation send the data byte 0x08 instead Finally had to reverse the RGB color setting to get the color information to work properly You may want to experiment with this setting Memory access controller command 0x36 WriteSpiCommand MADCTL WriteSpiData 0xC8 OxCO mirror x and y reverse rgb found that setting the contrast varies from display to display You may want to try several different contrast data values and observe the results on your display Write
10. forward references const unsigned char FONT6x8 97 8 const unsigned char FONT8x8 97 8 const unsigned char FONT8x16 97 16 void InitLcd void void Backlight unsigned char state void WriteSpiCommand unsigned int data void WriteSpiData unsigned int data void InitLcd void void LCDWritel30x130bmp void void LCDClearScreen void void LCDSetPixel int x int y int color void LCDSetLine int x1 int yl int x2 int y2 int color void LCDSetRect int x0 int int 1 int yl unsigned char fill int color void LCDSetCircle int x0 int int radius int color void LCDPutChar char c int x int y int size int fcolor int bcolor void LCDPutString char lcd string const char font style unsigned char x unsigned char y unsigned char fcolor unsigned char bcolor void Delay unsigned long a Pointers to AT91SAM7X256 peripheral data structures gt lt gt lt gt lt gt gt K K K gt K K R K ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok K ok ok ke ok ok ok ok ok ok ok ok ok ORORORORORORORORK OR volatile AT91PS PIO pPIOA AT91C BASE PIOA volatile AT91PS PIO pPIOB AT91C BASE PIOB volatile AT91PS SPI AT91C BASE SPIO volatile 91 5 PMC pPMC AT91C BASE PMC volatile AT91PS PDC pPDC AT91C BASE PDC SPIO ok ok o
11. to match the orientation of the Olimex SAM7 EX256 boards silk screen printing I selected mirror x and mirror y setting in the MADCTL command 1 1 Also while I can t yet explain it I had to reverse the RGB orientation in the MADCTL command and invert the entire display using the INVON command to make 0 0 01 OxF full red HARDWARE INTERFACE The Nokia 6610 display uses a SPI serial interface 9 bits PA2 PA12 PA16 PA17 PA18 LCD Reset set to low to reset LCD chip select set to low to select the LCD chip SPIO MISO Master In Slave Out not used in Olimex SAM7 EX256 LCD interface SPIO MOSI Master Out Slave In pin Serial Data to LCD slave SPIO SPCK Serial Clock to LCD slave SPI baud rate set to MCK 2 48054841 8 6006855 baud period 166 nsec OK since 150 nsec period is min for PCF8833 The important thing to note is that you CANNOT read from the LCD Author James P Lynch July 7 2007 11 FKK KKK K K K K FK FK FK FK FK FK FK K FK K K K FK FK FK FK FK FK FK FK FK FK FK FK FK FK K FK K FK FK FK FK FK FK FK FK FK FK FK FK K K FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK K K FK K K K FK FK FK FK FK FK FK FK FK K K FK K FK FK FK FK FK FK 2K K KKK 71 FKK KK K KK K K K K FK K K FK FK K FK FK K FK FK FK FK FK FK K FK FK K K FK FK K K FK K K Include Files T
12. 0 01 0 00 0 3 0 0 0 0 0 0 0 0 0 0 0 3 0 00 0 08 0 1 0 36 0 63 0 00 0 00 0 00 0 00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 OxFF 0x18 0x18 0x0C 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x3C 0x06 0x66 Ox3B 0x00 0x70 0x30 0x3E 0x33 0x33 0x33 0x6E 0x00 0x00 0x00 0x3C 0x66 0x60 0x66 0x3C 0x00 OxOE 0x06 OX3E 0x66 0x66 0x66 0x3B 0x00 0x00 0x00 0x3C 0x66 0 7 0x60 0x3C 0x00 0x1C 0x36 0x30 0x78 0x30 0x30 0x78 0x00 0x00 0x00 0x3B 0x66 0x66 Ox3E 0x06 0x7C 0x70 0x30 0x36 0x3B 0x33 0x33 0x73 0x00 0x18 0x00 0x38 0x18 0x18 0x18 0x3C 0x00 0x06 0x00 0x06 0x06 0x06 0x66 0x66 0x3C 0x70 0x30 0x33 0x36 0x3C 0x36 0x73 0x00 0x38 0x18 0x18 0x18 0x18 0x18 0x3C 0x00 0x00 0x00 0x66 0x7F 0x7F 0x6B 0x63 0x00 0x00 0x00 0x7C 0x66 0x66 0 66 0 66 0 00 0x00 0x00 0x3C 0x66 0x66 0x66 0x3C 0x00 0x00 0x00 0x6E 0x33 0x33 0x3E 0x30 0x78 0x00 0x00 0x3B 0x66 0x66 Ox3E 0x06 OxOF 0x00 0x00 Ox6E 0x3B 0x33 0x30 0x78 0x00 0x00 0x00 0x3E 0x60 0x3C 0x06 0x7C 0x00 0x08 0x18 0x3E 0x18 0x18 0x1A 0x0C 0x00 0x00 0x00 0x66 0x66 0x66 0 66 0x00 0x00 0x00 0x66 0x66 0x66 0x3C 0x18 0x00 0x00 0x00 0x63 0x6B 0x7F 0x7F 0x36 0x00 0x00 0x00 0x63 0x36 0x1C 0x36 0x63 0x00 0x00 0x00 0x66 0 66 0 66 0x3E 0x06 0x7C 0x00 0x00 0x7E 0x4C 0x18 0x32 0 7 0x00 OxOE 0x18 0x18 0x70 0x18 0x18
13. 0x0E 0x00 0x0C 0x0C 0 0x00 OxOC OxOC OxOC 0x00 0 70 0 18 0 18 0 0 0 18 0 18 0 70 0 00 0 3 0 6 0 00 0 00 0 00 0 00 0 00 0 00 0x1C 0x36 0x36 0x1C 0x00 0x00 0x00 0x00 back slash N xXz ccduUuouozamnmmxuHzrz 157 6 N lt x Z lt G OS O 5 Z5m m S n const unsigned char FONT8x16 97 16 0x08 0x10 0x10 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 columns rows nbytes 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 space 0x20 0x00 0x00 0x18 0x3C 0x3C 0x3C 0x18 0x18 0x18 0x00 0x18 0x18 0x00 0x00 0x00 0x00 0x00 0x63 0x63 0x63 0x22 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 X 0x00 0x00 0x00 0x36 0x36 0 7 0x36 0x36 0x36 0x7F 0x36 0x36 0x00 0x00 0x00 0x00 0x0C 0x0C Ox3E 0x63 0x61 0x60 0x03 0x03 0x43 0x63 0x3E 0x0C 0x0C 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x61 0x63 0x06 0x0C 0x18 0x33 0x63 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x1C 0x36 0x36 0 1 0x66 0x66 0x3B 0 00 0 00 0 00 0 00 0x00 0x30 0x30 0x30 0x60 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0C 0x18 0x18 0x30 0x30 0x30 0x30 0x18 0x18 0x0C 0x00 0x00 0x00 0x00 0x00 0x00 0x18 0x0C 0x0C 0x06 0x06 0x06 0x06 0x0C Ox0C 0x18 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
14. 0x63 0x00 0x00 0x00 0x00 0x00 0x00 0x3C 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x3C 0x00 0x00 0x00 0x00 0x00 0x00 OxOF 0x06 0x06 0x06 0x06 0x06 0x06 0x66 0x66 0x3C 0x00 0x00 0x00 0x00 0x00 0x00 0x73 0x33 0x36 0x36 0x3C 0x36 0x36 0x33 0x33 0x73 0x00 0x00 0x00 0x00 0x00 0x00 0x78 0x30 0x30 0x30 0x30 0x30 0x30 0x31 0x33 0x7F 0x00 0x00 0x00 0x00 0x00 0x00 0x63 0x77 0x7F 0x6B 0x63 0x63 0x63 0x63 0x63 0x63 0x00 0x00 0x00 0x00 0x00 0x00 0x63 0x63 0x73 0x7B 0x7F 0x6F 0x67 0x63 0x63 0x63 0x00 0x00 0x00 0x00 0x00 0x00 0x1C 0x36 0x63 0x63 0x63 0x63 0x63 0x63 0x36 0x1C 0x00 0x00 0x00 0x00 0x00 0x00 0 7 0x33 0x33 0x33 0x3E 0x30 0x30 0x30 0x30 0x78 0x00 0x00 0x00 0x00 0x00 0x00 0x3E 0x63 0x63 0x63 0x63 0x63 0x63 0x6B 0x6F OX3E 0x06 0x07 0x00 0x00 0x00 0x00 0x7E 0x33 0x33 0x33 0x3E 0x36 0x36 0x33 0x33 0x73 0x00 0x00 0x00 0x00 0x00 0x00 0x3E 0x63 0x63 0x30 0x1C 0x06 0x03 0x63 0x63 0x3E 0x00 0x00 0x00 0x00 0x00 0x00 OxFF OxDB 0x99 0x18 0x18 0x18 0x18 0x18 0x18 0x3C 0x00 0x00 0x00 0x00 0x00 0x00 0x63 0x63 0x63 0x63 0x63 0x63 0x63 0x63 0x63 0x3E 0x00 0x00 0x00 0x00 0x00 0x00 0x63 0x63 0x63 0x63 0x63 0x63 0x63 0x36 0x1C 0x08 0x00 0x00 0x00 0x00 0x00 0x00 0x63 0x63 0x63 0x63 0x63 0x6B Ox6B 0 7 0x36 0x36
15. 166 nsec Thus we can safely run the SPI interface at 6 MHz have run the SPI interface at 16 MHz and it still worked but that is tempting fate The SAM7 EX256 board uses 7 microprocessor so commands data are submitted to the SPI peripheral as unsigned integers 32 bits wherein only the lower 9 bits are used For example to send a command we clear bit 8 to specify this is a command transmission The lowest 8 bits contain the desired PCF8833 command unsigned int command PCF8833 command byte while pSPI SPI SR amp AT91C SPI TXEMPTY 0 wait for the previous transfer to complete command z command amp 0x0100 clear bit 8 indicates a command byte pSPI SPI command send the command Likewise to send a data byte we set bit 8 to specify that this is a data transmission The lowest 8 bits contain the desired PCF8833 data byte unsigned int data PCF8833 data byte while pSPI SPI SR amp AT91C SPI TXEMPTY 0 wait for the previous transfer to complete data data 0x0100 set bit 8 indicates a data byte 5 5 data send the command Both snippets have a wait until TXEMPTY to guarantee that a new command data stream is not started before the previous one has completed This is quite safe as you will never get stuck forever in that wait loop The LCD driver has three functions supporting the SPI interface to the LCD InitSpi sets up
16. 276 026 T 1 size anode is the longer wire LED current I E R 3 3 470 007 amps 7 ma Note most PIO pins can drive 8 ma on the AT91SAM7X256 so we re OK Author James P Lynch July 7 2007 ok ok ok ok ok gt gt gt gt K gt K gt K K K gt K gt K K K SK K K K K K SK K FK F K SK K K K SK K FK SK FK SK SK K SK 2K K KKK 9 9 R R R 9 9 9 5 K K K K K K K K K K K K K gt K gt K K lt gt lt gt lt gt lt lt gt gt K gt ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok 2K FK K 2K FK FK K FK FK K FK FK FK FK K FK K K KK K K K K K K Header Files gt k lt ok ok ok ok gt lt ok ok ok ok gt k ok ok ok ok ok ok ok oK ok FK ok FK K ok 2 ok FK ok ok K ok K ok ok ok ok FK 2k ok FK ok FK ok K 2K K 2k K o K K K K include AT91SAM7X256 h include lcd h include board h R FK K K FK K K FK K OR OR External References ok gt K gt gt k ok gt k gt gt k k ok ok FK ok FK FK FK 3 FK K FK 3 FK K K 3 K 3 K FK K FK K SK SK FK 2 FK SK 2K SK 2k 2K K K K K K extern void LowLevellnit void int main void 4 unsigned long j unsigned long k unsigned long col unsigned long row unsigned int IdleCount 0 int TempColor 11 WHITE BLACK RED GREEN BLUE CYAN MAGENTA YELLOW BROWN ORANGE PINK char T
17. BL PHR PA2 R 8 n p R65 R67 22 m 46 R66 csa 2k 100 30 20 Figure 5 Hardware Interface to Nokia 6100 LCD Display Olimex design Addressing Pixel Memory The Philips PCF8833 controller has a 17424 word memory 132 x 132 where each word is 12 bits 4 bit color each for red green and blue You address it by specifying the address of the desired pixel with the Page Address Set command rows and the Column Address Set command columns The Page Address Set and Column Address Set command specify two things the starting pixel and the ending pixel This has the effect of creating a drawing box This sounds overly complex but it has a wrap around and auto increment feature that greatly simplifies writing character fonts and filling rectangles The pixel memory has 132 rows and 132 columns as shown below in Figure 6 131 0 131 131 11 L1 I a Rows m 1 8x8 box of Pixels at 4 2 to 11 9 t Single Pixel at 2 7 Ei 0 0 YY 131 Columns Figure 6 Philips PCF8833 Pixel Memory To address a single pixel just specify the same location for the starting pixel and the ending pixel on each axis For example to specify a single pixel at 2 7 use the following sequence WriteSpiCommand PASET WriteSpiData 2 WriteSpiData 2 Row address set command 0 2 starting x address endi
18. F K ok R ok ok void WriteSpiCommand volatile unsigned int command 4 wait for the previous transfer to complete while pSPI gt SPI_SR amp AT91C SPI 0 clear bit 8 indicates a command command command amp 0x0100 send the command pSPI gt SPI_TDR command ok ok ok ok ok ok ok ok ok ok ok ok 7 ok F ok ok ok ok ok ok ok ok E ok ok ok ok ok ok ok ok K ok R 2k ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok 2k o ok FK ok ok ok ok ok ok ok OR WriteSpiData c Writes 9 bit command to LCD display via SPI interface Inputs data Epson S1D15G00 controller driver command Note Sets bit 8 to indicate data transfer Author Olimex James P Lynch August 30 2007 gt k K lt ok ok ok sk ck ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok R ok ok ok ok ok ok ok ok K ok ok 2k KR ok ok ok ok ok ok ok 2k ok ok ok ok ok ok ok KOR oe ok oe ok ok ok ok ORORKOR oe void WriteSpiData volatile unsigned int data 4 wait for the transfer to complete while pSPI SPI SR 8 AT91C SPI TXEMPTY 0 set bit 8 indicates data data data 0x0100 send the data 5 gt 5 data gt lt lt gt gt K K 3K K gt K K K K K K R K K F F X K K R R R K F KR F K F F F KR K E FK KR K R R KR KR KR 2k k K KOR K
19. FK F 2K FK FK FK K 2K SK 2k oK K K K K void LCDWritel30x130bmp void long 1 loop counter Memory access controler command 0x36 WriteSpiCommand MADCTL WriteSpiData 0x48 no mirror Y temporary to satisfy Olimex bmptoarray utility Display OFF WriteSpiCommand DISPOFF Column address set command 0x2A WriteSpiCommand CASET WriteSpiData 0 WriteSpiData 131 Page address set command 0 2 WriteSpiCommand PASET WriteSpiData 0 WriteSpiData 131 WRITE MEMORY WriteSpiCommand RAMWR For 1 0 j sizeof bmp j 4 Memory access controler command 0x36 WriteSpiCommand MADCTL WriteSpiData 0xC8 restore to mirror x and y reverse rgb WriteSpiData bmp j Display On WriteSpiCommand DISPON gt gt lt ok ok ok ok FK k K K K SK F KR KR KR KR K K 2K K K FK FK FK E R R R R R KR SK FR SK R K K FK K R R R FK SI SE KOR KOR OR OR OR LCDClearScreen c Clears the LCD screen to single color BLACK Inputs none Author James P Lynch July 7 2007 704 KKK KK K K K K FK FK FK FK FK FK FK FK K K K FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK K FK FK FK FK FK FK FK FK FK FK FK FK K K FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK K K K K K K void LCDClearScreen void 4 long 1 loop counter Row address set command 0x2B WriteSpiCommand PASET WriteSpiData 0 Write
20. FKK K K K K K K k K Ak k FK kK K K FK 2K FK K FK FK FK K K FK K FK K FK FK FK FK FK K FK FK K FK K FK K FK K FK K FK K FK K FK K FK K K KK K K K K K K LCDClearScreen LCDWritel130x130bmp LCDPutStr This guy is nuts 115 2 LARGE BLACK CYAN draw a filled box LCDSetRect 90 70 75 120 FILL YELLOW LCDPutStr HELP 80 80 SMALL BLACK YELLOW 11 FKK KK K KK FK KK K FK K FK FK K K FK FK K K K KK K K K K K endless blink loop 7 while 1 4 if pPIO gt PIO_ODSR amp LED4 LED4 read previous state of LED4 pPIO PIO CODR LED4 turn LED4 DS1 on else pPIO PIO SODR LED4 turn LED4 051 off for j 1000000 j 0 j wait 1 second 1000000 IdleCount count of times through the idle loop When the main program runs a series of color filled rectangles is displayed with the name of the color annotated at the bottom of the screen as shown in Figure 13 below The colors displayed are White Black Red Green Blue Cyan Magenta Yellow Brown Orange Pink If you are curious as to how developed my color values referred to this web site http web njit edu kevin rgb txt html In this web site RGB to Color Name Mapping Triplet and Hex there is a decimal color table where each color value is in the range 0 to 255 simply used proportionality to convert these values to a ra
21. K F KR K E R K F R F K void LCDPutChar char c int x int y int size int fColor int bColor extern const unsigned char FONT6x8 97 8 extern const unsigned char FONT8x8 97 8 extern const unsigned char FONT8x16 97 16 int unsigned int nCols unsigned int nRows unsigned int nBytes unsigned char PixelRow unsigned char Mask unsigned int unsigned int Word1 unsigned char pFont unsigned char pChar unsigned char FontTable unsigned char FONT6x8 unsigned char FONT8x8 unsigned char FONT8x16 get pointer to the beginning of the selected font table pFont unsigned char FontTable size get the nColumns nRows and nBytes nCols pFont nRows pFont 1 nBytes pFont 2 get pointer to the last byte of the desired character pChar pFont nBytes Ox1F nBytes 1 Row address set command 0x2B WriteSpiCommand PASET WriteSpiData x WriteSpiData x nRows 1 Column address set command 0x2A WriteSpiCommand CASET WriteSpiData y WriteSpiData y nCols 1 WRITE MEMORY WriteSpiCommand RAMWR loop on each row working backwards from the bottom to the top for i nRows 1 i gt 0 i 4 copy pixel row from font table and then decrement row PixelRow pChar loop on each pixel in
22. LCD Display Driver 51015600 Controller 8 SMALL font mostly 5x7 FONT8x8 MEDIUM font 8x8 characters a bit thicker FONT8x16 LARGE font 8x16 characters thicker Note ASCII characters 0x00 through 1 are not included in these fonts Author Jim Parise James P Lynch August 30 2007 ok ok ok ok K ok ok ok ok ok ok ok ok ok ok ok ok E R ok ok ok ok const unsigned char FONT6x8 971 8 0x06 0x08 0x08 0x00 0x00 0x00 0x00 0x00 columns rows num bytes per char 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 space 0x20 0x20 0x20 0x20 0x20 0x20 0x00 0x20 0x00 0x50 0x50 0x50 0x00 0x00 0x00 0x00 0x00 x 0x50 0x50 0xF8 0x50 0xF8 0x50 0x50 0x00 0 20 0 78 0 0 0 70 0 28 0 0 0 20 0 00 0 0 0 8 0 10 0 20 0 40 0 98 0 18 0 00 0 40 0 0 OxAO 0x40 OxA8 0x90 0x68 0x00 0x30 0x30 0x20 0x40 0x00 0x00 0x00 0x00 0x10 0x20 0x40 0x40 0x40 0x20 0x10 0x00 0x40 0x20 0x10 0x10 0x10 0x20 0x40 0x00 0x00 0x20 0xA8 0x70 0x70 0xA8 0x20 0x00 0x00 0x20 0x20 0xF8 0x20 0x20 0x00 0x00 0x00 0x00 0x00 0x00 0x30 0x30 0x20 0x40 0x00 0x00 0x00 OxF8 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x30 0x30 0x00 0x00 0x08 0x10 0x20 0x40 0x80 0x00 0x00 forward s
23. Lcd h Si gt ok gt K gt K ok SK K K SK SK F F K SK K FK SK F F F SK FK FK SK K SE K K K K R SKK KR KR R SK K K FK K R FK R FK 9 9 FK K K KKK k K SE K K K LCD Include File for Philips PCF8833 STN RGB 132x132x3 Driver Taken from Philips data sheet Feb 14 2003 17 K 2K K FK FK K FK FK K K K K FK FK FK FK FK FK FK FK FK K K K K K FK FK FK FK FK FK FK FK FK FK FK FK K K K FK FK FK FK FK FK FK FK FK K K K K FK K FK FK FK FK FK FK K K K FK FK FK FK FK FK FK FK K K KK KK K K K K K K Philips PCF8833 LCD controller command codes define NOP 0x00 nop define SWRESET 0x01 software reset define BSTROFF 0x02 booster voltage OFF define BSTRON 0x03 booster voltage ON define RDDIDIF 0x04 read display identification define RDDST 0x09 read display status define SLEEPIN 0x10 sleep in define SLEEPOUT 0x11 sleep out define PTLON 0x12 partial display mode define NORON 0x13 display normal mode define INVOFF 0x20 inversion OFF define INVON 0x21 inversion ON define DALO 0x22 all pixel OFF define DAL 0x23 all pixel ON define SETCON 0x25 write contrast define DISPOFF 0x28 display OFF define DISPON 0x29 display ON define CASET 0 2 column address set define PASET page address set define RAMWR memory write define RGBSET colour set define PTLAR partial area define VSCRDEF vertical sc
24. OxOC 0x00 0x70 0x18 0x18 0x0E 0x18 0x18 0x70 0x00 0x3B 6 0x00 0x00 0x00 0x00 0x00 0x00 0x1C 0x36 0x36 0x1C 0x00 0x00 0x00 0x00 back slash AN X xXz ccHUO uozxrmxumnzrzommuo 2 4 g h i j k 1 m n 0 4 5 t v w x y z t const unsigned char FONT8x16 97 16 0x08 0x10 0x10 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 columns rows num_bytes_per_char 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 space 0x20 0x00 0x00 0x18 0x3C 0x3C 0x3C 0x18 0x18 0x18 0x00 0x18 0x18 0x00 0x00 0x00 0x00 0x00 0x63 0x63 0x63 0x22 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x36 0x36 0x7F 0x36 0x36 0x36 0x7F 0x36 0x36 0x00 0x00 0x00 0x00 di O0x0C 0x0C Ox3E 0x63 0x61 0x60 0x3E 0x03 0x03 0x43 0x63 0 OxOC 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x61 0x63 0x06 0x0C 0x18 0x33 0x63 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x1C 0x36 0x36 0x1C 0x3B Ox6E 0x66 0x66 0x3B 0x00 0x00 0x00 0x00 0x00 0x30 0x30 0x30 0x60 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0C 0x18 0x18 0x30 0x30 0x30 0x30 0x18 0x18 0x0C 0x00 0x00 0x00 0x00 0x00 0x00 0x18 0x0C 0x0C 0x06
25. P Lynch August 30 2007 gt k K ok ok ok ok ck ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok R ok ok E oe ok ok ok ok ok ok ok ok ok ok ok ok R KR void LCDSetPixel int x int y int color 4 Row address set command 0x2B WriteSpiCommand PASET WriteSpiData x WriteSpiData x Column address set command 0x2A WriteSpiCommand CASET WriteSpiData y WriteSpiData y Now illuminate the pixel 2nd pixel will be ignored WriteSpiCommand RAMWR WriteSpiData color gt gt 4 amp OxFF WriteSpiData color amp lt lt 4 color gt gt 8 amp OxF WriteSpiData color amp OxFF gt K gt lt gt lt x lt gt gt K K 3K gt K gt K K K K K K F ok K X K F LCDSetLine c Draws a line in the specified color from x0 y0 to 1 1 Inputs x row address 0 131 y column address 0 131 12 bit color value rrrrggggbbbb rrrr 1111 full red 0000 red is off gggg 1111 full green 0000 green is off bbbb 1111 full blue 0000 blue is off Returns nothing Note good write up on this algorithm in Wikipedia search for Bresenham s line algorithm see lcd h for some sample color settings Author
26. Row address set command 0x2B WriteSpiCommand PASET WriteSpiData xmin WriteSpiData xmax Column address set command 0x2A WriteSpiCommand CASET WriteSpiData ymin WriteSpiData ymax WRITE MEMORY WriteSpiCommand RAMWR loop on total number of pixels 2 for i 0 i lt xmax xmin 1 ymax ymin 1 2 130 i use the color value to output three data bytes covering two pixels WriteSpiData color gt gt 4 amp OxFF WriteSpiData color amp lt lt 4 color gt gt 8 amp OxF WriteSpiData color amp OxFF best way to draw un unfilled rectangle is to draw four lines LCDSetLine x0 y0 x1 color LCDSetLine x0 yl x1 yl color LCDSetLine x0 y0 x0 yl color LCDSetLine x1 y0 x1 yl color A AE A AE A A EA A EE A AE A A A A A A LCDSetCircle c Draws line in the specified color at center x0 y0 with radius Inputs x0 radius color row address 0 131 column address 0 131 radius in pixels 12 bit color value rrrrggggbbbb Returns nothing Author Jack Bresenham IBM Winthrop University Father of this algorithm 1962 Note taken verbatim Wikipedia article on Bresenham s line algorithm http www wikipedia org gt K AC ok ok ok ok ok F K ok KF ok FOR oK
27. and do a simple loop on 64 successive pixels The row and column addresses will automatically increment and wrap back when you come to the end of a row as shown in Figure 11 below The rules for Auto incrementing and Wrap Around are as follows Set the column and row address to the bottom left of the drawing box Set up a loop to do all the pixels in the box Specifically since three data bytes will specify the color for two pixels the loop will typically iterate over the total number of pixels in the box Writing three memory bytes will illuminate two pixels 12 bit resolution Each pixel written automatically advances the column address When the column address pixel is done the column address wraps back to the column starting address AND the row address increments by one Now keep writing memory bytes until the next row is illuminated and so on Figure 11 shows the traversal of the drawing box 131 0 131 131 Rows 8x8 box of Pixels at 4 2 to 11 9 00 Y 5 191 Columns Figure 11 Drawing Box permits auto increment and wrap around To illustrate this technique Figure 12 shows the code to fill an 8 x 8 box shown above Note that we set the row and column address just once pointing to the lower left corner Then we do a single Memory Write command followed by three data bytes done 33 times The grand total is 106 SPI transmissions Compare that to the imp
28. byte containing the value 5 This encoding requires a Memory Write command and two subsequent data bytes to specify a single pixel The color information is encoded as 5 bits for RED 6 bits for GREEN and 5 bits for BLUE as shown in Figure 10 below ME 5 i 1 R G G G Data Red 5 bits Green 6 bits Figure10 Color encoding for 16 bits per pixel This pixel encoding is converted by the controller using a dithering technique to the 12 bit data for the pixel RAM The net effect is to give 65k color variations My view is that nobody is going to display the Mona Lisa on this tiny display so 16 bit color encoding would be rarely used did not include support for it in the driver software but you could easily add it if you desire The Epson S1D15G00 controller supports the 8 bit and 12 bit modes but not the 16 bit mode Wrap Around and Auto Increment The wrap around feature is the cornerstone of the controller s design and it amazes me how many people ignored it in drawing rectangles and character fonts This feature allows you to efficiently draw a character or fill a box with just a simple loop taking advantage of the wrap around after writing the pixel in the last column and auto incrementing to the next row Remember how the pixel was addressed by defining a drawing box If you are planning to draw an 8 x 8 character font define the drawing box as 8 x 8
29. contrast command 0x25 WriteSpiCommand SETCON WriteSpiData 0x30 contrast 0x30 Delay 2000 Now that the display is initialized properly we can turn on the display and we re ready to start producing characters and graphics Display On command 0x29 WriteSpiCommand DISPON Initializing the LCD Display Epson 51015600 The Epson S1D15G00 controller also does not quite boot into a ready to display mode after hardware reset The following is the minimal commands data needed to place it into 12 bit color mode First we do a hardware reset with a simple manipulation of the port pin Reset is asserted low on this controller Hardware reset LCD RESET LOW Delay 20000 LCD RESET HIGH Delay 20000 Display timing is left at the default P1 0 the duty setting is based on 132 lines P2 0x20 and there will be no inversely highlighted lines P3 0 Display control WriteSpiCommand DISCTL WriteSpiData 0x00 0x00 2 divisions switching period 8 default WriteSpiData 0x20 P2 0x20 nlines 4 1 132 4 1 32 WriteSpiData 0x00 P3 0x00 no inversely highlighted lines To be completely honest here the common output scan direction chosen below 1 is the only setting found by experiment that resulted in a normal display all other settings resulted in split displays COM scan WriteSpiCommand COMSCN WriteSpiData 0x01 P1 0x01 Scan 1 gt 80 160 lt 81 Sinc
30. the SPI interface 1 to communicate with the LCD WriteSpiCommand command sends a command byte to the LCD WriteSpiData data sends a data byte to the LCD Using these commands is quite simple for example to initialize the SPI interface and then set the contrast for the Philips controller InitSpi Initialize SPI interface to LCD WriteSpiCommand SETCON Write contrast command 0x25 WriteSpiData 0x30 contrast 0x30 range is 63 to 63 The hardware interface uses five 1 port pins four bits from PIOA and one bit from PIOB as shown in Table 1 and Figure 5 below PA2 LCD Reset set to low to reset PA12 LCD chip select set to low to select the LCD chip PA17 SPIO MOSI Master Out Slave In pin Serial Data to LCD slave PA18 SPIO SPCK Serial Clock to LCD slave PB20 backlight control normally PWM control 1 full on Table 1 I O port bits used to support the SPI interface to the LCD Display Note in Table 1 above that Olimex elected not to support the SPIO MOSI Master In bit PA16 which would have allowed the user to read from the display The LED backlight needs a lot of current so a 7 volt boost converter is used for this purpose The backlight can be turned on and off using PB20 It looks like you might be able to PWM the backlight but doubt anyone would want the backlight to be at half brightness UDISPLAY UDIGITAL SCK 010 CS D P BAS RESET PA17 PA12
31. the row left to right Note we do two pixels each loop Mask 0x80 j 0 j lt nCols j 2 if pixel bit set use foreground color else use the background color now get the pixel color for two successive pixels if PixelRow amp Mask 0 bColor else Mask Mask gt gt 1 if PixelRow amp Mask 0 Wordl bColor fColor else Wordl Mask Mask 1 fColor use this information to output three data bytes WriteSpiData WordO gt gt 4 amp OxFF WriteSpiData WordO amp lt lt 4 1 gt gt 8 6 OxF WriteSpiData Wordl amp OxFF terminate the Write Memory command WriteSpiCommand NOP gt k K ok ok ok ok K ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok R ok R ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok K ok F EF ok R ok ok ok ok R ok ok R ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok o oe oe ok ok ok 2k ok OR OR OK LCDPutStr c Draws a null terminates character string at the specified x y address size and color Inputs pString x y Size fColor bColor pointer to character string to be displayed row address 0 131 column address 0 131 font pitch SMALL MEDIUM LARGE 12 bit foreground color value rrrrggggbbbb 12 bit background color value rrrrggggbbbb Returns nothing Notes Here s an example to display Hello World at address 20 20 LCD
32. 00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 Ox3E 0x63 0x60 0x60 0x60 0x63 0x3E 0x00 0x00 0x00 0x00 0x00 0x00 OxOE 0x06 0x06 Ox1E 0x36 0x66 0x66 0x66 0x66 0x3B 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 Ox3E 0x63 0x63 0 7 0x60 0x63 0x3E 0x00 0x00 0x00 0x00 0x00 0x00 0x1C 0x36 0x32 0x30 0x7C 0x30 0x30 0x30 0x30 0x78 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x3B 0x66 0x66 0x66 0x66 0x3E 0x06 0x66 0x3C 0x00 0x00 0x00 0x00 0x70 0x30 0x30 0x36 0x3B 0x33 0x33 0x33 0x33 0x73 0x00 0x00 0x00 0x00 0x00 0x00 0x0C 0Ox0C 0x00 Ox1C 0OxOC OxOC OxOC OxOC OxOC Ox1E 0x00 0x00 0x00 0x00 0x00 0x00 0x06 0x06 0x00 OxOE 0x06 0x06 0x06 0x06 0x06 0x66 0x66 0x3C 0x00 0x00 0x00 0x00 0x70 0x30 0x30 0x33 0x33 0x36 0x3C 0x36 0x33 0x73 0x00 0x00 0x00 0x00 0x00 0x00 0x1C 0xOC OxOC OxOC OxOC OxOC OxOC OxOC Ox1E 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 Ox6E Ox7F OXGB OxGB 0x6B Ox6B Ox6B 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x6E 0x33 0x33 0x33 0x33 0x33 0x33 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x3E 0x63 0x63 0x63 0x63 0x63 0x3E 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 Ox6E 0x33 0x33 0x33 0x33 0x3E 0x30 0x30 0x78 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x3B 0x66 0x66 0x66 0x66
33. 00 0x00 0x00 OxF8 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x30 0x30 0x00 2 0x00 0x08 0x10 0x20 0x40 0x80 0x00 0x00 forward slash 0x70 0x88 0x88 OxA8 0x88 0x88 0x70 0x00 0x30 0x20 0x60 0x20 0x20 0x20 0x20 0x70 0x00 0x70 0x88 0x08 0x70 0x80 0x80 OxF8 0x00 0 8 0 08 0 10 0 30 0 08 0 88 0 70 0 00 0x10 0x30 0x50 0x90 OxF8 0x10 0x10 0x00 OxF8 0x80 OxF0 0x08 0x08 0x88 0 70 0 00 0x38 0x40 0x80 OxF0 0x88 0x88 0x70 0x00 OxF8 0x08 0x08 0x10 0x20 0x40 0x80 0x00 0 70 0 88 0 88 0 70 0 88 0 88 0 70 0 00 0x70 0x88 0x88 0x78 0x08 0x10 OxEO 0x00 0x00 0x00 0x20 0x00 0x20 0x00 0x00 0x00 0x00 0x00 0x20 0x00 0x20 0x20 0x40 0x00 0x08 0x10 0x20 0x40 0x20 0x10 0x08 0x00 0 00 0 00 0 8 0 00 0 8 0 00 0 00 0 00 0x40 0x20 0x10 0x08 0x10 0x20 0x40 0x00 0x70 0x88 0x08 0x30 0x20 0x00 0x20 0x00 0x70 0x88 0xA8 0xB8 0xB0 0x80 0x78 0x00 0 20 0 50 0 88 0 88 0 8 0 88 0 88 0 00 OxF0 0x88 0x88 0xF0 0x88 0x88 OxFO 0x00 0 70 0 88 0x80 0x80 0x80 0x88 0x70 0x00 OxF0 0x88 0x88 0x88 0x88 0x88 OxF0 0x00 OxF8 0x80 0x80 OxFO 0x80 0x80 OxF8 0x00 OxF8 0x80 0x80 OxF0 0x80 0x80 0x80 0x00 0x78 0x88 0x80 0x80 0x98 0x88 0x78 0x00 0x88 0x88 0x88 OxF8 0x88 0x88 0x88 0x00 0x70 0x20 0x20 0x20 0
34. 000001 0x00000002 0x00000004 0x00000008 0x00000010 0x00000020 0x00000040 0x00000080 0x00000100 0x00000200 0x00000400 0x00000800 0x00001000 0x00002000 0x00004000 0x00008000 0x00010000 0x00020000 0x00040000 0x00080000 0x00100000 0x00200000 0x00400000 0x00800000 0x01000000 0x02000000 0x04000000 0x08000000 0x10000000 0x20000000 0x40000000 0x80000000 Lcd h LCD C for Epson 51015000 Controller only The module contains the SPI support code and a complete set of LCD graphics primitives The line drawing and circle routines are derived from the famous Jack Bresenham algorithms from 1962 The rest of the graphics primitives are designed by the author The font tables were adapted from the ARM example submitted to the Sparkfun web site by Jim Parise Ts RAR ARR ake e a AEE A AE A AE A AE A A AE EA A A AE A A EA A EA A EA A A A A A HEA A A AE A A AEE A A AE A A lcd c Nokia 6610 LCD Display Driver Epson 51015600 Controller Controller used for LCD Display is a Epson 51015600 driver Note For Olimex SAM7 EX256 boards with the G8 decal or the Sparkfun Color LCD 128x128 Nokia Knock Off We will use a 132 x 132 pixel matrix each pixel has 12 bits of color information 131 0 77 Nokia 6610 Display 132 x 132 pixel matrix has two methods to specify the color info 12 bits per pixel requires command and 1 5 data by
35. 0x00 0x00 0x7F 0x33 0x31 0x34 0x3C 0x34 0x30 0x30 0x30 0x78 0x00 0x00 0x00 0x00 0x00 0x00 0x1E 0x33 0x61 0x60 0x60 0x6F 0x63 0x63 0x37 0x1D 0x00 0x00 0x00 0x00 0x00 0x00 0x63 0x63 0x63 0x63 0x7F 0x63 0x63 0x63 0x63 0x63 0x00 0x00 0x00 0x00 0x00 0x00 0 3 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x18 0x3C 0x00 0x00 0x00 0x00 0x00 0x00 OxOF 0x06 0x06 0x06 0x06 0x06 0x06 0x66 0x66 0x3C 0x00 0x00 0x00 0x00 0x00 0x00 0x73 0x33 0x36 0x36 0x3C 0x36 0x36 0x33 0x33 0x73 0x00 0x00 0x00 0x00 0x00 0x00 0x78 0x30 0x30 0x30 0x30 0x30 0x30 0x31 0x33 0x7F 0x00 0x00 0x00 0x00 0x00 0x00 0x63 0x77 0 7 Ox6B 0x63 0x63 0x63 0x63 0x63 0x63 0x00 0x00 0x00 0x00 0x00 0x00 0x63 0x63 0x73 0x7B 0x7F 0x6F 0x67 0x63 0x63 0x63 0x00 0x00 0x00 0x00 0x00 0x00 0x1C 0x36 0x63 0x63 0x63 0x63 0x63 0x63 0x36 0x1C 0x00 0x00 0x00 0x00 0x00 0x00 0x7E 0x33 0x33 0x33 0x3E 0x30 0x30 0x30 0x30 0x78 0x00 0x00 0x00 0x00 0x00 0x00 0x3E 0x63 0x63 0x63 0x63 0x63 0x63 0x6B 0x6F 0x3E 0x06 0x07 0x00 0x00 0x00 0x00 0x7E 0x33 0x33 0x33 0x3E 0x36 0x36 0x33 0x33 0x73 0x00 0x00 0x00 0x00 0x00 0x00 0x3E 0x63 0x63 0x30 0x1C 0x06 0x03 0x63 0x63 0x3E 0x00 0x00 0x00 0x00 0x00 0x00 OxFF OXDB 0x99 0x18
36. 0x00 0x00 0x00 0x00 0x3B 0x66 0x66 0x66 0x66 0x3E 0x06 0x66 0x3C 0x00 0x00 0x00 0x00 0x70 0x30 0x30 0x36 0x3B 0x33 0x33 0x33 0x33 0x73 0x00 0x00 0x00 0x00 0x00 0x00 0x0C OxOC 0x00 0 1 OxOC OxOC OxOC OxOC OxOC Ox1E 0x00 0x00 0x00 0x00 0x00 0x00 0x06 0x06 0x00 OxOE 0x06 0x06 0x06 0x06 0x06 0x66 0x66 0x3C 0x00 0x00 0x00 0x00 0x70 0x30 0x30 0x33 0x33 0x36 0x3C 0x36 0x33 0x73 0x00 0x00 0x00 0x00 0x00 0x00 0Ox1C 0x0C OxOC OxOC OxOC OxOC OxOC OxOC OxOC Ox1E 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x6E Ox7F Ox6B Ox6B 0x6B 0x6B 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x6E 0x33 0x33 0x33 0x33 0x33 0x33 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x3E 0x63 0x63 0x63 0x63 0x63 0x3E 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x6E 0x33 0x33 0x33 0x33 0x3E 0x30 0x30 0 78 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x3B 0x66 0x66 0x66 0x66 0x3E 0x06 0x06 OxOF 0x00 0x00 0x00 0x00 0x00 0x00 0x00 Ox6E 0x3B 0x33 0x30 0x30 0x30 0x78 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x3E 0x63 0x38 0x0E 0x03 0x63 Ox3E 0x00 0x00 0x00 0x00 0x00 0x00 0x08 0x18 0x18 0x7E 0x18 0x18 0x18 0x18 0x1B OxOE 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x66 0x66 0x66 0x66 0x66 0x66 0x3B 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x63 0x63 0x
37. 0x00 0x00 0 7 0x00 0x00 0x30 0x18 0x0C 0x06 0x0C 0x18 0x30 0x00 0x3C 0x66 0x06 0x0C 0x18 0x00 0x18 0x00 0x3E 0x63 0x6F 0x69 0x6F 0x60 Ox3E 0x00 0x18 0x3C 0x66 0x66 0 7 0x66 0x66 0x00 0x7E 0x33 0x33 0x3E 0x33 0x33 0x7E 0x00 Ox1E 0x33 0x60 0x60 0x60 0x33 0x1E 0x00 0x7C 0x36 0x33 0x33 0x33 0x36 0x7C 0x00 0x7F 0x31 0x34 0x3C 0x34 0x31 0x7F 0x00 Ox7F 0x31 0x34 0x3C 0x34 0x30 0x78 0x00 Ox1E 0x33 0x60 0x60 0x67 0x33 0x1F 0x00 Ommoowranv il Aw 0x66 0x66 0x66 0x7E 0x66 0 66 0 66 0x00 0x3C 0x18 0x18 0x18 0x18 0x18 0x3C 0x00 OxOF 0x06 0x06 0x06 0x66 0x66 0x3C 0x00 0x73 0x33 0x36 0x3C 0x36 0x33 0x73 0x00 0x78 0x30 0x30 0x30 0x31 0x33 0x7F 0x00 0x63 0x77 0x7F 0x7F 0x6B 0x63 0x63 0x00 0x63 0x73 0x7B 0x6F 0x67 0x63 0x63 0x00 0 0x63 0x63 0x63 0x63 0x63 0x3E 0x00 0 7 0x33 0x33 0x3E 0x30 0x30 0x78 0x00 0x3C 0x66 0x66 0x66 0x6E 0x3C OxOE 0x00 0x7E 0x33 0x33 0x3E 0x36 0x33 0x73 0x00 0x3C 0x66 0x30 0x18 0x0C 0x66 0x3C 0x00 Ox7E 0x5A 0x18 0x18 0x18 0x18 0x3C 0x00 0x66 0x66 0x66 0x66 0x66 0x66 0x7E 0x00 0x66 0x66 0x66 0x66 0x66 0x3C 0x18 0x00 0x63 0x63 0x63 0x6B 0x7F 0x77 0x63 0x00 0x63 0x63 0x36 0x1C 0x1C 0x36 0x63 0x00 0x66 0x66 0x66 0x3C 0x18 0x18 0x3C 0x00 0 7 0x63 0x46 0x0C 0x19 0x33 0x7F 0x00 0x3C 0x30 0x30 0x30 0x30 0x30 0x3C 0x00 0 60 0 30 0 18 0 0 0 06 0 03
38. 0x06 0x06 0x06 0x0C 0xOC 0x18 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x42 0x66 0x3C OxFF 0x3C 0x66 0x42 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x18 0x18 0x18 OxFF 0x18 0x18 0x18 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x18 0x18 0x18 0x30 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 OxFF 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x18 0x18 0x00 0x00 0x00 0x00 0 00 0 00 0 01 0 03 0 07 0 0 0 1 0 38 0 70 0 0 0 0 0 80 0 00 0 00 0 00 0 00 forward slash 0x00 0x00 0x3E 0x63 0x63 0x63 0x6B 0x6B 0x63 0x63 0x63 0x3E 0x00 0x00 0x00 0x00 0x30 0x00 0x00 OxOC 0x1C 0x3C OxOC OxOC OxOC OxOC OxOC OxOC Ox3F 0x00 0x00 0x00 0x00 0x00 0x00 0x3E 0x63 0x03 0x06 0x0C 0x18 0x30 0x61 0x63 0 7 0x00 0x00 0x00 0x00 0x00 0x00 0x3E 0x63 0x03 0x03 0x1E 0x03 0x03 0x03 0x63 0x3E 0x00 0x00 0x00 0x00 0x00 0x00 0x06 OxOE Ox1E 0x36 0x66 0x66 0 7 0x06 0x06 OxOF 0x00 0x00 0x00 0x00 0x00 0x00 0x7F 0x60 0x60 0x60 0x7E 0x03 0x03 0x63 0x73 0x3E 0x00 0x00 0x00 0x00 0x00 0x00 0x1C 0x30 0x60 0x60 0x7E 0x63 0x63 0x63 0x63 0x3E 0x00 0x00 0x00 0x00 0x00 0x00 0x7F 0x63 0x03 0x06 0x06 0x0C OxOC 0x18 0x1
39. 0x3E 0x06 0x06 OxOF 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x6E 0x3B 0x33 0x30 0x30 0x30 0x78 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x3E 0x63 0x38 0x0E 0x03 0x63 Ox3E 0x00 0x00 0x00 0x00 0 00 0 00 0 08 0 18 0 18 0 7 0 18 0 18 0 18 0 18 0 1 0 0 0 00 0 00 0 00 0 00 0x00 0x00 0x00 0x00 0x00 0x66 0x66 0x66 0x66 0x66 0x66 0x3B 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x63 0x63 0x36 0x36 0x1C 0x1C 0x08 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x63 0x63 0x63 0 6 0x6B 0x7F 0x36 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x63 0x36 0x1C 0x1C 0x1C 0x36 0x63 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x63 0x63 0x63 0x63 0x63 0x3F 0x03 0x06 0x3C 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F 0x66 0x0C 0x18 0x30 0x63 0 7 0x00 0x00 0x00 0x00 0x00 0x00 OxOE 0x18 0x18 0x18 0x70 0x18 0x18 0x18 0x18 0xOE 0x00 0x00 0x00 0x00 0x00 0x00 0x18 0x18 0x18 0x18 0x18 0x00 0x18 0x18 0x18 0x18 0x18 0x00 0x00 0x00 0x00 0x00 0x70 0x18 0x18 0x18 OxOE 0x18 0x18 0x18 0x18 0x70 0x00 0x00 0x00 0x00 0x00 0x00 0x3B Ox6E 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x70 0 8 0xD8 0x70 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 back slash lt gt A B C D E F G H I
40. 0x42 0x66 0x3C OxFF 0x3C 0x66 0x42 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x18 0x18 0x18 OxFF 0x18 0x18 0x18 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x18 0x18 0x18 0x30 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 OxFF 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x18 0x18 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x03 0x07 0x0E 0x1C 0x38 0x70 0xE0 0xC0 0x80 0x00 0x00 0x00 0x00 forward slash 0x00 0x00 0x3E 0x63 0x63 0x63 0x6B 0x6B 0x63 0x63 0x63 0x3E 0x00 0x00 0x00 0x00 0x30 0x00 0x00 0x0C 0Ox1C 0x3C OxOC OxOC OxOC OxOC Ox3F 0x00 0x00 0x00 0x00 0x00 0x00 0 0x63 0x03 0x06 0x0C 0x18 0x30 0x61 0x63 0x7F 0x00 0x00 0x00 0x00 0x00 0x00 0 0x63 0x03 0x03 0 1 0x03 0x03 0x03 0x63 0x3E 0x00 0x00 0x00 0x00 0x00 0x00 0x06 OxOE Ox1E 0x36 0x66 0x66 0 7 0x06 0x06 OxOF 0x00 0x00 0x00 0x00 0x00 0x00 0x7F 0x60 0x60 0x60 0 7 0x03 0x03 0x63 0x73 0 0x00 0x00 0x00 0x00 0x00 0x00 0x1C 0x30 0x60 0x60 0x7E 0x63 0x63 0x63 0x63 0x3E 0x00 0x00 0x00 0x00 0x00 0x00 0 7 0x63 0x03 0x06 0x06 0x0C 0x0C 0x18 0x18 0x18 0x00 0x00 0x00 0x00 0x00 0x00 0x3E 0x63 0x63 0x63 0x3E 0x63 0x63 0x63 0x63 0x3E 0x00 0x00 0x00 0x00 0x00 0x00 0x3E 0x63 0x63 0
41. 36 0x36 0x1C 0x1C 0x08 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x63 0x63 0x63 0x6B 0Ox6B 0 7 0x36 0x00 0x00 0x00 0x00 back slash N xz ccCcuUuAuoOuUuOzxErAdGHIGOTmmOOOUDO VIA Z lt m 5 oO CsSO 53 mu pa e AMANO TD 0x00 0x00 0x00 0x00 0x00 0x63 0x36 0x1C 0x1C 0x1C 0x36 0x63 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x63 0x63 0x63 0x63 0x63 0x3F 0x03 0x06 0x3C 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F 0x66 0x0C 0x18 0x30 0x63 0x7F 0x00 0x00 0x00 0x00 0x00 0x00 0x0E 0x18 0x18 0x18 0x70 0x18 0x18 0x18 0x18 0x0E 0x00 0x00 0x00 0x00 0x00 0x00 0x18 0x18 0x18 0x18 0x18 0x00 0x18 0x18 0x18 0x18 0x18 0x00 0x00 0x00 0x00 0x00 0x70 0x18 0x18 0x18 Ox0E 0x18 0x18 0x18 0x18 0x70 0x00 0x00 0x00 0x00 0x00 0x00 0x3B OxGE 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x70 0xD8 0xD8 0x70 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 LCD H for Epson 51015000 Controller only This Icd h include file contains the Epson commands and color specification codes ifndef Lcd h define Lcd h gt K K gt K gt K gt K gt K K gt lt gt lt gt gt gt gt gt K gt gt K K K gt K gt K gt K gt K gt K K FK K K FK F F F K FK FK FK FK K R K K FK K K F F KF KR R FK K K K K K K F FK FK F F RR K R FK K R OR OR OR R R K K K K lcd h include file
42. 8 0x18 0x00 0x00 0x00 0x00 0x00 0x00 0x3E 0x63 0x63 0x63 0x3E 0x63 0x63 0x63 0x63 0x3E 0x00 0x00 0x00 0x00 0x00 0x00 0x3E 0x63 0x63 0x63 0x63 0x3F 0x03 0x03 0x06 0x3C 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x18 0x18 0x00 0x00 0x00 0x18 0x18 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x18 0x18 0x00 0x00 0x00 0x18 0x18 0x18 0x30 0x00 0x00 0x00 0x00 0x00 0x06 0x0C 0x18 0x30 0x60 0x30 0x18 0x0C 0x06 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7E 0x00 0x00 Ox7E 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x60 0x30 0x18 0x0C 0x06 0 0 0x18 0x30 0x60 0x00 0x00 0x00 0x00 0x00 0x00 0x3E 0x63 0x63 0x06 0x0C OxOC OxOC 0x00 OxOC OxOC 0x00 0x00 0x00 0x00 0x00 0x00 0x3E 0x63 0x63 0x6F 0x6B 0x6B 0x6E 0x60 0x60 0x3E 0x00 0x00 0x00 0x00 0x00 0x00 0x08 0 1 0x36 0x63 0x63 0x63 0x7F 0x63 0x63 0x63 0x00 0x00 0x00 0x00 0x00 0x00 0x7E 0x33 0x33 0x33 0x3E 0x33 0x33 0x33 0x33 0x7E 0x00 0x00 0x00 0x00 0x00 0x00 0x1E 0x33 0x61 0x60 0x60 0x60 0x60 0x61 0x33 0x1E 0x00 0x00 0x00 0x00 0x00 0x00 0x7C 0x36 0x33 0x33 0x33 0x33 0x33 0x33 0x36 0x7C 0x00 0x00 0x00 0x00 0x00 0x00 0x7F 0x33 0x31 0x34 0x3C 0x34 0x30 0x31 0x33 0x7F 0x00 0x00 0x00 0x00
43. 8 0 88 0 98 0 68 0 00 0 00 0 00 0 70 0 88 0 8 0 80 0 70 0 00 0 10 0 28 0 20 0 70 0 20 0 20 0 20 0 00 0 00 0 00 0 70 0 98 0 98 0 68 0 08 0 70 0 80 0 80 0 0 0 8 0 88 0 88 0 88 0 00 0 20 0 00 0 60 0 20 0 20 0 20 0 70 0 00 0 10 0 00 0 10 0 10 0 10 0 90 0 60 0 00 0x80 0x80 0x90 0xAO OxCO OxAO 0x90 0x00 0x60 0x20 0x20 0x20 0x20 0x20 0x70 0x00 0x00 0x00 0xDO 0xA8 OxA8 0xAB8 0xA8 0x00 0x00 0x00 0xB0 0xC8 0x88 0x88 0x88 0x00 0x00 0x00 0x70 0x88 0x88 0x88 0x70 0x00 0x00 0x00 OxBO 0xC8 OxC8 OxBO 0x80 Ox80 0x00 0x00 0x68 0x98 0x98 0x68 0x08 0x08 0x00 0x00 0xB0 0xC8 0x80 0x80 0x80 0x00 0x00 0x00 0x78 0x80 0x70 0x08 OxF0 0x00 0x20 0x20 0xF8 0x20 0x20 0x28 0x10 0x00 0 00 0 00 0 88 0 88 0 88 0 98 0 68 0 00 0 00 0 00 0 88 0 88 0 88 0 50 0 20 0 00 0 00 0 00 0 88 0 88 0 8 0 8 0 50 0 00 0 00 0 00 0 88 0 50 0 20 0 50 0 88 0 00 0 00 0 00 0 88 0 88 0 78 0 08 0 88 0 70 0 00 0 00 0 8 0 10 0 20 0 40 0 8 0 00 0 10 0 20 0 20 0 40 0 20 0 20 0 10 0 00 0 20 0 20 0 20 0 00 0 20 0 20 0 20 0 00 0 40 0 20 0 20 0 10 0 20 0 20 0 40 0 00 0 40 0 8 0 10 0 00 0 00 0 00 0 00 0 00 0x70 0xD8 0xD8 0x70 0x00 0x00 0x00 0x00 1 N KxzZz Xcrrtu3 2000583rm mxu HBHcuo amp oocoocuu const unsigned char FONT8x8 97 8 0x08 0x08 0x08 0x00 0x00 0
44. A8 0xA8 0x88 0x88 0x00 0x88 0x88 OxC8 OxA8 0x98 0x88 0x88 0x00 0x70 0x88 0x88 0x88 0x88 0x88 0x70 0x00 OxFO 0x88 0x88 0 0x80 0x80 0x80 0x00 0x70 0x88 0x88 0x88 0 8 0x90 0x68 0x00 OxFO 0x88 0x88 O0xFO 0xA0 0x90 0x88 0x00 0x70 0x88 0x80 0x70 0x08 0x88 0x70 0x00 OxF8 0xA8 0x20 0x20 0x20 0x20 0x20 0x00 0x88 0x88 0x88 0x88 0x88 0x88 0x70 0x00 0x88 0x88 0x88 0x88 0x88 0x50 0x20 0x00 0 0 88 0 88 0 88 0 8 8 8 0 50 0 00 0x88 0x88 0x50 0x20 0x50 0x88 0x88 0x00 0x88 0x88 0x50 0x20 0x20 0x20 0x20 0x00 OxF8 0x08 0x10 0x70 0x40 0x80 OxF8 0x00 0x78 0x40 0x40 0x40 0x40 0x40 0x78 0x00 0x00 0x80 0x40 0x20 0x10 0x08 0x00 0x00 0x78 0x08 0x08 0x08 0x08 0x08 0x78 0x00 0x20 0x50 0x88 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 OxF8 0x00 0x60 0x60 0x20 0x10 0x00 0x00 0x00 0x00 0x00 0x00 0x60 0x10 0x70 0x90 0x78 0x00 0x80 0x80 0xBO 0xC8 0x88 0xC8 0xB0 0x00 0x00 0x00 0x70 0x88 0x80 0x88 0x70 0x00 0x08 0x08 0x68 0x98 0x88 0x98 0x68 0x00 0x00 0x00 0x70 0x88 OxF8 0x80 0x70 0x00 0x10 0x28 0x20 0x70 0x20 0x20 0x20 0x00 0x00 0x00 0x70 0x98 0x98 0x68 0x08 0x70 0x80 0x80 0xBO 0xC8 0x88 0x88 0x88 0x00 0x20 0x00 0x60 0x20 0x20 0x20 0
45. FK FK FK FK FK FK FK FK K FK AKK K K K K K void WriteSpiData volatile unsigned int data 4 wait for the transfer to complete while 5 gt 5 SR amp AT91C SPI TXEMPTY 0 set bit 8 indicates data data data 0x0100 send the data 5 gt 5 data gt K gt lt ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok KR FK 2K K K K FK FK FK FK FK FK FK FK FK ok ok ok ok ok ok ok ok ok FK FK ok FK R FK KOR K FK R ke KOR K FK OR OR Backlight c Turns the backlight on and off Inputs state 1 2 Author Olimex James P Lynch July 7 2007 ok gt K gt K gt K gt K K KR K FK FK SK K R R R R R KR R KRK KR K FK K K K R FK SE R R SE 2K K K SE K OR OR void Backlight unsigned char state 4 backlight on backlight off if state 1 SODR BIT20 Set PB20 to HIGH else pPIOB PIO CODR BIT20 Set PB20 to LOW 77 vo KKK KK KK K kK K AK K K K FK FK FK FK FK FK FK FK FK FK K FK K FK FK FK FK FK FK FK FK FK FK FK FK K FK K FK FK FK FK FK FK FK FK FK FK K FK K FK K FK K FK FK FK FK FK FK FK FK FK K FK KK K K K K K InitLcd c Initializes the Philips PCF8833 LCD Controller Inputs none Author James P Lynch July 7 2007 gt k gt lt gt lt gt lt
46. FK FK FK FK K FK FK FK FK FK FK FK FK FK K FK FK FK FK FK FK K FK FK FK K FK K K K K K WriteSpiCommand c Writes 9 bit command to LCD display via SPI interface Inputs data Philips PCF8833 controller driver command Note clears bit 8 to indicate command transfer Author Olimex James P Lynch July 7 2007 gt K ok ok gt K ok ok K R K K FK X SK K F F K R K F FK FK R R R R R KR SK KR 2 SK KR FK SK FK R R R R R SI SE FK K K OR OR OR OR void WriteSpiCommand volatile unsigned int command wait for the previous transfer to complete while pSPI gt SPI_SR amp 91 5 0 clear bit 8 indicates a command command command amp 0x0100 send the command pSPI gt SPI_TDR command FK KKK K KK K FK K K FK K K FK FK FK FK FK K FK FK K FK FK FK K FK FK K FK FK K FK FK K FK FK FK K FK FK FK FK FK FK FK FK FK K FK FK K FK FK FK FK FK FK K FK FK FK FK FK FK K FK FK FK K FK FK K K K K WriteSpiData c Writes 9 bit command to LCD display via SPI interface 7 Inputs data Philips PCF8833 controller driver command 7 7 Note Sets bit 8 to indicate data transfer Author Olimex James P Lynch July 7 2007 gt K gt lt gt lt gt gt ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok 2k ok ok ok FK K ok ok ok FK ok ok ok ok FK FK FK FK FK FK FK FK FK FK K FK K FK K FK FK FK
47. FK FK FK K FK FK FK FK FK FK FK FK FK FK FK FK K K FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK K FK FK K FK FK FK FK FK FK FK K K K K void LCDSetRect int x0 int yO int 1 int yl unsigned char fill int color int xmin xmax ymin ymax int 1 check if the rectangle is to be filled if fill FILL 4 best way to create a filled rectangle is to define a drawing box and loop two pixels at a time calculate the min and max for x and y directions xmin 0 lt x1 x0 x1 xmax x0 gt x0 ymin lt yl yO ymax yO gt y1 y0 yl specify the controller drawing box according to those limits Row address set command 0x2B WriteSpiCommand PASET WriteSpiData xmin WriteSpiData xmax Column address set command 0x2A WriteSpiCommand CASET WriteSpiData ymin WriteSpiData ymax WRITE MEMORY WriteSpiCommand RAMWR loop on total number of pixels 2 for i 0 i lt xmax xmin 1 ymax ymin 1 2 1 i use the color value to output three data bytes covering two pixels WriteSpiData color gt gt 4 amp OxFF WriteSpiData color amp OxF lt lt 4 color gt gt 8 amp OxF WriteSpiData color amp OxFF else 4 best way to draw un unfilled rectangle is to draw four LCDSetLine x0 1 y0 col
48. J K L M N 0 P Q R S T U V W X Y 2 2 O n Sample Main Program Test Routine The following is a simple main program that exercises every one of the LCD graphics primitives It works with the driver code for either the Philips controller or the Epson controller After the tests have been completed the main program falls into an endless blink loop Since the SAM7 EX256 board has no user programmable LED the author added one as shown in the program s annotation you could remove the LED code if you like gt K gt lt ok ok ok ok gt lt ok gt lt ok ok gt ok ok k gt k gt K ok ok ok ok FK FK FK FK FK FK FK 2K 5 9 FK X K FK 9 X K K R K FK K FK K X 9 FK 9 FK 9 K 5 FK FK 2K FK 9 FK K X K K 9 K 9 K 9 K 5 9 FK K 9 K F SK 2K ok o ok K main c Nokia 6610 LCD demonstration program for Olimex SAM7 EX256 Evaluation Board Performs a series of tests of the LCD driver When tests are complete blinks LED4 pin PA3 with an endless loop PA3 is pin 1 on the EXT 20 pin connector 3 3v is pin 18 The Olimex SAM7 EX256 board has no programmable LEDs Added a simple test LED from Radio Shack as shown below attached to the 20 pin EXT connector anode PA3 LED cathode Radio Shack Red LED
49. K FK FK K FK FK FK FK FK FK FK FK FK FK FK FK FK K FK FK FK FK FK FK K K FK K K K K character and line tests draw lines strings etc 77 gt K gt lt gt lt gt lt gt lt gt lt gt k gt lt gt x gt gt x ok ok clear the screen LCDClearScreen set a few pixels LCDSetPixel 30 120 RED LCDSetPixel 34 120 GREEN LCDSetPixel 38 120 BLUE LCDSetPixel 40 120 WHITE draw some characters LCDPutChar E 10 10 SMALL WHITE BLACK draw a string LCDPutStr Hello World 60 5 SMALL WHITE BLACK LCDPutStr Hello World 40 5 MEDIUM ORANGE BLACK LCDPutStr Hello World 20 5 LARGE PINK BLACK draw a filled box LCDSetRect 120 60 80 80 FILL BROWN draw a empty box LCDSetRect 120 85 80 105 NOFILL CYAN draw some lines LCDSetLine 120 10 120 50 YELLOW LCDSetLine 120 50 80 50 YELLOW LCDSetLine 80 50 80 10 YELLOW LCDSetLine 80 10 120 10 YELLOW LCDSetLine 120 85 80 105 YELLOW LCDSetLine 80 85 120 105 YELLOW draw a circle LCDSetCircle 65 100 10 RED Delay 8000000 gt K gt lt gt lt gt K gt K K FK K ok ok ok ok ok ok ok ok ok ok ok ok FK FK FK FK FK ke K ok ok FK ok K FK ok ok R K ok FK FK K OR 2K 2K OK OK OK bmp display test display the Olimex photograph
50. Nokia 6100 LCD Display Driver Revision 1 Author James P Lynch PEL 7 256 MMOL INE III Introduction There have been countless millions of Nokia cell phones sold world wide and this economy of scale has made it possible for the hobbyist and experimenter to procure the LCD graphic display from these phones at a reasonable price Sparkfun Electronics www sparkfun com sells a model 6100 for 19 95 US l ve seen sources for this display on EBay for 7 99 US plus 10 00 shipping from Hong Kong so shipping is a bit slow The Swedish web shop Jelu www jelu se has this display for about 20 00 US also see photograph below Olimex uses these displays on their more sophisticated development boards so this tutorial will be geared to the Olimex SAM7 EX256 board shown on the front cover Figure 1 Nokia 6100 LCD Display from Jelu web site The important specifications for this display are as follows 132 x 132 pixels 12 bit color rendition 4 bits red 4 bits green 4 bits blue 3 3 volts 9 bit SPI serial interface clock data signals The major irritant in using this display is identifying the graphics controller there are two possibilities Epson 51015000 or Philips PCF8833 The LCD display sold by the German Web Shop Jelu has a Leadis LDS176 controller but it is 10096 compatible with the Philips PCF8833 So how do you tell which controller you have Some message boards h
51. OLCTR The resistance ratio was set to 3 by experiment this being the only value that worked The setting of the volume contrast value was also determined by experiment You should try several values to find the one that yields the most pleasing contrast for your display Voltage control contrast setting WriteSpiCommand VOLCTR WriteSpiData 32 P12 32 volume value adjust this setting for your display 0 63 WriteSpiData 3 P223 resistance ratio determined by experiment Finally delay a bit to allow the power regulator circuits to stabilize and then turn on the display This delay period is crucial a fact determined by experiment allow power supply to stabilize Delay 100000 turn on the display WriteSpiCommand DISON Description of the Software Modules The driver consists of a C module and a compatible file Icd h There is one version of each for the Philips PCF8833 controller and another version of each for the Epson S1G15D00 controller The main program runs a series of texts to demonstrate the capabilities of the driver A printout of the LCD driver code both versions and a simple main program to test it follows directly below Suitable Eclipse CDT projects are also available in zip file format for those who have the Olimex board LCD H for Philips PCF8833 Controller only The Ied h include file contains the Philips commands and color specification codes ifndef Lcd h define
52. OR R OR FK K FK OR R OR K K OR Backlight c Turns the backlight on and off Inputs state 1 backlight on 2 backlight off Author Olimex James P Lynch August 30 2007 gt k gt lt lt ok ok k K ok ok gt K ok ok ok ok ok ok F KF EF ok ok ok ok X ok R ok K ok ok R K ok ok F ok ok KR ok K ok ok ok ok K ok R KR K E ok ok ok KR ok R R KR ok ok ok ok ok ok KOR R OR oe ok ok ok ok ok oko OR void Backlight unsigned char state 4 if state 1 pPIOB PIO SODR BIT20 Set PB20 to HIGH else pPIOB PIO CODR BIT20 Set PB20 to LOW gt k gt K ok ok ok sk sk ok k ok ok ok ok ok ok ok F ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok K ok ok ok ok K ok KR 2k KR ok ok ok ok ok ok R 2k ok ok ok ok ok ok ok ok 2k oe ok oke ok ok ok ok FK K k oe InitLcd c Initializes the Epson S1D15G00 LCD Controller Inputs none Author James P Lynch August 30 2007 void InitLcd void 4 Hardware reset LCD RESET LOW Delay 10000 LCD RESET HIGH Delay 10000 Display control WriteSpiCommand DISCTL WriteSpiData 0x00 P1 0x00 2 divisions switching period 8 default WriteSpiData 0x20 P2 0x20 nlines 4 1 132 4 1 32 WriteSpiData 0x00
53. PutChar Hello World 20 20 LARGE WHITE BLACK Author James P Lynch August 30 2007 lt gt lt ok ok K ok ok ok ok K ok ok ok ok ok ok ok ok ok K ok ok K ok ok ok 2k F F ok ok K ok F 2k ok ok void LCDPutStr char pString int x int y int Size int fColor int bColor 4 loop until null terminator is seen while pString 0x00 4 draw the character LCDPutChar pString x y Size fColor bColor advance the y position if Size SMALL y y 6 else if Size MEDIUM y 8 else 8 bail out if y exceeds 131 if y 131 break gt k lt ok ok ok ok sk ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok K ok ok ok ok ok ok ok ok ok ok R 2k oe ok ok ok ok ok ok R KR ok R ok ok ok ok ok ck 2k o ok oe ok ok ok OR K K k oe Delay c Simple for loop delay Inputs a loop count Author James P Lynch August 30 2007 gt k K ok ok ok ok ck ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok K ok ok ok ok ok K R R 2k ok ok ok ok ok ok ok R KR ok R ok ok ok ok ok ok ok oe ok oe ok ok ok OR ORORKOR oe void Delay unsigned long a 4 while a 0 ff AEM a s HE HA AK EH AAA HHA HATE HATE HA HEH HE HAH oleo Font tables for Nokia 6610
54. R void LCDPutChar char c int x int y int size int fColor int bColor 4 extern const unsigned char FONT6x8 97 8 extern const unsigned char FONT8x8 97 8 extern const unsigned char FONT8x16 97 16 int i j unsigned int nCols unsigned int nRows unsigned int nBytes unsigned char PixelRow unsigned char Mask unsigned int Word0 unsigned int 1 unsigned char pFont unsigned char pChar unsigned char FontTable unsigned char 8 unsigned char FONT8x8 unsigned char FONT8x16 get pointer to the beginning of the selected font table pFont unsigned char FontTable size get the nColumns nRows and nBytes nCols pFont nRows pFont 1 nBytes pFont 2 get pointer to the last byte of the desired character pChar pFont nBytes c Ox1F nBytes 1 Row address set command 0 2 WriteSpiCommand PASET WriteSpiData x WriteSpiData x nRows 1 Column address set command 0x2A WriteSpiCommand CASET WriteSpiData y WriteSpiData y nCols 1 WRITE MEMORY WriteSpiCommand RAMWR loop on each row working backwards from the bottom to the top for i nRows 1 i gt 0 i copy pixel row from font table and then decrement row PixelRow pChar loop on each pixel in the row left to right Note we do two pixels each loop Mask 0x80 for j 0 j lt nCols j 2 if pixel bi
55. SE 2K K SE K K OR OR RR K K K K void LCDPutStr char pString int x int y int Size int fColor int bColor 4 pointer to character string to be displayed row address 0 131 column address 0 131 font pitch SMALL MEDIUM LARGE 12 bit foreground color value rrrrggggbbbb 12 bit background color value rrrrggggbbbb until null terminator is seen while pString 0x00 4 draw the character LCDPutChar pString x y Size fColor bColor advance the y position if Size SMALL 6 else if Size MEDIUM 8 else 8 bail out if y exceeds 131 if y 131 break KKK KK KK K K K AK K K K FK K FK FK FK K FK FK FK FK K FK K FK FK FK K FK FK FK K FK K FK FK K FK K FK FK FK K FK FK FK FK FK K K FK K FK K AK kK FK FK FK K FK kK K K FK K K KK K K K kK K Delay c 771 Simple for loop delay Inputs a loop count Author James P Lynch June 27 2007 K gt K K F FK FK FK FK FK FK FK FK K K FK FK FK FK FK FK FK FK FK FK FK FK K K K K FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK K K FK K K K void Delay unsigned long a while a 0 77 FK KKK FK KK FK FKK FK FK K FK FK K FK FK FK K FK FK FK FK FK FK FK FK FK FK FK FK K FK FK K FK FK FK FK FK FK K FK FK K K FK FK FK FK FK K FK FK FK FK FK FK K FK FK K FK FK FK FK FK FK K FK FK K K FK K K FK K K K Font tables for Nokia 6610 LCD Disp
56. SpiData 131 Column address set command 0 2 WriteSpiCommand CASET WriteSpiData 0 WriteSpiData 131 set the display memory to BLACK WriteSpiCommand RAMWR For i 0 i lt 131 131 2 i WriteSpiData BLACK gt gt 4 amp OxFF WriteSpiData BLACK amp OxF lt lt 4 BLACK gt gt 8 amp WriteSpiData BLACK amp OxFF gt K gt lt gt lt ok gt ok ok ok ok ok ok ok ok ok gt K ok ok ok ok ok ok ok ok ok K ok ok ok ok FK K ok ok ok ok ok ok ok ok X ok LCDSetXY c Sets the Row and Column addresses Inputs x row address 0 131 y column address 0 131 Returns nothing Author James P Lynch July 7 2007 gt K gt K FK gt K K 2 FK FK FK FK K 3 X K FK X 3 K FK K FK FK FK K FK 9 9 9 K 9 K K K FK K FK X F 2K F 2 FK K 2K 56 2k K K K K K void LCDSetXY int x int y Row address set command 0x2B WriteSpiCommand PASET WriteSpiData x WriteSpiData x Column address set command 0 2 WriteSpiCommand CASET WriteSpiData y WriteSpiData y gt K gt lt ok ok ok ok ok ok ok ok ok ok ok ok gt K ok ok ok ok ok ok ok ok ok K ok ok ok ok 2 K FK ok ok FK o
57. _SR_TXEMPTY define LCD_RESET_LOW pPIOA PIO CODR define LCD RESET HIGH gt 0 SODR mask definitions define BITO 0 00000001 define BIT1 0x00000002 define BIT2 0x00000004 define BIT3 0x00000008 define BIT4 0x00000010 define BIT5 0x00000020 define BIT6 0x00000040 define BIT7 0x00000080 define BIT8 0x00000100 define BIT9 0x00000200 define BIT10 0x00000400 define BIT11 0x00000800 define BIT12 0x00001000 define BIT13 0x00002000 define BIT14 0x00004000 define 15 0x00008000 define BIT16 0x00010000 define BIT17 0x00020000 define 18 0x00040000 define BIT19 0x00080000 define BIT20 0x00100000 define BIT21 0x00200000 define BIT22 0x00400000 define BIT23 0x00800000 define BIT24 0x01000000 define BIT25 0x02000000 define BIT26 0x04000000 define BIT27 0x08000000 define BIT28 0x10000000 define BIT29 0x20000000 define BIT30 0x40000000 define BIT31 0x80000000 LCD C for Philips PCF8833 Controller only The Icd c module contains the SPI support code and a complete set of LCD graphics primitives The line drawing and circle routines are derived from the famous Jack Bresenham algorithms from 1962 The rest of the graphics primitives are designed by the author The font tables were adapted from the ARM example submitted to the Sparkfun web site by Jim Parise gt K gt lt ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok FK ok 2K K K R K FK FK FK FK K R K FK R FK
58. able 0x01 SPI Mode Register SPI MR 0 0011 5 gt 5 MR AT91C SPI DLYBCS amp 0 24 Delay between chip selects take default 6 MCK periods AT91C SPI PCS amp lt lt 16 Peripheral Chip Select selects SPI NPCSO or PA12 AT91C SPI LLB amp 0 7 Local Loopback Enabled disabled AT91C SPI MODFDIS amp 1 4 Mode Fault Detection disabled AT91C SPI PCSDEC amp 0 2 Chip Select Decode chip selects connected directly to peripheral 91 SPI PS amp 0 lt lt 1 Peripheral Select fixed AT91C SPI MSTR amp 1 0 Master Slave Mode Master SPI Chip Select Register SPI CSR 0 0x01010311 5 gt 5 CSR 0 AT91C SPI DLYBCT amp 0x01 24 Delay between Consecutive Transfers 32 MCK periods AT91C SPI DLYBS amp 0x01 16 Delay Before SPCK 1 MCK period AT91C SPI SCBR amp 0x10 8 Serial Clock Baud Rate baudrate MCK 8 48054841 8 6006855 baud AT91C SPI BITS amp AT91C SPI BITS 9 Bits per Transfer 9 bits AT91C SPI CSAAT amp 0x0 3 Chip Select Active After Transfer AT91C SPI amp 0 0 lt lt 1 Clock Phase data captured on falling edge AT91C SPI CPOL amp 0x01 0 Clock Polarity inactive state is logic one 77 FKK KK K KK K FKK K FK K K FK FK K FK FK K FK FK FK FK FK FK K FK FK K FK FK FK FK FK K FK FK FK K FK FK FK FK FK
59. amp 0 2 Chip Select Decode chip selects connected directly to peripheral AT91C SPI PS amp 0 1 Peripheral Select fixed AT91C SPI MSTR amp 1 lt lt 0 Master Slave Mode Master SPI Chip Select Register SPI CSR O 0x01010311 pSPI gt SPI_CSR 0 AT91C_SPI_DLYBCT amp 0x01 lt lt 24 Delay between Consecutive Transfers 32 MCK periods 91 SPI DLYBS amp 0x01 lt lt 16 Delay Before SPCK 1 MCK period AT91C SPI SCBR amp 0x10 8 Serial Clock Baud Rate baudrate MCK 8 48054841 8 6006855 baud AT91C SPI BITS amp AT91C SPI BITS 9 Bits per Transfer 9 bits AT91C SPI CSAAT amp 0x0 3 Chip Select Active After Transfer is active after xfer AT91C SPI NCPHA amp 0x0 1 Clock Phase data captured on falling edge 1 SPI CPOL amp 0x01 0 Clock Polarity inactive state is logic one gt k gt K ok ok ok sk K ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok K ok ok ok ok ok ok ok ok K ok F EF ok ok ok ok ok ok ok ok KR ok R ok ok ok ok ok ok ok oe ok oke ok ok ok ok ok K ke oe WriteSpiCommand c Writes 9 bit command to LCD display via SPI interface Inputs data Epson S1D15G00 controller driver command Note clears bit 8 to indicate command transfer Author Olimex James P Lynch August 30 2007 ok K ok F K ok ok ok
60. arScreen c Clears the LCD screen to single color BLACK Inputs none Author James P Lynch August 30 2007 gt lt lt gt K K gt k gt K K K K 2K K K K K F K K R R K 9 R 9 X F F 7 R E FOR KR KR R R void LCDClearScreen void long 1 loop counter Row address set command 0x2B WriteSpiCommand PASET WriteSpiData 0 WriteSpiData 131 Column address set command 0x2A WriteSpiCommand CASET WriteSpiData 0 WriteSpiData 131 set the display memory to BLACK WriteSpiCommand RAMWR for i 06 i lt 131 131 2 i WriteSpiData BLACK gt gt 4 amp OxFF WriteSpiData BLACK amp lt lt 4 BLACK gt gt 8 6 WriteSpiData BLACK amp OxFF gt K gt lt gt lt K lt gt k K K gt K gt K K K K gt K K F F K X K K K R KR E K K K KR F F K 7 R K R KR E E RK KR KR R R R R R OE k 2K FK OR OROROR OR OR LCDSetPixel c Lights a single pixel in the specified color at the specified x and y addresses Inputs x row address 0 131 y column address 0 131 12 bit color value rrrrggggbbbb rrrr 1111 full red 0000 red is off gggg 1111 full green 0000 is off bbbb 1111 full blue 0000 blue is off Returns nothing Note see lcd h for some sample color settings Author James
61. ave suggested that the LCD display be disassembled and the controller chip measured with a digital caliper well that s getting a bit extreme Here s what know The Olimex boards have both display controllers possible if the LCD has a GE 12 sticker on it it s a Philips PCF8833 If it has a GE 8 sticker it s an Epson controller The older Sparkfun 6100 displays were Epson their web site indicates that the newer ones are an Epson clone Sparkfun software examples sometimes refer to the Philips controller so the whole issue has become a bit murky The trading companies in Honk Kong have no idea what is inside the displays they are selling A Nokia 6100 display that purchased from Hong Kong a couple of weeks ago had the Philips controller was not happy with any of the driver software examples had inspected they all seemed to be mash ups collections of code snippets for both types of controllers mixed together None of these examples matched exactly the Philips PCF8833 or the Epson S1D15G00 user manuals which can be downloaded from these links Philips NXP PCF8833 http www nxp com acrobat download datasheets PCF8833 1 pdf Epson S1D15G00 http www sparkfun com commerce product info php products id 569 So I set out to write a driver based solely on the LCD controller manufacturer s manual This is not to say that I didn t have my own mysteries had to invert the entire display and reverse the RGB order to get the colors t
62. d and 1 5 subsequent data bytes to specify a single pixel The bytes are packed so that two pixels will occupy three sequential bytes and the process repeats until the drawing boundaries are used up Figure 7 illustrates the 12 bits pixel encoding F RE EX EE RAMWR command memory write 1 1 o Rd pes Data Red and green from 1 pixel Data Blue from 1 pixel red from 274 pixel Data Green and blue from 2 pixel Figure 7 Color encoding for 12 bits pixel example illustrates sending 2 pixels You might pose the question What happens if specify a single pixel with just two data bytes Will the 4 bits of red information from the next pixel usually set to zero perturb the neighboring pixel The answer is no since the PCF8833 controller writes to display RAM only when it gets a complete pixel The straggler red bits from the next pixel wait for the completion of the remaining colors which will never come Appearance of any command will cancel the previous memory operation and discard the unused pixel information To be safe added a NOP command in the LCDSetPixel function to guarantee that the unused red information from the next pixel is discarded Figure 8 demonstrates how to send a single pixel using 12 bit encoding Note that the last 4 red bits from the next pixel will be ignored RAMWR command memory write P a n R Se e e Data Red an
63. d green from 1 pixel Data Blue from 1 pixel set red from 274 pixel to zero NOP command no operation This red pixel information for the next pixel will be discarded by the NOP command that follows Figure 8 Color encoding for 12 bits pixel example illustrates sending 1 pixel 8 bits per pixel Selection of the reduced resolution 8 bits pixel mode is accomplished by sending the Color Interface Pixel Format command 0x3A followed by a single data byte containing the value 2 This encoding requires a Memory Write command and a single subsequent data byte to specify a single pixel The data byte contains all the color information for one pixel The color information is encoded as 3 bits for red 3 bits for green and 2 bits for blue as shown in Figure 9 below oe RIRT R S G G BS 8 Red green and blue encoding 8 bits pixe Figure 9 Color encoding for 8 bits per pixel The important thing to note here is that this 8 bit color encoding will be converted to the 12 bit encoding by the Color Table that you set up in advance This Color Set table will convert 3 bit RED to 4 bit RED 3 bit GREEN to 4 bit GREEN and 2 bit BLUE to 4 bit BLUE This is made possible by the specification of the 20 entry color table in the initialization step WriteSpiCommand RGBSET Define Color Table command 0x2D WriteSpiData 0 red 000 value WriteSpiData 2 red 001 value WriteSp
64. e the Epson 51015000 boots up with the oscillators off and in sleep mode we have to turn the oscillators on and get out of sleep mode Internal oscilator ON WriteSpiCommand OSCON Sleep out WriteSpiCommand SLPOUT Now turn on all the voltage regulators Power control WriteSpiCommand PWRCTR WriteSpiData OxOf reference voltage regulator on circuit voltage follower on BOOST Just like the Philips PCF8833 controller you have to invert the display to make the colors display correctly Inverse display WriteSpiCommand DISINV The DATCTL command selects the display mode 8 bit or 12 bit selected 16 gray scale display P3 2 which forces 12 bit color just like the Philips example earlier The RGB sequence was left as the default value P2 0 and finally selected page address inverted column address normal and address scan in the column direction 1 was unable to get the display to work properly in the default orientation connector bottom left so this initialization assumes that the display is mounted with the connector top right Data control WriteSpiCommand DATCTL WriteSpiData 0x01 0x01 page address inverted col address normal address scan in col direction WriteSpiData 0x00 P2 0x00 RGB sequence default value WriteSpiData 0x02 P3 0x02 Grayscale gt 16 selects 12 bit color type A The contrast is set by the Electronic Volume Command V
65. een lettering is used as the up down reference So set the mirror x and mirror y command to rotate the display 180 degrees as shown below This will be the orientation used in this tutorial it is so easy to change back if you desire Rows 0 131 Columns v Figure 3 Tutorial Orientation of Nokia 6100 LCD Display Communication with the Display The Nokia 6100 uses a two wire serial SPI interface clock and data The ARM7 microcontroller SPI peripheral generates the clock and data signals and the display acts solely as a slave device Olimex elected to not implement the MISOO signal that would allow the ARM microcontroller to read from the LCD display you could read some identification codes status temperature data etc Therefore the display is strictly write only We send 9 bits to the display serially the ninth bit indicates if a command byte or a data byte is being transmitted Note in the timing diagram below from the Philips manual the ninth bit command or data is clocked out first and is LOW to indicate a command byte or HIGH to indicate a data byte Jj SCE SCLK s Ye e n peer e e XY 5 Figure 4 SPI serial interface sends commands and data bytes How fast can this SPI interface be run Since the PCF8833 data sheet specifies that the serial clock SCLK period be no less than 150 nsec dividing the board s master clock 48054841 Hz by 8 gives a period of
66. empChar 11 White Black Red Green Blue Cyan Magenta Yellow Brown Orange Pink Initialize the Atmel AT91SAM7S256 watchdog PLL clock default interrupts etc LowLevelInit Set up the LED PA3 volatile 91 5 pPIO 91 BASE PIOA pointer to PIO data structure pPIO PIO PER LED MASK PIO Enable Register allow PIO to control pin PP3 pPIO PIO OER LED MASK PIO Output Enable Register sets pin P3 to outputs pPIO PIO SODR LED MASK PIO Set Output Data Register turns off the LED Initialize SPI interface to InitSpi Init LCD InitLcd clear the screen LCDClearScreen gt K gt lt gt lt gt K gt lt K gt FK K ok ok ok ok ok ok ok ok ok ok ok ok K oK K FK K K FK K ok ok FK ok K FK ok R R ok ok FK FK K OR 2K 2K OK OK OR color test show boxes of different colors y gt K gt lt gt lt ok ok ok ok ok ok gt ok ok ok ok gt K gt K FK ok FK gt K ok ok X ok X ok X K K FK K FK 3 FK SK FK FK K FK 2K ok K ok K FK K FK FK FK 2K FK 26 FK 52 2K SK 2k K K K K K K for j 0 j 11 j draw a filled box LCDSetRect 120 10 25 120 FILL TempColor j label the color LCDPutStr 5 40 LARGE BLACK BLACK LCDPutStr TempChar j 5 40 LARGE YELLOW BLACK wait a bit Delay 2000000 11 FK KKK FK KK FK FK K FK FK K FK FK K FK FK FK K FK FK FK FK FK K FK FK FK K FK FK
67. for Epson 51015600 LCD Controller Author James Lynch August 30 2007 17 FKK KK K K K K K K K K K K K AK K AK K K K 3K FK FK FK FK FK FK FK FK FK K FK K FK FK FK FK FK 2K FK FK FK kK FK FK K FK kK FK kK FK FK FK FK FK K FK K FK FK K FK K FK K K K K K K kK K kK K K K define DISON OxAF Display on define DISOFF OxAE Display off define DISNOR 0xA6 Normal display define DISINV 0 7 Inverse display define COMSCN OxBB Common scan direction define DISCTL OxCA Display control define SLPIN 0x95 Sleep in define SLPOUT 0x94 Sleep out define PASET 0x75 Page address set define CASET 0x15 Column address set define DATCTL OxBC Data scan direction etc define RGBSET8 OxCE 256 color position set define RAMWR 0 5 Writing to memory define RAMRD 0 50 Reading from memory define PTLIN 0 8 Partial display in define PTLOUT 0 9 Partial display out define RMWIN OxEO Read and modify write define RMWOUT OxEE End define ASCSET 0 Area scroll set define SCSTART Scroll start set define OSCON OxD1 Internal oscillation on define OSCOFF OxD2 Internal oscillation off define PWRCTR 0x20 Power control define VOLCTR 0x81 Electronic volume control define VOLUP OxD6 Increment electronic control by 1 define VOLDOWN 7 Decrement electronic control by 1 define TMPGRD 0x82 Temperature gradient set define EPCTIN OxCD C
68. gle 77 WriteSpiCommand PASET set the row boundaries WriteSpiData xmin WriteSpiData xmax WriteSpiCommand CASET set the column boundaries WriteSpiData ymin WriteSpiData ymax 3 Calculate the number of pixels to be written divided by 2 NumPixels xmax xmin 1 ymin 1 2 1 You may notice that I added one pixel to the formula This covers the case where the number of pixels is odd and we would lose one pixel due to rounding error the case of odd pixels the number of pixels is exact in the case of even pixels we have one more pixel than needed but it cannot be displayed because it is outside the drawing box We divide by 2 because two pixels are represented by three bytes 7 So we work through the rectangle two pixels at a time 4 Now a simple memory write loop will fill the rectangle for i 0 i lt xmax xmin 1 ymax ymin 1 2 1 itt WriteSpiData color 4 amp OxFF WriteSpiData color amp lt lt 4 color gt gt 8 amp OxF WriteSpiData color amp OxFF In the case of an unfilled rectangle drawing four lines with the Bresenham line drawing algorithm is reasonably efficient Author James P Lynch July 7 2007 KKK KK K K K K 3K 2K 2K FK FK FK FK FK K K K FK FK FK FK FK FK FK FK FK FK FK FK FK
69. gt lt lt gt gt ok ok ok K gt K gt K gt K 2 k K K SK K KR KR K K 2K F K K R K FK FK FK FK R R R R R R KR KR 2 SK FK SK K 9 9 2K R FK R R SE 2K K K K K K OR id InitLcd void Hardware reset LCD RESET LOW Delay 20000 LCD RESET HIGH Delay 20000 Sleep out command 0x11 WriteSpiCommand SLEEPOUT Inversion on command 0x20 WriteSpiCommand INVON seems to be required for this controller Color Interface Pixel Format command 0x3A WriteSpiCommand COLMOD WriteSpiData 0x03 0x03 12 bits per pixel Memory access controler command 0x36 WriteSpiCommand MADCTL WriteSpiData 0xC8 0 0 mirror x and y reverse rgb Write contrast command 0x25 WriteSpiCommand SETCON WriteSpiData 0x30 contrast 0x30 Delay 2000 Display On command 0x29 WriteSpiCommand DISPON gt K gt lt ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok FK K ok ok ok 2 ok ok FK FK K FK K FK FK FK FK FK FK FK FK FK FK K FK K FK K FK K FK FK FK FK FK FK FK K FK K K KK K K K K K LCDWrite130x130bmp c Writes the entire screen from a bmp file Uses 011 BmpToArray exe utility Inputs picture in bmp h Author Olimex James P Lynch July 7 2007 ok ok ok ok ok ok ok gt ok ok ok ok gt K ok ok gt K ok ok ok ok ok ok ok ok ok ok ok FK K ok ok ok FK ok ok ok ok K ok X FK ok FK K FK ok ok 9 ok R ok ok R ok K ok K ok ok FK
70. iData 5 red 010 value WriteSpiData 7 red 011 value WriteSpiData 9 red 100 value WriteSpiData 11 red 101 value WriteSpiData 14 red 110 value WriteSpiData 16 red 111 value WriteSpiData 0 WriteSpiData 2 WriteSpiData 5 WriteSpiData 7 WriteSpiData 9 WriteSpiData 11 WriteSpiData 14 WriteSpiData 16 WriteSpiData 0 WriteSpiData 6 WriteSpiData 11 WriteSpiData 15 green 000 value green 001 value green 010 value green 011 value green 100 value green 101 value green 110 value green 111 value blue 000 value blue 001 value blue 010 value blue 011 value Consider the following points The resolution of the Nokia 6100 display is 132 x 132 pixels 12 bits pixel Since the 8 bits pixel encoding is converted by the color table to 12 bits pixel there is no saving of display memory The 8 bits pixel encoding would use about 1 3 less data bytes to fill an area so there would be a performance gain in terms of the number of bytes transferred The 8 bits pixel encoding would make a photograph look terrible In the author s view there s very little to be gained by using this mode in an ARM microcontroller environment Therefore elected to not implement the color table and 8 bit encoding in this driver 16 bits per pixel Selection of 16 bits pixel mode is accomplished by sending the Color Interface Pixel Format command 0x3A followed by a single data
71. in PB20 used for LCD BL backlight pPIOB PIO BIT20 Configure PB20 as output pPIOB PIO SODR BIT20 Set PB20 to HIGH backlight under PWM control this will turn it full on Pin PA2 used for LCD RESET pPIOA PIO BIT2 Configure 2 as output pPIOA gt PIO_SODR BIT2 Set PA2 to HIGH assert LCD Reset low then high to reset the controller Pin PA2 used for CS LCD chip select pPIOA PIO OER BIT12 Configure PA12 as output pPIOA PIO SODR BIT12 Set PA12 to HIGH assert CS LCD low to enable transmission Disable the following pins from PIO control will be used instead by the SPIO peripheral BIT12 PA12 SPIO NPCSO chip select BIT16 16 gt 5 10 150 Master In Slave Out not used in LCD interface BIT17 PA17 SPIO MOSI Master Out Slave In pin Serial Data to LCD slave BIT18 PA18 gt SPIO SPCK Serial Clock to LCD slave pPIOA gt PIO_ PDR BIT12 16 BIT17 BIT18 Peripheral A Disable Register Disable PIO control pPIOA gt PIO_ASR BIT12 BIT16 BIT17 BIT18 Peripheral A Select Register all 4 bits are in PIOA BSR 0 Peripheral B Select Register no bits in PIOB enable the SPIO Peripheral clock pPMC gt PMC_PCER 1 lt lt AT91C_ID SPIO SPI Control Register SPI_CR pSPI gt SPI_CR AT91C_SPI_SWRST AT91C_SPI_SPIEN Software reset SPI Enable 0x81 pSPI gt SPI_CR AT91C_SPI_SPIEN SPI En
72. k ok K ok ok K K K F K K F F K K 7 F F R KR F 9 5 ok void LCDWritel30x130bmp void 4 long 16 loop counter Data control need to set normal page address for Olimex photograph WriteSpiCommand DATCTL WriteSpiData 0x00 P1 0x00 page address normal column address normal address scan in column direction WriteSpiData 0x00 P2 0x00 RGB sequence default value WriteSpiData 0x02 P3 0x02 Grayscale 16 Display OFF WriteSpiCommand DISOFF Column address set command 0 2 WriteSpiCommand CASET WriteSpiData 0 WriteSpiData 131 Page address set command 0 28 WriteSpiCommand PASET WriteSpiData 0 WriteSpiData 131 WRITE MEMORY WriteSpiCommand RAMWR for j 0 j lt 25740 j 4 WriteSpiData bmp j Data control return to inverted page address WriteSpiCommand DATCTL WriteSpiData 0x01 P1 0x01 page address inverted column address normal address scan in column direction WriteSpiData 0x00 P2 0x00 RGB sequence default value WriteSpiData 0x02 P3 0x02 Grayscale 16 Display On WriteSpiCommand DISON gt k gt lt gt lt lt gt K K K gt K gt K K K K K F K K K K F K K K R F K E K 9K R KR EF K k 2K R K K R F 97 FEF KR K R R KR KR R E OR KR R OR K 2G R OR FK K K 2K OR OR KK OR LCDCle
73. k ok K ok ok ok ok K ok ok ok ok ok ok ok ok ok ok ok ok K K R ok K ok K ok ok ok F K 2k R R ok InitSpi Sets up SPI channel 0 for communications to Nokia 6610 LCD Display 1 0 ports used 2 PA12 PA16 PA17 PA18 PB20 Author Olimex James P Lynch August 30 2007 ok ok ok ok K ok ok ok K ok ok ok ok ok ok ok ok ok ok K K K ok K ok K ok ok ok EF K 2k F F ok 2k ok ok ok ok ok K void InitSpi void LCD Reset set to low to reset LCD chip select set to low to select the LCD chip SPIO MISO Master In Slave Out not used in LCD interface SPIO MOSI Master Out Slave In pin Serial Data to LCD slave SPIO SPCK Serial Clock to LCD slave backlight control normally PWM control 1 full on Pin PB20 used for LCD BL backlight pPIOB PIO BIT20 Configure PB20 as output pPIOB PIO 5008 BIT20 Set PB20 to HIGH backlight under PWM control this will turn it full on Pin PA2 used for LCD RESET pPIOA PIO BIT2 Configure PA2 as output pPIOA PIO SODR BIT2 Set PA2 to HIGH assert LCD Reset low then high to reset the controller Pin PA2 used for CS LCD chip select pPIOA PIO BIT12 Configure PA12 as ou
74. k ok ok ok ok ok X ok ok FK FK K 9 K ok K ok ok ok ok FK K F FK ok FK ok ok F ok K 9 ok O F K FK K FK K SK K SK LCDSetPixel c Lights a single pixel in the specified color at the specified x and y addresses Inputs x y color row address 0 131 column address 0 131 12 bit color value rrrrggggbbbb rrrr 1111 full red 0000 red is off 1111 full green Abbe green is off 1111 full blue 0000 blue is off Returns nothing Note see lcd h for some sample color settings Author James P Lynch July 7 2007 lt gt lt gt lt ok ok ok ok gt K gt K gt K gt K gt K ok ok R KR K KR KR KRK KR K SK FK K K K R K K R F R R R K FK FK FK K K R KR FK R R SE K SR K FK R SE OR K FK K K R R R R R 2K OR OR OR OR void LCDSetPixel int x int y int color LCDSetXY x y WriteSpiCommand RAMWR WriteSpiData unsigned char color gt gt 4 amp OxFFFF WriteSpiData unsigned char color amp 0x0F lt lt 4 0x00 WriteSpiCommand NOP ok ok ok KR ok ok ok K FK K FK SK FK FK X FK K FK KR 9 K 9 K FK ok 5 5 FK 2 5 5 R 9 R FK 9 X K R 9 FK K F K K FK SK OK FOR R OK OR K OR K K OK LCDSetLine c Draws a line in the specified color from x0 y0 to 1 1 Inputs
75. lash 0x70 0x88 0x88 0xA8 0x88 0x88 0x70 0x00 0x30 0x20 0x60 0x20 0x20 0x20 0x20 0x70 0x00 0x70 0x88 0x08 0x70 0x80 0x80 0xF8 0x00 OxF8 0x08 0x10 0x30 0x08 0x88 0x70 0x00 0x10 0x30 0x50 0x90 OxF8 0x10 0x10 0x00 OxF8 0x80 OxFO 0x08 0x08 0x88 0x70 0x00 0x38 0x40 0x80 OxFO 0x88 0x88 0x70 0x00 8 0x08 0x08 0x10 0x20 0x40 0x80 0x00 0x70 0x88 0x88 0x70 0x88 0x88 0x70 0x00 0x70 0x88 0x88 0x78 0x08 0x10 OxEO 0x00 0x00 0x00 0x20 0x00 0x20 0x00 0x00 0x00 0x00 0x00 0x20 0x00 0x20 0x20 0x40 0x00 0x08 0x10 0x20 0x40 0x20 0x10 0x08 0x00 0x00 0x00 OxF8 0x00 OxF8 0x00 0x00 0x00 0x40 0x20 0x10 0x08 0x10 0x20 0x40 0x00 0x70 0x88 0x08 0x30 0x20 0x00 0x20 0x00 0x70 0x88 0xA8 0xB8 0xBO 0x80 0x78 0x00 0x20 0x50 0x88 0x88 OxF8 0x88 0x88 0x00 OxFO 0x88 0x88 OxFO 0x88 0x88 0xF0 0x00 0x70 0x88 0x80 0x80 0x80 0x88 0x70 0x00 OxFO 0x88 0x88 0x88 0x88 0x88 0xF0 0x00 0xF8 0x80 0x80 0xF0 0x80 0x80 OxF8 0x00 OxF8 0x80 0x80 OxFO 0x80 0x80 0x80 0x00 0x78 0x88 0x80 0x80 0x98 0x88 0x78 0x00 0x88 0x88 0x88 OxF8 0x88 0x88 0x88 0x00 0x70 0x20 0x20 0x20 0x20 0x20 0x70 0x00 0x38 0x10 0x10 0x10 0x10 0x90 0x60 0x00 0 88 0 90 0 0 0 0 0xA0 0x90 0x88 0x00 0x80 0x80 0x80 0x80 0x80 0x80 0xF8 0x00 0x88 0xD8 0xA8 Ox
76. lay Driver PCF8833 Controller FONT6x8 SMALL font mostly 5x7 FONT8x8 MEDIUM font 8x8 characters a bit thicker FONT8x16 LARGE font 8x16 characters thicker Note ASCII characters 0x00 through 0x1F are not included in these fonts First row of each font contains the number of columns the number of rows and the number of bytes per character Author Jim Parise James P Lynch July 7 2007 77 gt K gt gt lt gt lt gt lt gt K gt K gt K k ok 9 SK K K FK E SK SK K K K FK R K K K K FK KE SK K K F FK R ORO KOR SE 2K SK K K OR const unsigned char FONT6x8 97 8 0x06 0x08 0x08 0x00 0x00 0x00 0x00 0x00 columns rows num_bytes_per_char 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 space 0x20 0x20 0x20 0x20 0x20 0x20 0x00 0x20 0x00 0x50 0x50 0x50 0x00 0x00 0x00 0x00 0x00 n 0x50 0x50 0xF8 0x50 0xF8 0x50 0x50 0x00 0x20 0x78 0 0x70 0x28 OxFO 0x20 0x00 0xC0 0xC8 0x10 0x20 0x40 0x98 0x18 0x00 0x40 0xA0 0xAO 0x40 0xA8 0x90 0x68 0x00 0x30 0x30 0x20 0x40 0x00 0x00 0x00 0x00 0x10 0x20 0x40 0x40 0x40 0x20 0x10 0x00 0x40 0x20 0x10 0x10 0x10 0x20 0x40 0x00 0x00 0x20 OxA8 0x70 0x70 OxA8 0x20 0x00 0x00 0x20 0x20 OxF8 0x20 0x20 0x00 0x00 0x00 0x00 0x00 0x00 0x30 0x30 0x20 0x40 0x
77. lementation where you address each pixel set Memory Write and feed two bytes of color data for each pixel The grand total would be 576 SPI transmissions The advantage gained using the auto increment and wrap around features is obvious Row address set command 0x2B WriteSpiCommand PASET WriteSpiData 4 WriteSpiData 11 Column address set command 0x24 WriteSpiCommand CASET WriteSpiData 2 WriteSpiData 9 Write Memory command 0 2 WriteSpiCommand RAMWR loop on total number of pixels 2 for i O i lt 11 4 1 9 2 1 2 1 i use the color value to output three data bytes covering two pixels WriteSpiData color gt gt 4 amp OxFF WriteSpiData color amp OxF lt lt 4 color gt gt 8 amp OxF WriteSpiData color amp OxFF Figure 12 Code Snippet to Fill an 8 x 8 box Code to use this technique to draw a character font is similar but at each pixel you have to determine if the font calls for a foreground color or the background color Initializing the LCD Display Philips PCF8833 This was a surprise to me but the Philips PCF8833 does not quite boot into a ready to display mode after hardware reset The following is the minimal commands data needed to place it into 12 bit color mode First we do a hardware reset with a simple manipulation of the port pin Reset is asserted low on this controller Hardware reset LCD RESET LOW Delay 20000
78. ne more pixel than needed but it cannot be displayed because it is outside the drawing box We divide by 2 because two pixels are represented by three bytes So we work through the rectangle two pixels at a time 4 Now a simple memory write loop will fill the rectangle for i 0 i lt xmin 1 ymax ymin 1 2 1 i WriteSpiData color gt gt 4 amp OxFF WriteSpiData color amp lt lt 4 color gt gt 8 amp OxF WriteSpiData color amp OxFF In the case of an unfilled rectangle drawing four lines with the Bresenham line drawing algorithm is reasonably efficient Author James P Lynch August 30 2007 ok ok ok ok F ok 2k ok ok ok ok ok ok ok R ok ok E ok ok ok ok ok ok ok KR KF ok ok ok ok ok ok ok R ok ok ok ok ok ok ok ok ok ok KR 2k ok ok ok ok ok ok ok ok 9K K ok ok ok ok ok ok R ok ok ok oe ok ok oK OR 2k ok ok 2 R void LCDSetRect int x0 int int int yl unsigned char fill int color int xmin xmax ymin ymax int 1 check if the rectangle is to be filled if fill FILL 4 best way to create a filled rectangle is to define a drawing box and loop two pixels at a time calculate the min and max for x and y directions xmin x0 lt x1 x0 x1 xmax x0 x1 x0 x1 ymin yO lt yl yO yl ymax gt y1 yO yl specify the controller drawing box according to those limits
79. ng x address same as start WriteSpiCommand CASET WriteSpiData 7 WriteSpiData 7 Column address set command 0 2 starting y address ending y address same as start To address a rectangular area of pixels just specify the starting location and the ending location on each axis as shown below For example to define a drawing rectangle from 4 3 to 11 9 use the following sequence WriteSpiCommand PASET WriteSpiData 4 WriteSpiData 11 Row address set command 0 2 starting x address ending x address WriteSpiCommand CASET WriteSpiData 3 WriteSpiData 9 Column address set command 0 2 starting y address ending y address Once the drawing boundaries have been established either a single pixel or a rectangular group of pixels any subsequent memory operations are confined to that boundary For instance if you try to write more pixels than defined by the boundaries the extra pixels are discarded by the controller The Epson S1D15G00 controller has essentially the same memory layout as the Philips NXP PCF8833 12 Bit Color Data The Philips PCF8833 LCD controller has three different ways to specify a pixel s color 1 12 bits per pixel native mode Selection of the native 12 bits pixel mode is accomplished by sending the Color Interface Pixel Format command 0x3A followed by a single data byte containing the value 3 This encoding requires a Memory Write comman
80. nge of 0 to 15 This may come in handy when you need to display the color Turquoise Hello World Figure 13 Filled Rectangle Figure 14 Text and Graphics In Figure 14 above the display shows various rectangles filled and unfilled lines and circles The three font sizes are demonstrated and you can see some single pixel specifications on the far right In Figure 15 below the Olimex BMP image has been displayed with a few overlays of text Olimex has a free utility on their web site to convert pictures jpeg into the 132 x 132 motif required by the Nokia 6100 LCD display The text overlays demonstrate foreground and background color specification Figure 15 Display of a bmp image with text There is available with this tutorial two sample Eclipse projects one for the Philips controller and one for the Epson controller They are almost identical save for the list of command codes in the file Icd h and the InitLcd routine in the file Icd c You need only determine your controller type and then pick the appropriate example to use Conclusions set out to write a Nokia 6100 LCD Display Driver that was 100 related to the Philips and Epson Data Sheets generally succeeded but there is still the mystery of why the display needed to be inverted and the RGB setting had to be reversed The subroutines contained herein are the most efficient for this particular controller If you need to port this to a diffe
81. nt way to display a character is to make use of the wrap around feature of the Epson S1D16G00 LCD controller chip Assume that we position the character at 20 20 that s a row col specification With the row and column address set commands you can specify an 8x8 box for the SMALL and MEDIUM characters or a 16x8 box for the LARGE characters WriteSpiCommand PASET set the row drawing limits WriteSpiData 20 WriteSpiData 27 limit rows to 20 27 WriteSpiCommand CASET set the column drawing limits WriteSpiData 20 WriteSpiData 27 limit columns to 20 27 When the algorithm completes col 27 the column address wraps back to 20 At the same time the row address increases by one this is done by the controller We walk through each row two pixels at a time The purpose is to create three data bytes representing these two pixels in the following format Data for pixel 0 RRRRGGGGBBBB Data for Pixel 1 RRRRGGGGBBBB WriteSpiCommand RAMWR start a memory write 96 data bytes to follow WriteSpiData RRRRGGGG first pixel red and green data WriteSpiData BBBBRRRR first pixel blue data second pixel red data WriteSpiData GGGGBBBB second pixel green and blue data and so on until all pixels displayed WriteSpiCommand NOP this will terminate the RAMWR command Author James P Lynch August 30 2007 gt k gt lt gt lt x lt gt K K gt lt k gt K K K ok ok K K F K K
82. nters to AT91SAM7X256 peripheral data structures FKK KK KK K K K 3K FK FK FK FK FK FK FK FK K K K FK FK FK FK FK FK FK FK FK FK FK FK FK FK FK K K FK FK FK FK FK FK K K FK K FK K FK K K K volatile AT91PS_PIO pPIOA volatile AT91PS_PIO pPIOB volatile 91 5 SPI pSPI volatile AT91PS PMC pPMC volatile 91 5 PDC pPDC AT91C BASE PIOA AT91C BASE PIOB AT91C BASE SPIO AT91C BASE PMC AT91C BASE PDC SPIO FKK KK FK KK FK FKK FK FK K FK FK K FK FK FK K FK FK K FK FK FK FK FK FK K FK FK K FK FK K FK FK FK K FK FK K FK FK FK FK FK FK FK FK FK K FK FK FK FK FK FK FK FK FK K FK FK FK FK FK FK K FK FK K FK FK FK FK FK FK FK FK FK K FK FK FK K FK FK K K FK K InitSpi Sets up SPI channel 0 for communications to Nokia 6610 LCD Display I 0 ports used PA2 PA12 PA16 PA17 PA18 PB20 LCD Reset set to low to reset LCD chip select set to low to select the LCD chip SPIO MISO Master In Slave Out not used in LCD interface SPIO MOSI Master Out Slave In pin Serial Data to LCD slave SPIO SPCK Serial Clock to LCD slave backlight control normally PWM control 1 full on Author Olimex James P Lynch July 7 2007 ok gt K ok gt K ok ok ok ok ok 2k K ok 2 FK 5 K 5 X SK K FK K id InitSpi void 4 P
83. o work out properly for the Philips controller The Epson S1D15G00 user manual is a poor English translation and nearly incomprehensible To keep this tutorial simple will not address the issues of scrolling or partial displays to conserve power since these are rarely used features used the Olimex SAM7 EX256 evaluation board the execution platform This is an ARM7 board with many peripherals that is an excellent way to learn about the ARM architecture at a reasonable price 120 from Sparkfun also used the YAGARTO Eclipse platform as the cross development environment which is explained in great detail in my tutorial Using Open Source Tools for AT91SAM7 Cross Development which can be downloaded from the following link http www atmel com dyn resources prod documents atmel tutorial source zip Hardware connection issues are also not the subject of this tutorial you can download the Olimex schematic for the SAM7 EX256 board to see their design for a hardware interface to the Nokia 6100 LCD display LCD Display Orientation The Nokia 6100 display has 132 x 132 pixels each one with 12 bit color 4 bits RED 4 bits GREEN and 4 bits BLUE Practically speaking you cannot see the first and last row and columns The normal orientation is as follows Columns Rows Figure 2 Default Orientation of Nokia 6100 LCD Display That of course is upside down on the Olimex SAM7 EX256 board if the silk scr
84. ok oK ok oK ok ok ok ok ok ok ok ok ook Kok OK OR OK void LCDSetCircle int x0 int int radius int color int f 1 radius int ddF x 0 int ddF y 2 radius int x 0 int y dF dF radius LCDSetPixel x0 yO radius color LCDSetPixel x0 radius color LCDSetPixel xO radius color LCDSetPixel xO radius color while x y 4 if f gt 0 4 ddF y 2 f ddF y ddF x 2 f ddF x 1 LCDSetPixel x0 LCDSetPixel x0 LCDSetPixel x0 LCDSetPixel x0 LCDSetPixel x0 LCDSetPixel x0 LCDSetPixel x0 LCDSetPixel color color color color color color color color ok ok ok ok K ok ok ok ok K ok ok ok LCDPutChar c Draws an ASCII character at the specified x y address and color character to be displayed row address 0 131 column address 0 131 size font pitch SMALL MEDIUM LARGE fcolor 12 bit foreground color value rrrrggggbbbb bcolor 12 bit background color value rrrrggggbbbb Inputs x y Returns nothing Notes Here s an example to display E at address 20 20 LCDPutChar E 20 20 MEDIUM WHITE BLACK 27 20 27 27 20 27 gt The most efficie
85. ontrol EEPROM define EPCOUT OxCC Cancel EEPROM control define EPMWR OxFC Write into EEPROM define EPMRD OxFD Read from EEPROM define EPSRRD1 7 Read register 1 define EPSRRD2 7 Read register 2 define NOP 0x25 NOP instruction define BKLGHT LCD ON 1 define BKLGHT LCD OFF 2 backlight control define BKLGHT LCD ON define BKLGHT LCD OFF Booleans define NOFILL define FILL 12 bit color definitions define define define define define define define define define define WHITE BLACK RED GREEN BLUE CYAN MAGENTA YELLOW BROWN ORANGE define PINK Font define define sizes SMALL MEDIUM define LARGE OxFFF 0x000 OxF00 OxOFO 0x00F OxOFF OxFOF OxFFO 0xB22 OxFAO OxF6A 0 1 2 hardware definitions define SPI SR TXEMPTY define LCD RESET LOW pPIOA PIO CODR define LCD RESET HIGH SODR mask definitions define define define define define define define define define define define define define define define define define define define define define define define define define define define define define define define define endif BITO BIT1 BIT2 BIT3 BIT4 BIT5 BIT6 BIT7 BIT8 BIT9 BIT10 BIT11 BIT12 BIT13 BIT14 BIT15 BIT16 BIT17 BIT18 BIT19 BIT20 BIT21 BIT22 BIT23 BIT24 BIT25 BIT26 BIT27 BIT28 BIT29 BIT30 BIT31 0x00
86. or LCDSetLine x0 yl x1 color LCDSetLine x0 x0 yl color LCDSetLine x1 y0 x1 color gt K gt lt ok ok ok ok ok ok ok gt gt ok ok ok gt K ok ok ok ok FK ok ok ok ok ok ok ok ok ok FK K FK ok 2k FK ok ok ok ok oK ok FK K 9 KR 9 9 ok K FK ok FK 2K ok 9 ok 9 X 9 K 9 ok 9 K FK K FK 2K 56 K K K SK LCDSetCircle c Draws a line in the specified color at center x0 y0 with radius row address 0 131 column address 0 131 radius in pixels 12 bit color value rrrrggggbbbb Inputs 0 radius color Returns nothing Author Jack Bresenham IBM Winthrop University Father of this algorithm 1962 Note taken verbatim Wikipedia article on Bresenham s line algorithm http www wikipedia org gt K gt lt ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok 2K K FK K K KR FK FK FK FK FK FK FK K ok ok ok ok ok ok ok ok ok ok ok ok ok ok FK 2K FK 2K FK FK FK FK FK K FK FK FK KOR OR FK FK K ok ok ok ok ok void LCDSetCircle int x0 int int radius int color radius 0 2 radius LCDSetPixel x0 radius color LCDSetPixel x0 yO radius color LCDSetPixel xO radius y0 color LCDSetPixel x0 radius y0 color While x lt y 4 if f gt 0 yx ddF y 2 f ddF y ddF x 2 f ddF x 1 LCDSetPixel x0 LCDSetPixel LCDSetPixel x0 LCDSetPixel LCDSetPixel
87. rent computational platform then you need to modify the port pins used and rewrite the SPI routines to conform to the alternate microprocessor suspect most people could easily handle such details would appreciate comments on this work and would be happy to accept any suggested improvements for inclusion in a future release About the Author Jim Lynch lives in Grand Island New York and is a software developer for Control Techniques a subsidiary of Emerson Electric He develops embedded software for the company s industrial drives high power motor controllers which are sold all over the world Mr Lynch has previously worked for Mennen Medical Calspan Corporation and the Boeing Company He has a BSEE from Ohio University and a MSEE from State University of New York at Buffalo Jim is a single Father and has two grown children who now live in Florida and Nevada He has two brothers one is a Viet Nam veteran in Hollywood Florida and the other is the Bishop of St Petersburg also in Florida Jim plays the guitar search for lynchzilla on youtube com enjoys woodworking and hopes to write a book very soon that will teach students and hobbyists how to use these high powered ARM microcontrollers Lynch can be reached via e mail at lynch007 gmail com
88. rolling definition define TEOFF test mode define TEON test mode define MADCTL memory access control define SEP vertical scrolling start address define IDMOFF idle mode OFF define IDMON idle mode ON define COLMOD interface pixel format define SETVOP set Vop define BRS bottom row swap define TRS top row swap define DISCTR display control define DOR data order define TCDFE enable disable DF temperature compensation define enable disable Vop temp comp define internal or external oscillator define set multiplication factor define set TCVOP slopes A and B define TCVOPCD set TCVOP slopes c and d define TCDF set divider frequency define DF8COLOR set divider frequency 8 color mode define SETBS set bias system define RDTEMP temperature read back define NLI n line inversion define RDID1 0 read ID1 define RDID2 OxDB read ID2 define RDID3 OxDC read ID3 backlight control define BKLGHT LCD ON 1 define BKLGHT LCD OFF 2 Booleans define NOFILL 0 define FILL 1 12 bit color definitions define WHITE OxFFF define BLACK 0x000 define RED OxF00 define GREEN 0x0FO define BLUE 0x00F define CYAN OxOFF define MAGENTA OxFOF define YELLOW OxFFO define BROWN 0xB22 define ORANGE OxFAO define PINK OxF6A Font sizes define SMALL 0 define MEDIUM 1 define LARGE 2 hardware definitions define SPI
89. s Dr Leonard McMillan Associate Professor UNC Jack Bresenham IBM Winthrop University Father of this algorithm 1962 Note taken verbatim from Professor McMillan s presentation http www cs unc edu mcmillan comp136 Lecture6 Lines html gt k ok ok ok ok ok K ok ok ok ok K ok ok ok ok ok ok ok ok ok ok ok ok K K ok ok K ok K ok ok ok F K 2k F R ok ok ok 2k oe ok ok ok ok ok ok F 2k ok ok ok ok ok ok K ok ok void LCDSetLine int x0 int int int yl int color int dy yl y0 int dx 1 x0 int stepx stepy dy stepy 1 else 4 stepy dx stepx 1 else 4 stepx dy is now 2 dy dx is now 2 dx LCDSetPixel x0 y0 color if dx dy 4 int fraction dy dx 1 same as 2 dy dx while x0 x1 4 if fraction 0 y0 stepy fraction dx same as fraction 2 dx x0 stepx fraction dy same as fraction 2 dy LCDSetPixel x0 y0 color else int fraction dx dy gt gt 1 while y0 y1 if fraction gt 0 x0 stepx fraction dy stepy fraction dx LCDSetPixel x0 y0 color ff 1 RAI AAA AA ake a A AIK HA AK HATE AHA ACH AAC HE EH ACHE HHA AAA HA LCDSetRect c Draws a rectangle in the specified color from 1 1 to x2 y2 Rectangle can be filled with a color if desired Inputs
90. t set use foreground color else use the background color now get the pixel color for two successive pixels if PixelRow amp Mask 0 WordO bColor else WordO fColor Mask Mask 1 if PixelRow amp Mask 0 Wordl bColor else Wordl fColor Mask Mask 1 use this information to output three data bytes WriteSpiData WordO gt gt 4 amp OxFF WriteSpiData WordO amp OxF lt lt 4 1 gt gt 8 amp OxF WriteSpiData Wordl amp OxFF terminate the Write Memory command WriteSpiCommand gt K gt lt ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok K FK K FK K FK FK FK FK K FK FK K FK FK K R ok ok ok ok ok ok ok ok ok ok FK 2K FK FK ok ok ok ok ok ok ok ok ok ok ok FK ok R K FK FK K FK ok FK ok ok ok ok ok ok ok ok ok ok ok K K K K K LCDPutStr c Draws a null terminates character string at the specified x y address size and color Inputs pString 77 y Size fColor bColor Returns nothing Notes Here s example to display Hello World at address 20 20 LCDPutChar Hello World 20 20 LARGE WHITE BLACK Author James P Lynch July 7 2007 ok gt lt ok ok ok ok ok gt K K K R FK SK R R R R R FK FK FK FK K R F F FK SK KR KR SK SK K K KR R K FK 9 9 OK
91. tes to specify a single pixel 3 data bytes can specify 2 pixels 2 8 bits per pixel requires one command and one data byte to specify the single pixel note pixel data byte converted by RGB table to 12 bit format above THIS IMPLEMENTATION USES THE 12 BITS PER PIXEL METHOD HARDWARE INTERFACE The Nokia 6610 display uses a SPI serial interface 9 bits PA2 PA12 PA16 PA17 PA18 LCD Reset set to low to reset LCD chip select set to low to select the LCD chip SPIO MISO Master In Slave Out not used in Olimex SAM7 EX256 LCD interface SPIO MOSI Master Out Slave In pin Serial Data to LCD slave SPIO SPCK Serial Clock to LCD slave SPI baud rate set to MCK 2 48054841 3 16018280 baud period 62 nsec OK since 50 nsec period is min for 51015600 The important thing to note is that you CANNOT read from the LCD Author James P Lynch August 30 2007 gt k ok ok ok ok ok ck ok ok ok ok ok ok ok ok ok R ok ok ok ok ok ok ok ok ok ok ok ok E ok ok ok ok ok ok ok ok ok ok ok ok ok ok K ok R 2k ok ok ok ok ok ok ok 97 R ok ok ok ok ok ok ok K ok ok ok ok ok ok ok ok ok KR K 2k ok ok ok ok ok ok ok K ok ok ok ok ok ok ok ok ok ok ok ok oe ok K ok ok ok ok ok ok ok o OROR OR Include Files include at91sam7x256 h include lcd h include bmp h
92. tput pPIOA PIO SODR BIT12 Set PA12 to HIGH assert CS LCD low to enable transmission Disable the following pins from PIO control will be used instead by the SPIO peripheral BIT12 PA12 gt SPIO NPCSO chip select BIT16 16 gt SPIO MISO Master In Slave Out not used in LCD interface BIT17 PA17 SPIO MOSI Master Out Slave In pin Serial Data to LCD slave BIT18 PA18 SPIO SPCK Serial Clock to LCD slave gt 0 BIT12 BIT16 BIT17 BIT18 Peripheral A Disable Register Disable PIO control of these 4 bits pPIOA gt PIO_ASR BIT12 BIT16 BIT17 BIT18 Peripheral A Select Register all 4 bits are in PIOA pPIOA PIO BSR 0 Peripheral B Select Register none of the bits are in PIOB enable the SPIO Peripheral clock pPMC gt PMC_PCER 1 lt lt 91 ID SPIO0 SPI Control Register SPI CR pSPI gt SPI_CR 91 SPI SWRST AT91C SPI SPIEN Software reset SPI Enable 0x81 pSPI gt SPI_CR AT91C SPI SPIEN SPI Enable 0x01 SPI Mode Register SPI MR 0 0011 pSPI gt SPI_MR AT91C_SPI_DLYBCS amp 0 lt lt 24 Delay between chip selects take default 6 MCK periods AT91C SPI PCS amp lt lt 16 Peripheral Chip Select selects SPI NPCSO or PA12 AT91C SPI LLB amp 0 7 Local Loopback Enabled disabled AT91C SPI MODFDIS amp 1 4 Mode Fault Detection disabled AT91C SPI PCSDEC
93. x y color row address 0 131 column address 0 131 12 bit color value rrrrggggbbbb rrrr 1111 full red 0000 red is off 1111 full green 0000 green is off 1111 full blue 0000 blue is off Returns nothing Note good write up on this algorithm in Wikipedia search for Bresenham s line algorithm see lcd h for some sample color settings Authors Dr Leonard McMillan Associate Professor UNC Jack Bresenham IBM Winthrop University Father of this algorithm 1962 Note taken verbatim from Professor McMillan s presentation http www cs unc edu mcmillan comp136 Lecture6 Lines html ok ok ok ok ok ok ok ok ok ok ok ok ok K 2K ok ok K K K FK K FK SK FK K R R FK FK ok ok ok ok ok ok ok ok ok ok 2K R FK FK ok FK ok ok ok ok ok ok ok ok ok KR FK K FK R K FK ok OR FK ok ok ok ok ok ok ok ok ok ok FK K K K K void LCDSetLine int x0 int int 1 int yl int color int dy yl y0 int dx x1 x0 int stepx stepy if dy lt 0 4 dy dy stepy 1 else 4 stepy 1 if dx lt 0 dx dx stepx 1 Y else 4 stepx 1 dy 1 dy is now 2 dy dx lt lt 1 dx is now 2 dx LCDSetPixel x0 y0 color if dx gt dy 1 int fraction dy dx gt gt 1 same as 2 dy dx while x0 x1 4 if fraction gt 0 4 y0 stepy fraction dx same as fraction 2 dx x0 stepx fraction dy same as fraction 2 dy LCDSetPixel x0
94. x00 0x00 0x00 0x00 0x00 0x00 OxFF 0x18 0x18 0x0C 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x3C 0x06 0x66 0x3B 0x00 0x70 0x30 0x3E 0x33 0x33 0x33 0x6E 0x00 0x00 0x00 0x3C 0x66 0x60 0x66 0x3C 0x00 OxOE 0x06 0x66 0x66 0x66 0x3B 0x00 0x00 0x00 0x3C 0x66 0 7 0x60 0x3C 0x00 0x1C 0x36 0x30 0x78 0x30 0x30 0x78 0x00 0x00 0x00 0x3B 0x66 0x66 0x3E 0x06 0x7C 0x70 0x30 0x36 0x3B 0x33 0x33 0x73 0x00 0x18 0x00 0x38 0x18 0x18 0x18 0x3C 0x00 0x06 0x00 0x06 0x06 0x06 0x66 0x66 0x3C 0x70 0x30 0x33 0x36 0x3C 0x36 0x73 0x00 0x38 0x18 0x18 0x18 0x18 0x18 0x3C 0x00 0x00 0x00 0x66 0x7F 0 7 Ox6B 0x63 0x00 0x00 0x00 0x7C 0x66 0x66 0x66 0x66 0x00 0x00 0x00 0x3C 0x66 0x66 0x66 0x3C 0x00 0x00 0x00 0x6E 0x33 0x33 0x3E 0x30 0x78 0x00 0x00 0x3B 0x66 0x66 Ox3E 0x06 OxOF 0x00 0x00 0x6E 0x3B 0x33 0x30 0x78 0x00 0x00 0x00 0x3E 0x60 0x3C 0x06 0x7C 0x00 0x08 0x18 0x3E 0x18 0x18 0x1A 0x0C 0x00 0x00 0x00 0x66 0x66 0x66 0x66 0x3B 0x00 0x00 0x00 0x66 0x66 0x66 0x3C 0x18 0x00 0x00 0x00 0x63 Ox6B 0x7F 0x7F 0x36 0x00 0x00 0x00 0x63 0x36 0x1C 0x36 0x63 0x00 0x00 0x00 0x66 0x66 0x66 0x3E 0x06 0x7C 0x00 0x00 0x7E 0x4C 0x18 0x32 0x7E 0x00 OxOE 0x18 0x18 0x70 0x18 0x18 0x0E 0x00 0x0C 0x0C 0x0C 0x00 0xOC OxOC
95. x00 0x00 0x00 columns rows num bytes per char 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 space 0x20 0 30 0 78 0 78 0 30 0 30 0 00 0 30 0 00 0 6 0 6 0 6 0 00 0 00 0 00 0 00 0 00 0x6C 0x6C OxFE 0x6C OXFE Ox6C Ox6C 0x00 0x18 0x3E 0x60 0x3C 0x06 0x7C 0x18 0x00 0x00 0x63 0x66 0x0C 0x18 0x33 0x63 0x00 0x1C 0x36 0x1C 0x3B 0x6E 0x66 Ox3B 0x00 0x30 0x30 0x60 0x00 0x00 0x00 0x00 0x00 0x0C 0x18 0x30 0x30 0x30 0x18 0x0C 0x00 0x30 0x18 0x0C 0x0C 0x0C 0x18 0x30 0x00 0x00 0x66 0x3C 0x3C 0x66 0x00 0x00 0x00 0x30 0x30 OxFC 0x30 0x30 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x18 0x18 0x30 0x00 0x00 0x00 0x7E 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x18 0x18 0x00 2 0x03 0x06 0x0C 0x18 0x30 0 60 0 40 0 00 forward slash Ox3E 0x63 0x63 0x6B 0x63 0x63 0x00 0x30 0x18 0x38 0x58 0x18 0x18 0x18 0x7E 0x00 0x3C 0x66 0x06 0x1C 0x30 0x66 0x7E 0x00 0x3C 0x66 0x06 0x1C 0x06 0x66 0x3C 0x00 OxOE Ox1E 0x36 0x66 0x7F 0x06 0x0F 0x00 Ox7E 0x60 0x7C 0x06 0x06 0x66 0x3C 0x00 0x1C 0x30 0x60 0 7 0x66 0x66 0x3C 0x00 0 7 0x66 0x06 0x0C 0x18 0x18 0x18 0x00 0x3C 0x66 0x66 0x3C 0x66 0x66 0x3C 0x00 0x3C 0x66 0x66 0x3E 0x06 0x0C 0x38 0x00 0x00 0x18 0x18 0x00 0x00 0x18 0x18 0x00 0x00 0x18 0x18 0x00 0x00 0x18 0x18 0x30 0x0C 0x18 0x30 0x60 0x30 0x18 0x0C 0x00 0x00 0x00 0x7E
96. x20 0x20 0x70 0x00 0x38 0x10 0x10 0x10 0x10 0x90 0x60 0x00 0 88 0 90 0 0 0 0 0 0 0 90 0 88 0 00 0x80 0x80 0x80 0x80 0x80 0x80 0xF8 0x00 0x88 0xD8 0xA8 0xA8 0xA8 0x88 0x88 0x00 0 88 0 88 0 8 0 8 0 98 0 88 0 88 0 00 0x70 0x88 0x88 0x88 0x88 0x88 0x70 0x00 OxF0 0x88 0x88 OxFO 0x80 0x80 0x80 0x00 0x70 0x88 0x88 0x88 OxA8 0x90 0x68 0x00 OxF0 0x88 0x88 OxF0 0x90 0x88 0x00 0x70 0x88 0x80 0x70 0x08 0x88 0x70 0x00 OxF8 OxA8 0x20 0x20 0x20 0x20 0x20 0x00 0x88 0x88 0x88 0x88 0x88 0x88 0x70 0x00 0x88 0x88 0x88 0x88 0x88 0x50 0x20 0x00 0x88 0x88 0x88 OxA8 0xA8 0xA8 0x50 0x00 0x88 0x88 0x50 0x20 0x50 0x88 0x88 0x00 0x88 0x88 0x50 0x20 0x20 0x20 0x20 0x00 OxF8 0x08 0x10 0x70 0x40 0x80 OxF8 0x00 0 78 0 40 0 40 0 40 0 40 0 40 0 78 0 00 0x00 0x80 0x40 0x20 0x10 0x08 0x00 0x00 0x78 0x08 0x08 0x08 0x08 0x08 0x78 0x00 back slash STPAGHTOATMMIAWPFPA NV Il Aw 0 20 0 50 0 88 0 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 0 8 0 00 0 60 0 60 0 20 0 10 0 00 0 00 0 00 0 00 0 00 0 00 0 60 0 10 0 70 0 90 0 78 0 00 0 80 0 80 0 0 0 8 0 88 0 8 0 0 0 00 0 00 0 00 0 70 0 88 0 80 0 88 0 70 0 00 0 08 0 08 0 68 0 9
97. x63 0x63 0x3F 0x03 0x03 0x06 0x3C 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x18 0x18 0x00 0x00 0x00 0x18 0x18 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x18 0x18 0x00 0x00 0x00 0x18 0x18 0x18 0x30 0x00 0x00 0x00 0x00 0x00 0x06 0x0C 0x18 0x30 0x60 0x30 0x18 0x0C 0x06 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7E 0x00 0x00 Ox7E 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x60 0x30 0x18 0x0C 0x06 0x0C 0x18 0x30 0x60 0x00 0x00 0x00 0x00 0x00 0x00 OX3E 0x63 0x63 0x06 0x0C OxOC OxOC 0x00 OxOC OxOC 0x00 0x00 0x00 0x00 0x00 0x00 OX3E 0x63 0x63 0x6F Ox6B 0 6 Ox6E 0x60 0x60 Ox3E 0x00 0x00 0x00 0x00 0x00 0x00 0x08 0x1C 0x36 0x63 0x63 0x63 0x7F 0x63 0x63 0x63 0x00 0x00 0x00 0x00 0x00 0x00 0x7E 0x33 0x33 0x33 0x3E 0x33 0x33 0x33 0x33 0x7E 0x00 0x00 0x00 0x00 0x00 0x00 Ox1E 0x33 0x61 0x60 0x60 0x60 0x60 0x61 0x33 0x1E 0x00 0x00 0x00 0x00 0x00 0x00 0x7C 0x36 0x33 0x33 0x33 0x33 0x33 0x33 0x36 0x7C 0x00 0x00 0x00 0x00 0x00 0x00 0x7F 0x33 0x31 0x34 0x3C 0x34 0x30 0x31 0x33 0x7F 0x00 0x00 0x00 0x00 0x00 0x00 0x7F 0x33 0x31 0x34 0x3C 0x34 0x30 0x30 0x30 0x78 0x00 0x00 0x00 0x00 0x00 0x00 Ox1E 0x33 0x61 0x60 0x60 Ox6F 0x63 0x63 0x37 0x1D 0x00 0x00 0x00 0x00 0x00 0x00 0x63 0x63 0x63 0x63 0x7F 0x63 0x63 0x63 0x63
98. x6C 0x00 0x18 0x3E 0x60 0x3C 0x06 0x7C 0x18 0x00 0x00 0x63 0x66 0x0C 0x18 0x33 0x63 0x00 0 1 0 36 0 1 0 3 0 6 0 66 0 3 0 00 0 30 0 30 0 60 0 00 0 00 0 00 0 00 0 00 0 0 0 18 0 30 0 30 0 30 0 18 0 0 0 00 0x30 0x18 0x0C 0x0C 0x0C 0x18 0x30 0x00 0x00 0x66 0x3C 0xFF 0x3C 0x66 0x00 0x00 0x00 0x30 0x30 OxFC 0x30 0x30 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x18 0x18 0x30 0x00 0x00 0x00 0x7E 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x18 0x18 0x00 5 0x03 0x06 0x0C 0x18 0x30 0x60 0x40 0x00 forward slash Ox3E 0x63 0x63 0x6B 0x63 0x63 0x3E 0x00 0x30 0x18 0x38 0x58 0x18 0x18 0x18 0x7E 0x00 0x3C 0x66 0x06 0x1C 0x30 0x66 0x7E 0x00 0x3C 0x66 0x06 0x1C 0x06 0x66 0x3C 0x00 OxOE Ox1E 0x36 0x66 0x7F 0x06 OxOF 0x00 0x7E 0x60 0x7C 0x06 0x06 0x66 0x3C 0x00 0x1C 0x30 0x60 0x7C 0x66 0x66 0x3C 0x00 Ox7E 0x66 0x06 0x0C 0x18 0x18 0x18 0x00 0x3C 0x66 0x66 0x3C 0x66 0x66 0x3C 0x00 0x3C 0x66 0x66 0x3E 0x06 0x0C 0x38 0x00 0 00 0 18 0 18 0 00 0 00 0 18 0 18 0 00 0 00 0 18 0 18 0 00 0 00 0 18 0 18 0 30 0 0 0 18 0 30 0 60 0 30 0 18 0 0 0 00 0 00 0 00 0 7 0 00 0 00 0 7 0 00 0 00 0 30 0 18 0 0 0 06 0 0 0 18 0 30 0 00 0 3 0 66 0 06 0 0 0 18 0 00 0 18 0 00 Ox3E 0x63 Ox6F 0x69 Ox6F 0x60 Ox3E 0x00 0x18 0x3C 0x66 0x66 0x7E 0x66 0x66
99. x70 0x00 0x10 0x00 0x10 0x10 0x10 0x90 0x60 0x00 0x80 0x80 0x90 0xA0 0xC0 0xA0 0x90 0x00 0x60 0x20 0x20 0x20 0x20 0x20 0x70 0x00 0x00 0x00 OxDO OxA8 OxA8 OxA8 OxA8 0x00 0x00 0x00 0xBO 0xC8 0x88 0x88 0x88 0x00 0x00 0x00 0x70 0x88 0x88 0x88 0x70 0x00 0x00 0x00 0xBO OxC8 0xC8 OxBO 0x80 0x80 0x00 0x00 0x68 0x98 0x98 0x68 0x08 0x08 0x00 0x00 0xBO OxC8 0x80 0x80 0x80 0x00 0x00 0x00 0x78 0x80 0x70 0x08 0xF0 0x00 0x20 0x20 OxF8 0x20 0x20 0x28 0x10 0x00 0x00 0x00 0x88 0x88 0x88 0x98 0x68 0x00 0x00 0x00 0x88 0x88 0x88 0x50 0x20 0x00 0x00 0x00 0x88 0x88 OxA8 OxA8 0x50 0x00 0x00 0x00 0x88 0x50 0x20 0x50 0x88 0x00 0x00 0x00 0x88 0x88 0x78 0x08 0x88 0x70 0x00 0x00 OxF8 0x10 0x20 0x40 OxF8 0x00 0x10 0x20 0x20 0x40 0x20 0x20 0x10 0x00 0x20 0x20 0x20 0x00 0x20 0x20 0x20 0x00 0x40 0x20 0x20 0x10 0x20 0x20 0x40 0x00 0x40 0xA8 0x10 0x00 0x00 0x00 0x00 0x00 0x70 0xD8 0xD8 0x70 0x00 0x00 0x00 0x00 back slash N Xxz 4 Te m const unsigned char FONT8x8 97 8 0x08 0x08 0x08 0x00 0x00 0x00 0x00 0x00 columns rows num_bytes_per_char 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 space 0x20 0x30 0x78 0x78 0x30 0x30 0x00 0x30 0x00 0x6C 0x6C 0x6C 0x00 0x00 0x00 0x00 0x00 P 0x6C 0x6C 0xFE 0x6C 0xFE 0x6C 0
100. y gt K gt lt gt lt ok gt ok ok gt gt ok ok ok ok ok FK ok FK oK ok K ok R K KOK ok K OK F K K K X K K include at91sam7x256 h include lcd h include bmp h gt K gt lt gt lt ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok FK ok ok KR KOR R 2K 2K 2K KOR OR ORO OK K OK OK K K forward references 77 const unsigned char FONT6x8 97 8 const unsigned char FONT8x8 97 8 const unsigned char FONT8x16 97 16 void void void void void void void void void void void void void void void InitLcd void Backlight unsigned char state WriteSpiCommand unsigned int data WriteSpiData unsigned int data InitLcd void LCDWrite130x130bmp void LCDClearScreen void LCDSetXY int x int y LCDSetPixel int x int y int color LCDSetLine int x1 int yl int x2 int y2 int color LCDSetRect int x0 int yO int 1 int yl unsigned char fill int color LCDSetCircle int x0 int y0 int radius int color LCDPutChar char c int x int y int size int fcolor int bcolor LCDPutString char lcd string const char font style unsigned char x unsigned char y unsigned char fcolor unsigned char bcolor Delay unsigned long a gt K gt lt gt lt ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok K K R K K 2K FK K K FK FK K R FK FK FK FK FK K FK FK FK FK FK K K FK FK K K Poi
101. y0 color else int fraction dx dy gt gt 1 while y0 y1 if fraction gt 0 x0 stepx fraction dy y0 stepy fraction dx LCDSetPixel x0 y0 color gt K gt lt gt lt gt ok ok ok ok ok K ok gt ok ok gt K ok ok ok ok ok ok ok ok ok ok ok ok ok ok 2 K 5 ok ok 2 ok ok ok ok oK ok ok 3 ok oK K 2 ok 2 2 FK 3 9 2 K K FK K FK 9 LCDSetRect c Draws a rectangle in the specified color from 1 1 to x2 y2 Rectangle can be filled with a color if desired Inputs x row address 0 131 column address 0 131 0 no fill 1 fill entire rectangle 12 bit color value for lines rrrrggggbbbb rrrr 1111 full red y fill color 0000 red is off gggg 1111 full green 0000 is off bbbb 1111 full blue 0000 blue is off Returns nothing Notes The best way to fill a rectangle is to take advantage of the wrap around featute built into the Philips PCF8833 controller By defining a drawing box the memory can be simply filled by successive memory writes until all pixels have been illuminated 1 Given the coordinates of two opposing corners x0 y0 1 y1 calculate the minimums and maximums of the coordinates xmin xmax ymin ymax x0 lt x1 x0 x1 x0 x1 x0 x1 lt yl yO yl yO gt y0 2 Now set up the drawing box to be the desired rectan

Download Pdf Manuals

image

Related Search

Related Contents

Système à racleur double      User`s Manual  Bedienungsanleitung  Windows CE 4.2 for the eTOP Workstations    橡 ページ)  Bedienungsanleitung  Texte de la thèse  

Copyright © All rights reserved.
Failed to retrieve file