꿀팁2015. 6. 7. 19:22

TFT LCD 동작 시험


이렇게 생긴 2.4inch 터치 TFT LCD


아두이노UNO 보드에 결합하기 전에 LCD 실드 바닥면 절연 처리 필요




다양한 라이브러리를 테스트 해봤는데, 동작 안함


우여곡절 끝에 동작하는 예제를 찾음

http://www.moleandroid.com/arduino-tutorial-2-how-to-setup-mcufriend-2-4-lcd-tft-libraries-and-avoid-white-screen/


예제 코드에서 수정한 부분 (수정된 최종본은 본 게시물 첨부로 올림)

1) 프로그램 시작할때 LCD ID를 읽는 부분이 본 LCD에서 동작을 안해서 강제로 LCD ID를 할당함

2) Micro SD 메모리 카드에 있는 bmp 이미지를 표시하는 예제에서 사용하는 PushColor() 함수에 '}' 하나 빠진거 수정


수정된 example 이 포함된 library

TFTLCD_Rack_Dongari_tftpaint_fixed.zip


별도 회로 구성은 필요 없고 바로 아두이노 UNO 보드에 꼽기만 하면됨

micro SD 메모리 카드에 첨부파일 폴더에 있는 bmp 파일을 복사해서 LCD 모듈에 꼽아야 함


example 폴더에 있는 예제 프로그램 설명


graphicstest.ino : 각종 그래픽, 문자를 표시하는 데모



tftbmp_modified.ino : SD메모리 카드에 있는 bmp 파일을 읽어서 표시하는 데모



tftpaint.ino : 터치 입력을 받아서 그림을 그리는 데모

※ 주의 : 첨부된 example 에서 코드 한군데를 고쳐야 동작함

소스코드에서 92번 행 : uint16_t identifier = 0x9327;//tft.readID();

터치 좌표는 LCD 제품마다 달라서 코드에서 상하,좌우를 바꿔야 함 ㅠㅠ





---------------------------------------------------------------------------------------------------------------


예전에 작성한 내용 (아래 첨부는 라이브러리와 graphictest.ino 만 수정됨. bmp 읽는 예제는 수정 안됨)


buy at : http://www.aliexpress.com/item/Free-Shipping-2-4-inch-TFT-touch-LCD-Module-LCD-Screen-Module-For-Arduino-UNO-R3/1619321648.html


I tried 4~5 kinds of TFT Libraries, but not work! (I spend almost two days)


working source : http://www.moleandroid.com/arduino-tutorial-2-how-to-setup-mcufriend-2-4-lcd-tft-libraries-and-avoid-white-screen/


one little modification needed.
at the start of program, it try to read and run init code along with its ID value.
But there is NO answer from TFT module. (return value = 0)
So I tried to assign ID by force.


modified code and library are attached this article.

unzip into arduino library folder. and run the example code in there.




<reversed text and coordinate flipping issues>

http://misc.ws/2013/11/08/touch-screen-shield-for-arduino-uno/

TFTLCD.zip has reverse coordinate code.

BUT whole functions are different from adafruit_TFTLCD.cpp : its not easy to integrate work source sample.


flipping using map function.

http://softsolder.com/2015/02/03/adafruit-touch-screen-tft-lcd-rotation/


tftpaint.ino

    // scale from 0->1023 to tft.width
    p.x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);

    p.x = map(p.x, 0, 240, 240, 0);  //add this line to flipping X position


adafruit_TFTLCD.cpp

void Adafruit_TFTLCD::drawPixel(int16_t x, int16_t y, uint16_t color) {
    x = map(x, 0, 240, 240, 0);    //add this line to flipping X position


HOW to fix font flipping??

=> just setRotatin(3)..then it shows correctly


<bmp not display problem>

cause : in TFTLCD.cpp, pushColors() method has error

solution : put one more '}'

 


just for reference : ILI9325 device photo

http://tronixstuff.com/2013/04/26/tutorial-arduino-and-ili9325-colour-tft-lcd-modules/


forum site

https://forum.arduino.cc/index.php?topic=223769.60


'꿀팁' 카테고리의 다른 글

비보탭 터치 먹통  (0) 2015.10.21
16x8 LED Matrix MAX7219  (0) 2015.06.11
wtv020 mp3 player module  (1) 2015.06.11
vc0706 jpeg serial camera  (0) 2015.06.10
ESP8266 AT 명령어와 thingspeak 로 온습도 데이터 업로드  (2) 2015.05.07
Posted by orasman