//--------------------------------------------------------- /* 2.4in_TFT.c Program for writing to Newhaven Display 2.4" TFT (c)2008 Curt Lagerstam - Newhaven Display International, LLC. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ //--------------------------------------------------------- #include /**************** I/O Setting **********************/ /* [DB7..DB0] = [P0_7..P0_0] [DB15..DB8] = [P1_7..P1_0] /CS = P3_4 RS = P3_5 /WR = P3_6 /RD = P3_7 /RESET = P3_0 */ #define CS P3_4 #define RS P3_5 #define WR P3_6 #define RD P3_7 #define RESET P3_0 /***************************************************/ void data_out(unsigned char i,unsigned char j) //Data Output 16-bit Bus Interface { RS = 1; RD = 1; WR = 0; P1 = i; P0 = j; WR = 1; } void comm_out(unsigned char j) //Command Output 8-bit Bus Interface { RS = 0; RD = 1; WR = 0; P0 = j; WR = 1; } void data_put(unsigned char i,unsigned char j) { CS = 0; RS = 1; RD = 1; P1 = i; P0 = j; } /****************************************************/ void delay(unsigned int n) { unsigned int i,j; for (i=0;i