Home

ThaiEasyElec - 2.8-inch TFT Touch Shield -EN

image

Contents

1. This function draws a line with color by defining of start point end point and color Graphics DrawCircle uint16_t x uint16_t y uint16_t radius uint16 t color uint8_t fill This function draws a circle with color plus option to fill it or not by defining of center point radius color and fill Graphics DrawRoundRect uint16_t x1 uint16_t yl uint16_t x2 uint16_t y2 uint16_t radius uint16_t color uint8_t fill This function draws a rectangle with color line and round corner plus option to fill it or not by defining of start point end point radius of corner color and fill Graphics SetFontColor uint16_t color This function set font color Graphics SetBackColor uint16_t color This function set font background color Graphics SetOffset uint16_t x uint16_t y This function set font offset Graphics PrintStr uint8 t line uint8_t column uint8_t str This function displays string by defining line start column and string Graphics PrintCh uint8_t line uint8_t column uint8_t c This function displays character by defining line start column and character unsigned long Graphics GetCharWidth uint8_t c This function gets a width of specified character unsigned long Graphics GetStringWidth uint8_t str This function gets a width of specified string void Graphics SetBold uint8_t on This function sets a character to bold uint8_t Graphics GetBold void This function gets a
2. ThaiEasyElec 2 8 inch TFT Touch Shield English User Manual V1 0 Enable Your Design ThaiEasyElec com fll On line Electronics Shop for Embedded System Revision History Version Date Changes V1 0 14 DEC 2011 Original Version Contents MU ODUCEIONS osion eaii ete ind dd eathbebed send ie aa iE aR ea a 2 FeatUrES rya E EE E aE EE 2 PIN Definitii ONS fe vcsszcectesnncenceyecessc suaeeassadebasncedeneeand sabeste seahauscgaitsdedeRecssansegngadevedestea Fastteadesagedateanecentaennees 3 Principle of operation for 2 8 inch TFT Touch Shield cccccccsscessecesseecssceecseeeesaeecssesessaeesssaeeseseeessees 4 Operation for TFT LCD control 8 bit parallel interface ccccccssccesecssecesssecsseeceseeeessaeesseeeseeeeseas 4 Access Register of ILI9328 with 8 bit parallel interface cccecssessscessseceesecseeeecseeeeeseeessseeseseeesees 5 How to write the value to register of ILI9328 in 8 bit parallel interface Operation ccsseeeeees 6 Step by Step for write data to register ccccccccccssccccesssececsesseeecsesseeececsececsesseeecseaaeeecsesaeeeeeseaaeeeeesaas 6 Operating for Touch controller with SPI interface ccccccccssscccessececseseeeceseaeeeceesaececsesaeeeesaeeeeseaaes 8 Hardware PINS layout seceded ceccevesccectes teed earte ns eat tacee vi n AEAN TAE EIERE AAR EEE 10 Arduino connmettivity scissure rrae cee veacecccdeaceksened acu sdedaaculelaacetesveacsuela ctegeet
3. design the module will use 8 bit interface The Index Register IR will store the value in register address which we will write the command or data This operation will define by Register Selection RS Read Write RD WR and Data Bus DO D17 To define the value into 16 bit Register D 15 0 of ILI9328 you can follow the Data Transfer Format as figure 2 i80 M68 system 8 bit data bus interface 1 Transfer 2 Transfer Po Transfer SS SS S O O Po Transfer S S S O Data Bus DB DB DB DB DB DB DB DB DB DB DB DB DB DB DB DB DB 17 10 17 16 15 44 1 12 43 10 17 16 15 14 13 12 11 10 Register Bit og peepee Figure 2 Data Transfer Format of ILI9328 From figure 2 The TFT LCD Touch Screen we use 8 bit parallel interface operation which if we need to access register of ILI9328 User needs to send the data 2 times for access register in each operation first sending is High Byte and second sending is Low Byte The total is 16 bit sending operation ThaiEasyElec 2 8 inch TFT Touch Shield User Manual V1 0 Venus Supply Co Ltd contact us sales thaieasyelec com How to write the value to register of ILI9328 in 8 bit parallel interface operation 180 9 8 bit System Bus Interface Timing a Write to register ncS l DB 17 10 Figure 3 Timing diagram for write to register Figure 3 show the timing diagram about the operation function to control sending command
4. loop while j lt 10 help to detect unexpected or bounce from touching using same method for de bounce when press a switch When touch values are stable XY axis values keep in capture_pt structure then creates a blue solid circle over a transparent one indicated that already got touch values for this point There are 3 calibration points although process above will loop 3 times for uint8_t i 0 i lt 3 i in different defined position on 28 18 308 120 and 160 208 After that they have been calculated then stored in EEPROM source code below if setCalibrationMatrix lcd_screen_pts tp_pts amp tp matrix tp save matrix There is a necessary function in calibration process named conv_tp source code in figure 14 below void conv_tp POINT tp unsigned short buf if LCD GetOrientation LCD HORIZONTAL return buf tp gt x tp gt x LCD GetWidth tp gt y 1 tp gt y buf i Figure 14 Source code of conv_tp function Because this calibration process uses horizontal point formula for horizontal screen then we need to convert to vertical point when we use vertical screen this function will do this task ThaiEasyElec 2 8 inch TFT Touch Shield User Manual V1 0 Venus Supply Co Ltd contact us sales thaieasyelec com tft tft tft tft tft tft tft tft In setup function there are many declarations for screen shown in fi
5. of TFT2_8_Shield_Example pde source code At the beginning of source code in figure 10 there are many included necessary header file to define variable for object creation from our library and declaration of 3 variables of created objects below TFT_PFF pff Graphie ikan touchpanel tp They are objects of Filesystem for accessing file from SD card Graphic on LCD and touch screen ThaiEasyElec 2 8 inch TFT Touch Shield User Manual V1 0 Venus Supply Co Ltd contact us sales thaieasyelec com TFT2_8 Shield_Example Arduino File Edit Sketch Tools Help e eee el int setCalibrationMatrix POINT displayPtr POINT screenPtr MATRIX matrixPtr int retValue 1 matrixPtr gt Divider screenPtr 0 x screenPtr 2 x screenPtr l y screenPtr 2 y screenPtr 1l x screenPtr 2 x screenPtr 0 y screenPtr 2 y if matrixPtr gt Divider 0 retValue 0 else matrixPtr gt d n displayPtr 0 x displayPtr 2 x screenPtr l y screenPtr 2 y displayPtr l x displayPtr 2 x screenPtr 0 y screenPtr 2 y matrixPtr gt Bn screenPtr 0 x screenPtr 2 x displayPtr l x displayPtr 2 x i idisplayPtr 0 x displayPtr 2 x screenPtr l x screenPtr 2 x matrixPtr gt Cn screenPtr 2 x displayPtr 1 x screenPtr 1l x displayPtr 2 x screenPtr 0O y screenPtr 0 x displayPtr
6. 2 x screenPtr 2 x displayPtr 0 x screenPtr l y screenPtr l x displayPtr 0 x screenPtr 0 x displayPtr l x screenPtr 2 y matrixPtr gt Dn displayPtr 0 y displayPtr 2 y screenPtr l y screenPtr 2 y displayPtr l y displayPtr 2 y screenPtr 0 y screenPtr 2 y matrixPtr gt En screenPtr 0 x screenPtr 2 x displayPtr l y displayPtr 2 y displayPtr 0O y displayPtr 2 screenPtr l x screenPtr 2 x Figure 11 Source code of setCalibrationMatrix function The setCalibrationMatrix function shown in figure 11 uses to calculate for position in calibration process it uses horizontal screen formula calculation A tp_calibrate function shown in figure 12 uses in calibrating touch position of LCD screen void tp_calibrate POINT led_screen_pts 3 26 16 308 120 160 208 POINT tp_pts 3 POINT capture_pt intl6_t pre_tp_x 0 pre tp y 0 Figure 12 Source code of tp_calibrate function Variable declaration for tp_calibrate function have 3 POINTs are 28 18 308 120 and 160 208 use in calculation of calibration ThaiEasyElec 2 8 inch TFT Touch Shield User Manual V1 0 Venus Supply Co Ltd contact us sales thaieasyelec com tft initialize LCD_HORIZONTAL tp init tit ClearScreen BLACK draw 3 points in turn for uint8_t i 0 i lt 3 i tfit Drawlircle lcd_scre
7. Description Control Signal 9 TC_CS Touch Controller Chip Select 0 Enable Touch Controller 1 Disable Touch Controller 10 SCLK Serial Clock 11 MISO Data Out of ADS7843 12 MOSI Data In of ADS7843 13 BUSY Busy Pin of ADS7843 Output 0 with Busy 14 PEN Pen IRQ of ADS7843 Output 0 with Touch ThaiEasyElec 2 8 inch TFT Touch Shield User Manual V1 0 Venus Supply Co Ltd contact us sales thaieasyelec com Principle of operation for 2 8 inch TFT Touch Shield There are 2 parts of operation to use 2 8 inch TFT Touch Shield TFT LCD control 8 bit parallel interface and Touch controller SPI Interface You can see an Appendix for more programming description Operation for TFT LCD control 8 bit parallel interface 2 8 inch TFT Touch Shield has been designed to use 8 bit parallel mode for control Then module will use data only 8 bits PINs interface The PINs out from TFT LCD are DB10 to DB17 as schematic in figure 1 Figure 1 PINs out for TFT LCD control ThaiEasyElec 2 8 inch TFT Touch Shield User Manual V1 0 Venus Supply Co Ltd contact us sales thaieasyelec com Access Register of ILI9328 with 8 bit parallel interface The TFT LCD use ILI9328 LCD Controller If user needs to control the TFT LCD you should understand the operation of how to control the ILI9328 first The operation and function of ILI9328 will start when receive the command from processor For hardware
8. ction will describe in next chapter mmce c This file use for communicating with SD card via SPI pff c This file included function for reading writing file on FAT file system LCD graphic usage function in TFT_graphics cpp void Graphics initialize unit8_t orient This function send a command to start using LCD passing variable requires is value to define which XY axis is vertically or horizontally aligned void Graphics SetArea uint16_t x1 uint16_t yl uint1l6_t x2 uint16_t y2 This function set a working area of LCD void Graphics SetCursor uint16_t x uint16_t y This function set a starting point of drawing void Graphics ClearScreen uint16_t color This function clear entire screen by fill them with specified color void Graphics FastSolidRect uint16_t x1 uint16_t yl uint1l6_t x2 uint16_t y2 uint16_t color This function quickly draws a solid rectangle filled with color by defining of start point end point and color void Graphics DrawPixel uint16_t x uint16_t y uint16_t color This function draws a pixel with specified color ThaiEasyElec 2 8 inch TFT Touch Shield User Manual V1 0 Venus Supply Co Ltd contact us sales thaieasyelec com void void void void void void void void void Graphics VerticalScroll int16_t y This function scrolls entire screen in vertical Graphics DrawLine uint16_t x1 uint16_t yl uint16_t x2 uint16_t y2 uint16_t color
9. ecl je stinic Or COmw_icjo cja_Clenc 2 aie get staole tolto dect ic Drave trellet pidat tp dat y TOENE TEON IL p ThaiEasyElec 2 8 inch TFT Touch Shield User Manual V1 0 Venus Supply Co Ltd contact us sales thaieasyelec com The bitmap_show function shown in figure 19 it starts reading header and info of bitmap file from SD card to check file is usable res pf open pFile if res return res res pf read amp BMPHeader sizeof BMPHeader cnt if res return res if BMPHeader bfType Ox4d42 return Oxff res pf read amp BMPInfo sizeof BMPInfo cnt if res return res if BMPInfo biSize 40 return Oxff if BMPInfo biPlanes 1 return Oxff if BMPInfo biCompression 0 return Oxff Figure 19 Source code of bitmap_show function for reading header and info After that it will specify an area for drawing that image source code in figure 20 sx 0 sy 0 ex ey LCD GetWidth 1 LCD GetHeight 1 if bitmap_width LCD GetlWidth bitmap_height LCD GetHeight tit ClearScreen BLACK if LCD Sx ex if LCD sy ey Getllidth gt bitmap_width LCD GetWidth bitmap_width gt gt 1 sx bitmap width 1 GetHeight gt bitmap_height LCD GetHeight bitmap_height gt gt 1 sy bitmap height 1 Figure 20 Source code of bit
10. en_pts i x lcd_screen_pts i y 5 BLUE 0 uint _t j 0 Figure 13 Source code of calibration process At the beginning of calibration process in figure 13 there are 3 functions was called for horizontal adjustment starting communication with touch screen and clear entire screen to black source code below tft initialize LCD_HORIZONTAL Eos taie 8 tft ClearScreen BLACK After that prepare for calibration process source code below Por sine ie O a lt se ilar Ctt Drawceirecle lec seresn joes aL o loc sereen otsai ov BLUE 0 alias e J LE loop to get stable tp point while j lt 10 delay 5 CEINEUMMES je ij 1SerCl jeje jorouliane p if capture_pt gt x 0 amp amp capture_pt gt y 0 if capture_pt gt x pre_tp_x amp amp capture_pt gt y pre_tp_y Jete else je Ok SS Cee wlieS_ joie Ss lt P pre tO y CajiclicSs iS y7 if j 10 break J 0 pre_tp_x 0 pre_tp_y 0 cto pecsIlil z capture pt gt x cto pecslil y capture pt gt y Tite Drawcirele lec sereen prcsi Lecl screen ocsi oyy BLUE 1 delay 500 ThaiEasyElec 2 8 inch TFT Touch Shield User Manual V1 0 Venus Supply Co Ltd contact us sales thaieasyelec com This process creates a blue transparent circle 5 pixels radius on calibration point to wait for touch activity on screen While
11. ff fs sd_found 1 break delay 500 if sd_found tft PrintStr 2 1 but delay 5000 tp_calibrate Figure 16 Source code for SD card checking SD card has been checking by procedure above in figure 16 If SD card inserted it will break and exit to next function If SD card not inserted it will display lsinu SD card means SD card not found for 5 seconds 5000 milliseconds After that it will start calibration process Please notice if you need to display text string including with Thai character You should use example below tft Thait o co AGC buf uint8_t lNwu s tft Printstr 2 sue D Carcel p It will convert Thai characters to ASCII like English characters and store them in array variable named buf Then display it on 1 column on 2 line ThaiEasyElec 2 8 inch TFT Touch Shield User Manual V1 0 Venus Supply Co Ltd contact us sales thaieasyelec com The get_stable_tp function for getting specified position like loop use in calibration function in figure 17 uint _t get_stable_ tp POINT tp static POINT previous_tp static uint _t count 0 if tp gt x 0 tp gt y 0 return 0 if tp gt x previous_tp x amp amp tp gt y previous_tp y count else count 0 previous_tp x tp gt x previous_tp y tp gt y if count gt TP_STABLE_ COUNT count 0
12. from ADS7843 when each bit sent ADS7843 will simultaneously shift last 5 bits of Y axis ADC value through DOUT pin are bit4 bitO Obxxxxx000 8 Set TC_CS 1 to disable ADS7843 Rearrangement ADC value for each axis by shift first 7 bits to the left side 5 times 5 bits and shift last 5 bits to the right side 3 times 3 bits then OR both value into 12 bit ADC value Do these on both X axis and Y axis value E ThaiEasyElec 2 8 inch TFT Touch Shield User Manual V1 0 Venus Supply Co Ltd contact us sales thaieasyelec com Hardware PINs layout A 2 8 inch TFT Touch Shield has 24 PINs divided in 2 groups of usage There are 18 signal PINs for control TFT LCD and 6 signal PINs for control touch screen controller and SD card for external storage It was designed for Arduino UNO Arduino Mega connectivity with 18 pins Also designed for others microcontroller or others connectivity All 24 pins located in figure 7 5V RST RS RD SCLK MOSI PEN DO D2 D4 D6 GND wl ca sd fa a8 ss hara 5 i eyg ik Figure 7 Hardware PINs layout ThaiEasyElec 2 8 inch TFT Touch Shield User Manual V1 0 Venus Supply Co Ltd contact us sales thaieasyelec com Arduino connectivity User needs 18 pins out of 24 pins of 2 8 inch TFT Touch Shield to connect to Arduino UNO Arduino Mega How to connect with Arduino shown in figure 8 Figure 8 Arduino connectivity Arduino programming ThaiEasyElec com pro
13. gure 15 below tft initialize LCD_VERTICAL tit initialize LCD HORIZONTAL tft ClearScreen BLACk tit SetFontColor RED tfit CfgFont font_vrindal8x1l6 16 2 2 tit CigExtFont font_angsanal4x32 14 4 5 9 tit CigLineHeight 32 tft SetBoldil tit SetOffset 0 0 Figure 15 Screen declaration setup function initialize LCD_VERTICAL This function initialize LCD for using in vertical alignment for horizontal alignment use tft initialize LCD_HORIZONTAL ClearScreen BLACK This function clears entire screen by filling with black SetFontColor RED This function sets font color to red CfgFont font_vrinda18x16 18 2 2 This function set English font to vrinda 18x16 width 18 pixels height 2 16 pixels 8 and gap 2 pixels Cf gExtFont font_angsanal4x32 14 4 5 9 This function set Thai font to angsana 14x32 width 14 pixels height 4 32 pixels 8 gap 5 pixels and font level adjustment value to match English font level is 9 Cf gLineHeight 32 This function set line height to 32 pixels SetBold 1 This function set font to bold SetOffset 0 0 This function set offset on x 0 pixel and y 0 pixel ThaiEasyElec 2 8 inch TFT Touch Shield User Manual V1 0 Venus Supply Co Ltd contact us sales thaieasyelec com sd_found 0 tft ThaiUTF8_to ASCII buf uint8_t laiwy SD Card for i 0 i lt 5 i if disk_initialize 0 pf_mount p
14. idaauetesvesedecsanedbaatecdenaaxgehiea 11 Ardana POBAMMING eean aE E E E teas RRO 11 LCD graphic usage function in TFT_graphics cpp scccescccsscesssecesseceeseecsecessaecseaeeceseesssaeessseeesees 12 LCD touch screen usage function in TFT_tOUCH CDP cccccesccesssecsssecseseecsuecesauecssneecesaeesssaeessseeeeaees 14 APDE NOIK arrra EER EEEE EA EN AEN E ANNO TON N 15 Describing an example code TFT2_8_Shield_Example pde cccscccssccessecssseecesseecseeeesseeeeseneess 15 ThaiEasyElec 2 8 inch TFT Touch Shield User Manual V1 0 Venus Supply Co Ltd contact us sales thaieasyelec com Introductions A 2 8 inch TFT Touch Shield is shield board for Arduino UNO Arduino Mega with 2 8 inches TFT LCD and resistive touch screen attached Included SD card socket enable reading picture file from SD card and displaying it easily Support up to 320x240 pixels resolution and 65K colors TFT LCD controls via 8 bit parallel interfaces and touch screen controller AD7843 controls via SPI interface Both of them already designed the pin out for attaching with Arduino UNO Arduino Mega platform Features e Design for Arduino UNO and Arduino Mega e 2 8 inch TFT with 320 pixels x 240 pixels resolution and 65K colors 8 bit data parallel interface using 4 pins signal control e Resistive touch screen using AD7843 touch screen controller 4 wire resistive touch screen e SD card support SPI interface you can store
15. map_show function for specify drawing area ThaiEasyElec 2 8 inch TFT Touch Shield User Manual V1 0 Venus Supply Co Ltd contact us sales thaieasyelec com Finally it reads image data and displays on screen source code in figure 21 below pf_read void buf z amp cnt if y for j 0 j lt cnt j 3 b buf j g buf j 1 r but j 2 color r lt lt 8 0xF800 color ig lt lt 3 OxO7 EO color b gt gt 3 LCD Write_DATA color y 3 if y 0 break Figure 21 Source code of bitmap_show function for read and display image ThaiEasyElec 2 8 inch TFT Touch Shield User Manual V1 0 Venus Supply Co Ltd contact us sales thaieasyelec com
16. me before reading More information about ADS7843 available in its product datasheet useful control byte lists below 0xDO for reading ADC in X axis 0x90 for reading ADC in Y axis a ThaiEasyElec 2 8 inch TFT Touch Shield User Manual V1 0 Venus Supply Co Ltd contact us sales thaieasyelec com Figure 6 ADS7843 Timing diagram From timing diagram in figure 6 how to read ADC value from ADS7843 steps below 1 Read PENIRQ status If value is O mean that screen has been touched we can start to read ADC value from ADS7843 using step 2 and later If value is 1 there is no activity on touch screen 2 Set TC_CS 0 to enable ADS7843 3 Send control byte OxDO via DIN pin to told ADS7843 get its X axis ADC value 4 Send dummy data 0x00 via DIN pin to read ADC value from ADS7843 when each bit sent ADS7843 will simultaneously shift first 7 bits of X axis ADC value through DOUT pin are bit11 bit5 ObOxxxxxxx 5 Send control byte 0x90 via DIN pin to told ADS7843 get its Y axis ADC value when each bit sent ADS7843 will simultaneously shift last 5 bits of X axis ADC value through DOUT pin are bit4 bitO Obxxxxx000 6 Send dummy data 0x00 via DIN pin to read ADC value from ADS7843 when each bit sent ADS7843 will simultaneously shift first 7 bits of Y axis ADC value through DOUT pin are bit11 bit5 ObOxxxxxxx 7 Send dummy data 0x00 via DIN pin to read ADC value
17. or data of ILI9328 There are 2 steps to access register as follow 1 Step of register need to access register address 2 Step of data which we will write to the register From timing diagram user needs to send the data 4 times DB 17 10 The first and second data is for access register to define register address that we need to connect As the figure 3 the first data is 0x00 and the second data is register index For third and second data it is the operation to define the data for accessed register by sending high byte data and follow with low byte data Step by Step for write data to register From the timing diagram PINs usage are shown below Control Signal PINs LCD_CS RS RD and WR Data PIN DO to D7 Following step use for writing data to ILI9328 register 1 Set RD 1 2 Set LCD_CD 0 to enable LCD for writing data 3 Set RS 0 to told ILI9328 receive this data as command 4 Set High Byte DO D7 Ox00 5 Set WR 0 to start writing command to register i 4 ThaiEasyElec 2 8 inch TFT Touch Shield User Manual V1 0 Venus Supply Co Ltd contact us sales thaieasyelec com 10 11 12 13 14 15 16 17 Set WR 1 to stop writing after first byte sent Set Low Byte DO D7 as register index which we need to communicate Set WR 0 to start writing register index to register Set WR 1 to stop wri
18. return l return 0 Figure 17 Source code of get_stable_tp function ThaiEasyElec 2 8 inch TFT Touch Shield User Manual V1 0 Venus Supply Co Ltd contact us sales thaieasyelec com Arduino essential standard loop function source code in figure 18 void loop POINT tp_ dat if sd_found bitmap_show picl bmp delay 1000 bitmap_show pic2 bmp delay 1000 bitmap show pic3 bmp delay 1000 bitmap_show pic4 bmp delay 1000 tp_dat tp read lcd _point conv_tp tp_ dat if get_stable tp tp_dat f Plot Pixel tit DrawPixel tp_dat gt x tp_dat gt y YELLOW tft DrawClircle tp_dat gt x tp_dat gt y 3 YELLOW 1 Figure 18 Source code of Arduino essential standard loop function There are 2 major parts First one source code below if SD card found it will call bitmap_show function to read bitmap image file from SD card and display on screen if sd_found bitmap_show picl bmp delay 1000 bitmap_show pic2 bmp delay 1000 bitmap_show pic3 bmp delay 1000 bitmap_show pic4 bmp delay 1000 But if SD card not found it will skip above part to second one part when we touch any position on screen It will create solid yellow circle with radius of 3 If we drag on screen it will create a solid yellow line on dragged path cjo_cletc cj weacl_i
19. specified point has been bold or not void Graphics CfgLineHeight uint8 _t line_height This function configures height of line ThaiEasyElec 2 8 inch TFT Touch Shield User Manual V1 0 Venus Supply Co Ltd contact us sales thaieasyelec com void Graphics CfgFont uint8_t _font uint8_t width uint8 t height_div_8 uint8_t gap This function configures English font by defining font width height divide by 8 and character gap void Graphics CfgExtFont uint8_t _font uint8_t width uint8_t height_div_8 uint8_t _tone_shift uint8_t _font_ext_adj This function configures Thai font by defining font width height divide by 8 tone mark and upper vowel height and Thai and English character level adjustment void Graphics ThaiUTF8_to_ASCII uint8_t ascii uint8_t utf8 This function convert UTF 8 Thai character to buffer in ASCII enable character drawing function display them properly LCD touch screen usage function in TFT_touch cpp void touchpanel init void This function initializes SPI communication with ADS7843 touch screen controller void touchpanel get_matrix void This function loads calibration data from EEPROM in AVR void touchpanel save_matrix void This function saves calibration data to EEPROM in AVR POINT touchpanel read_tp_point void This function reads touched point then store X and Y value in structure named POINT POINT touchpanel read_lcd_point void This f
20. ting after second byte sent Set RS 1 to told ILI9328 receive this data as data Set High Byte DO D7 as high byte data which we need to store Set WR 0 to start writing high byte data to register Set WR 1 to stop writing after third byte sent Set Low Byte DO D7 as low byte data which we need to store Set WR 0 to start writing low byte data to register Set WR 1 to stop writing after forth byte sent Set LCD_CD 1 to disable LCD for finish data writing Above steps demonstrated how to write data to ILI9328 register then we can writing data to control TFT LCD ThaiEasyElec 2 8 inch TFT Touch Shield User Manual V1 0 Venus Supply Co Ltd contact us sales thaieasyelec com Operating for Touch controller with SPI interface Touch Screen designed to control using ADS7843 via SPI interface as schematic in figure 4 Figure 4 PINs out for Touch controller ADS7843 ADS7843 will convert analog signal from pin X Y X and Y to digital signal with 12 bit sensitivity When screen has been touched pin PENIRQ will be 0 So we can use it to check for touching and then read digital output data We need to calculate this data to find an actual position on LCD to control it x axis ADC 0 4095 Y axis ADC 0 4095 Figure 5 ADC value of horizontal X axis and vertical Y axis Reading ADC value from ADS7843 we need to send control byte to it every ti
21. unction comparing touched value with calibrated value to find actual point on LCD screen Please notices in the beginning of TFT_touch cpp declared a constructor coded below Touchpanel touchpanel get_matrix When create an object of touchpanel class it will automatically invoke get_metrix function ThaiEasyElec 2 8 inch TFT Touch Shield User Manual V1 0 Venus Supply Co Ltd contact us sales thaieasyelec com Appendix Describing an example code TFT2_8_Shield_Example pde ThaiEasyelec com has written example program to read picture file from SD card and display on LCD screen You can download it from http www thaieasyelec net archives Manual Example 20code zip and extract it after download completed Find and open TFT2_8 Shield_Example pde in Arduino IDE upload it into your Arduino and see how it works in this video http www youtube com watch v 5zAb8GqaZoA TFT2_8 Shield_Example Arduino 0022 w File Edit Sketch Tools Help include lt string h gt include lt TFT_graphics h gt include lt TFT_pff h gt include lt TFT_touch h gt include lt stdlib h gt include Fonts font_vrindal8x1l6 h include Fonts font_angsanal4x32 h define TP_STABLE_ COUNT 1 TFT_PFF pff Graphics tft touchpanel tp define BUF_SIZE 512 uint s_t buf BUF_SIZE uint _t bitmap_show char pFile uint s_t sd_found Figure 10 Beginning
22. vided library for basic using LCD touch screen and SD card located in TFT_Library directory To use this library you need to copy TFT_Library directory to libraries directory under Arduino IDE directory drivers examples hardware java lib reference oOo a a a B BD tools arduino cygicony 2 dll_ cygwin1 dll libusbO dll revisions rxtxSerial dll Figure 9 Location of libraries directory in Arduino IDE ThaiEasyElec 2 8 inch TFT Touch Shield User Manual V1 0 Venus Supply Co Ltd contact us sales thaieasyelec com Inside TFT_Library directory stored necessary resources such as header files and source files included Thai and English font that converted into C source code Also you can include them to your source code if needed There are many interesting files in library detailed below TFT_common_rev_a h This file declaration each pin for Arduino TFT_driver_rev_a cpp This file included many LCD low level function such as Command sending Data sending and LCD Initializing TFT_driver_rev_a h This file defined many necessary values such as Basic color value and Commands TFT_graphics cpp This file is important it included all LCD function such as Initializing LCD for using Drawing Rectangle Circle and Line Font using and etc For more about each function will describe in next chapter TFT_touch cpp This file included with touch screen function For more about each fun
23. your picture e g background or icon in external storage e Logic level using 74LVC245 e Onboard 3 3 volt regulator using NCP1117 3 3 e 5 volt power input supply from Arduino UNO Arduino Mega power supply pin e 2 8 inch TFT Touch Shield using Arduino UNO pins Digital I O pin 0 7 and 10 13 Digital I O pin 8 and 9 remaining and Analog IN pin 0 1 2 and 4 Analog IN pin 3 and 5 remaining ThaiEasyElec 2 8 inch TFT Touch Shield User Manual V1 0 Venus Supply Co Ltd contact us sales thaieasyelec com PIN Definitions A 2 8 inch TFT Touch Shield has 24 PINs divided in 2 groups of usage There are 18 signal PINs for control TFT LCD and 6 signal PINs for control touch screen controller Signal PINs for control TFT LCD 18 PINs Index Pin Name Description Control Signal 1 24 GND Ground 2 23 5V Main voltage supply 5V f 0 Turn Off Back Light 3 BL Back light control signal 4 Turn On Back Light 0 Reset LCD 4 RST Reset signal aj No Reset i 0 Enable LCD 5 LCD_CS LCD Chip Select signal 41 Disable LCD 6 RS Register Select signal ve oe fs lad 1 Control register f 0 Write Enable 7 WR Write Strobe signal 1 Write Disable 0 Read Enable 8 RD Read Strobe signal 4 Read Disable 15 22 D0 D7 Data Bus 8 bit ak 1 High Signal PINs for Touch Controller 6 PINs Index Pin Name

Download Pdf Manuals

image

Related Search

Related Contents

  Sinus A 206  HD 3CMOS Color Video Camera  ユーザーガイド SmartBand - ソニーモバイルコミュニケーションズ|Sony  Installation / Troubleshooting Manual This manual (part    touch_brain  Wacebo Europe TeachBus One  BIKE EXERCISER User`s Manual  Soins et surveillance du bds avec drainage thoracique.  

Copyright © All rights reserved.
Failed to retrieve file