{"id":257,"date":"2010-10-02T12:15:59","date_gmt":"2010-10-02T11:15:59","guid":{"rendered":"http:\/\/www.evertdekker.com\/wp\/?p=257"},"modified":"2023-01-03T15:33:58","modified_gmt":"2023-01-03T14:33:58","slug":"3-5-320x240-color-touch-screen","status":"publish","type":"post","link":"https:\/\/evertdekker.com\/wp\/?p=257","title":{"rendered":"3.5&#8243; 320&#215;240 Color touch screen"},"content":{"rendered":"<hr \/>\n<p>On ebay i found <a href=\"http:\/\/cgi.ebay.com\/3-5-TFT-LCD-Module-Display-Touch-Panel-PCB-adapter_W0QQitemZ200401013928QQcategoryZ26206QQcmdZViewItemQQ_trksidZp5197.m7QQ_trkparmsZalgo%3DLVI%26itu%3DUCI%26otn%3D4%26po%3DLVI%26ps%3D63%26clkid%3D4605108125247322775\">this very nice and cheap tft display<\/a> .It contains a tft color screen with 320x240 pixels, touch-controller and Sd card reader.<br \/>\nThe display controller used is the SSD2119 and for the touch controller they used ADS7843.<br \/>\nDemo is running on Atmel Avr M1284P @16Mhz with Bascom 1.12.0.0<\/p>\n<div class=\"n2_ss_slider_publish__option_code\" dir=\"ltr\" data-mode=\"id\"><\/div>\n<div class=\"lyte-wrapper\" title=\"3.5&amp;quot; 320x240 Color TFT Demo with touchscreen, Bascom and SSD2119 controller\" style=\"width:420px;max-width: 100%;margin:5px;\"><div class=\"lyMe hidef\" id=\"WYL_sw6tmo5WcNI\" itemprop=\"video\" itemscope itemtype=\"https:\/\/schema.org\/VideoObject\"><div><meta itemprop=\"thumbnailUrl\" content=\"https:\/\/i.ytimg.com\/vi\/sw6tmo5WcNI\/maxresdefault.jpg\" \/><meta itemprop=\"embedURL\" content=\"https:\/\/www.youtube.com\/embed\/sw6tmo5WcNI\" \/><meta itemprop=\"uploadDate\" content=\"2010-10-22T13:00:52.000Z\" \/><\/div><div id=\"lyte_sw6tmo5WcNI\" data-src=\"https:\/\/i.ytimg.com\/vi\/sw6tmo5WcNI\/maxresdefault.jpg\" class=\"pL\"><div class=\"tC\"><div class=\"tT\" itemprop=\"name\">3.5&quot; 320x240 Color TFT Demo with touchscreen, Bascom and SSD2119 controller<\/div><\/div><div class=\"play\"><\/div><div class=\"ctrl\"><div class=\"Lctrl\"><\/div><div class=\"Rctrl\"><\/div><\/div><\/div><noscript><a href=\"https:\/\/youtu.be\/sw6tmo5WcNI\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i.ytimg.com\/vi\/sw6tmo5WcNI\/0.jpg\" alt=\"\" width=\"420\" height=\"216\" \/><br \/>Watch this video on YouTube<\/a><\/noscript><meta itemprop=\"description\" content=\"3.5&quot; 320x240 Color TFT Demo with touchscreen, Bascom and SSD2119 controller Bascom routines to show Bascom font files in all sizes and colors, BGF picture file from flash or SD card, BMP file from SD card. Demo running Atmel Avr M1284P @16Mhz with Bascom 1.12.0.0 More info: http:\/\/evertdekker.com\/Joomla\/index.php?option=com_content&amp;task=view&amp;id=77&amp;Itemid=84\"><\/div><\/div><div class=\"lL\" style=\"max-width:100%;width:420px;margin:5px;\"><\/div><\/p>\n<p>Some Notes:<br \/>\n-- 320x240x16bits needs enormous amount of data and cpu power to get something on the screen, don\u2019t expect live video @25fps. Take a look at the video to get an idea of the performance.<br \/>\n-- To get the display compatible with the Bascom 8bit BGC (Bascom Grapichs Color) files, the 8bits color are up-scaled to 16bits. Therefore the colors are maybe not always correct, you can adjust this in the look-up table.<br \/>\n-- The size of the BGC are limited to 255x255 pixels.<br \/>\n-- The 24bit colors of the BMP files are downscaled to 16bits by simply dropping the LSB.<br \/>\n-- Jumpers setting of the display board\u00a0 are a bit strange, make the soldering connection is a logic 0 and removing the solder is a logic 1.<br \/>\n-- The touch controller needs <em>Polarity =low<\/em> and <em>Phase =0<\/em> for the spi communication, the Sd cards needs <em>Polarity =high<\/em> and <em>Phase =1.<\/em> To overcome this problem in the readtouch function\u2019s the Polarity and Phase are changed at the beginning of the function and changed back at the end.<br \/>\n-- Display works on <u>3.3V<\/u> so use a level converter or an AVR that can run on 3.3V.<br \/>\n-- Add the <em>Spiin = 255<\/em> option to the Config Spi line in Config_mmc.bas if your using the touch and sd-reader, else it won\u2019t work.<\/p>\n<p><div class=\"sdm_download_button_box_default\"><div class=\"sdm_download_link\"><a href=\"https:\/\/evertdekker.com\/wp\/?sdm_process_download=1&download_id=262\" class=\"sdm_download darkblue\" title=\"3.5&#8243; 320&#215;240 Color touch screen\" >Download Now!<\/a><\/div><\/div> <div class=\"sdm_download_count\"><span class=\"sdm_count_number\">4435<\/span><span class=\"sdm_count_string\"> Downloads<\/span><\/div><\/p>\n<p>&nbsp;<\/p>\n<h4>Syntax<\/h4>\n<p><span style=\"color: #3366ff;\">Lcdtext<\/span> string, x , y , fontset , forecolor , backcolor<\/p>\n<h4>Remarks<\/h4>\n<table class=\"alignleft\" style=\"border-color: #000000;\" border=\"2\" cellspacing=\"2\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td>String<\/td>\n<td>String to be displayed<\/td>\n<\/tr>\n<tr>\n<td>x<\/td>\n<td>\u00a0Constant or variable with x position.<\/td>\n<\/tr>\n<tr style=\"border-color: #000000;\">\n<td>y<\/td>\n<td>\u00a0Constant or variable with y position.<\/td>\n<\/tr>\n<tr>\n<td>fontset<\/td>\n<td>\u00a0Fontset to be used to display the text<\/td>\n<\/tr>\n<tr>\n<td>Forecolor<\/td>\n<td>\u00a0RRRRRGGGGGGBBBBB<\/td>\n<\/tr>\n<tr>\n<td>Backcolor<\/td>\n<td>\u00a0RRRRRGGGGGGBBBBB<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>This will show text on the lcd. It uses the Bascom FONT files for compatibility.<br \/>\nTo add or remove fontsets modify these lines in the subroutine;<\/p>\n<p><strong>If<\/strong> Fontset = 1 <strong>Then<\/strong> <strong>Restore<\/strong> Font8x8<br \/>\n<strong>If<\/strong> Fontset = 2 <strong>Then<\/strong> <strong>Restore<\/strong> Font16x16<br \/>\n<strong>If<\/strong> Fontset = 3 <strong>Then<\/strong> <strong>Restore<\/strong> Font6x8<br \/>\n<strong>If<\/strong> Fontset = 4 <strong>Then<\/strong> <strong>Restore<\/strong> Font5x5<\/p>\n<p>Sorry, but there was no better solution.<br \/>\nThese are the name\u2019s that you gave to the font, NOT the file-name if you don\u2019t know the font name, open the font file in the font editor, and there it is, right on top.<br \/>\nDon\u2019t forget to $Include your font files at the end of the program.<\/p>\n<h4><\/h4>\n<p>&nbsp;<\/p>\n<h4>Syntax<\/h4>\n<p><span style=\"color: #3366ff;\">Lcd_showpicture_bmp<\/span> Filename, x , y<\/p>\n<h4>Remarks<\/h4>\n<table class=\"alignleft\" style=\"border-color: #000000;\" border=\"2\" cellspacing=\"2\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td>\u00a0Filename<\/td>\n<td>\u00a0Filename of Windows BMP file (24bpp)<\/td>\n<\/tr>\n<tr>\n<td>\u00a0x<\/td>\n<td>\u00a0Constant or variable with x position.<\/td>\n<\/tr>\n<tr>\n<td>\u00a0y<\/td>\n<td>\u00a0Constant or variable with y position.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>This will show Windows 24bpp BMP from the sd card. The 24bpp colors are downscaled to 16bpp.<br \/>\nRequires Avr-dos.<\/p>\n<p>&nbsp;<\/p>\n<h4>Syntax<\/h4>\n<p><span style=\"color: #3366ff;\">Lcd_showpicture_sd<\/span> Filename, x , y<\/p>\n<h4>Remarks<\/h4>\n<table class=\"alignleft\" style=\"border-color: #000000;\" border=\"2\" cellspacing=\"2\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td>\u00a0Filename<\/td>\n<td>\u00a0Filename of Bascom BGC file<\/td>\n<\/tr>\n<tr>\n<td>\u00a0x<\/td>\n<td>\u00a0Constant or variable with x position.<\/td>\n<\/tr>\n<tr>\n<td>\u00a0y<\/td>\n<td>\u00a0Constant or variable with y position.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>This will show Bascom BGC (Bascom Graphics Color) file from the sd-card. The 8bpp colors are up-scaled to 16bpp with the help of a look-up table. In this table you can adjust the colors if necessary.<br \/>\nRequires Avr-dos.<\/p>\n<p>&nbsp;<\/p>\n<h4>Syntax<\/h4>\n<p><span style=\"color: #3366ff;\">Lcd_showpicture<\/span>\u00a0 x , y<\/p>\n<h4>Remarks<\/h4>\n<table class=\"alignleft\" style=\"border-color: #000000;\" border=\"2\" cellspacing=\"2\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td>\u00a0x<\/td>\n<td>\u00a0Constant or variable with x position.<\/td>\n<\/tr>\n<tr>\n<td>\u00a0y<\/td>\n<td>\u00a0Constant or variable with y position.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>This will show Bascom BGC (Bascom Graphics Color) file from the flash memory. The 8bpp colors are up-scaled to 16bpp with the help of a look-up table. In this table you can adjust the colors if necessary.<br \/>\nImportant that you first Restore the picture, for example;<br \/>\n<strong>Restore<\/strong> Girl\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8216;FIRST restore you image before you can show it<br \/>\nLcd_showpicture_sd &#8220;girl.bgc&#8221;, 150 , 10<\/p>\n<p>&nbsp;<\/p>\n<h4>Syntax<\/h4>\n<p><span style=\"color: #3366ff;\">Lcd_line<\/span>\u00a0 x1, y1 , x2 , y2 , color<\/p>\n<h4>Remarks<\/h4>\n<table class=\"alignleft\" style=\"border-color: #000000;\" border=\"2\" cellspacing=\"2\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td>\u00a0x1<\/td>\n<td>\u00a0Starting horizontal location of the line.<\/td>\n<\/tr>\n<tr>\n<td>\u00a0y1<\/td>\n<td>\u00a0Starting vertical location of the line.<\/td>\n<\/tr>\n<tr>\n<td>\u00a0x2<\/td>\n<td>\u00a0Horizontal end location of the line.<\/td>\n<\/tr>\n<tr>\n<td>\u00a0y2<\/td>\n<td>\u00a0Vertical end location of the line.<\/td>\n<\/tr>\n<tr>\n<td>\u00a0color<\/td>\n<td>\u00a0RRRRRGGGGGGBBBBB<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Draws a line on the lcd.<\/p>\n<p>&nbsp;<\/p>\n<h4>Syntax<\/h4>\n<p><span style=\"color: #3366ff;\">Lcd_clear<\/span>\u00a0 backcolor<\/p>\n<h4>Remarks<\/h4>\n<table class=\"alignleft\" style=\"border-color: #000000;\" border=\"2\" cellspacing=\"2\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td>\u00a0backcolor<\/td>\n<td>\u00a0RRRRRGGGGGGBBBBB<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Clears the lcd in an specified color.<\/p>\n<p>&nbsp;<\/p>\n<h4>Syntax<\/h4>\n<p><span style=\"color: #3366ff;\">Lcd_pset<\/span>\u00a0 x, y , color<\/p>\n<h4>Remarks<\/h4>\n<table class=\"alignleft\" style=\"border-color: #000000;\" border=\"2\" cellspacing=\"2\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td>\u00a0x<\/td>\n<td>\u00a0The x location.<\/td>\n<\/tr>\n<tr>\n<td>\u00a0y<\/td>\n<td>\u00a0The y location.<\/td>\n<\/tr>\n<tr>\n<td>\u00a0color<\/td>\n<td>\u00a0RRRRRGGGGGGBBBBB<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Set a pixel on the lcd.<\/p>\n<p>&nbsp;<\/p>\n<h4>Syntax<\/h4>\n<p><span style=\"color: #3366ff;\">Lcd_Setcursor<\/span>\u00a0 x, y<\/p>\n<h4>Remarks<\/h4>\n<table class=\"alignleft\" style=\"border-color: #000000;\" border=\"2\" cellspacing=\"2\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td>\u00a0x<\/td>\n<td>\u00a0The x location.<\/td>\n<\/tr>\n<tr>\n<td>\u00a0y<\/td>\n<td>\u00a0The y location.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Set the ram address (cursor) to the specified position.<\/p>\n<p>&nbsp;<\/p>\n<h4>Syntax<\/h4>\n<p><span style=\"color: #3366ff;\">Write_data<\/span>\u00a0 data16<\/p>\n<h4>Remarks<\/h4>\n<table class=\"alignleft\" style=\"border-color: #000000;\" border=\"2\" cellspacing=\"2\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td>\u00a0Data16<\/td>\n<td>\u00a0Word<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Write 16bit data to the lcd<\/p>\n<p>&nbsp;<\/p>\n<h4>Syntax<\/h4>\n<p><span style=\"color: #3366ff;\">Write_Command<\/span>\u00a0 Command<\/p>\n<h4>Remarks<\/h4>\n<table class=\"alignleft\" style=\"border-color: #000000;\" border=\"2\" cellspacing=\"2\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td>\u00a0Command<\/td>\n<td>\u00a0Word<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Write 16bit command to the lcd<\/p>\n<p>&nbsp;<\/p>\n<h4>Syntax<\/h4>\n<p><span style=\"color: #3366ff;\">Lcd_reset<\/span><\/p>\n<p>Hardware lcd reset<\/p>\n<p>&nbsp;<\/p>\n<h4>Syntax<\/h4>\n<p><span style=\"color: #3366ff;\">Lcd_init<\/span><\/p>\n<p>Init the lcd<\/p>\n<p>&nbsp;<\/p>\n<h4>Syntax<\/h4>\n<p><span style=\"color: #3366ff;\">Lcd_home<\/span><\/p>\n<p>Set the ram address (cursor) to the home position<\/p>\n<p>&nbsp;<\/p>\n<h4>Syntax<\/h4>\n<p>A= Rgb16\u00a0 rgb8<\/p>\n<h4>Remarks<\/h4>\n<table class=\"alignleft\" style=\"border-color: #000000;\" border=\"2\" cellspacing=\"2\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td>\u00a0A<\/td>\n<td>\u00a016bpp RGB Word<\/td>\n<\/tr>\n<tr>\n<td>\u00a0rgb8<\/td>\n<td>\u00a08bpp RGB<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Convert 8bpp color to 16bpp color.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4>Syntax<\/h4>\n<p>A= <span style=\"color: #3366ff;\">Readtouch_X<\/span><\/p>\n<h4>Remarks<\/h4>\n<table class=\"alignleft\" style=\"border-color: #000000;\" border=\"2\" cellspacing=\"2\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td>\u00a0A<\/td>\n<td>\u00a012 Bit x position<\/td>\n<\/tr>\n<tr>\n<td>\u00a0rgb8<\/td>\n<td>\u00a08bpp RGB<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Reads the X coordinates from the touchscreen.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4>Syntax<\/h4>\n<p>A= <span style=\"color: #3366ff;\">Readtouch_Y<\/span><\/p>\n<h4>Remarks<\/h4>\n<table class=\"alignleft\" style=\"border-color: #000000;\" border=\"2\" cellspacing=\"2\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td>\u00a0A<\/td>\n<td>\u00a012 Bit y position<\/td>\n<\/tr>\n<tr>\n<td>\u00a0rgb8<\/td>\n<td>\u00a08bpp RGB<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Reads the Y coordinates from the touchscreen.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>On ebay i found this very nice and cheap tft display .It contains a tft color screen with 320&#215;240 pixels, touch-controller and Sd card reader. The display controller used is the SSD2119 and for the touch controller they used ADS7843. Demo is running on Atmel Avr M1284P @16Mhz with Bascom 1.12.0.0 Some Notes: &#8211; 320x240x16bits [&#8230;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[31,26,33,32],"class_list":["post-257","post","type-post","status-publish","format-standard","hentry","category-bascom","tag-320x240","tag-bascom","tag-ssd2119","tag-tft-display"],"_links":{"self":[{"href":"https:\/\/evertdekker.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/257","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/evertdekker.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/evertdekker.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/evertdekker.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/evertdekker.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=257"}],"version-history":[{"count":47,"href":"https:\/\/evertdekker.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/257\/revisions"}],"predecessor-version":[{"id":1813,"href":"https:\/\/evertdekker.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/257\/revisions\/1813"}],"wp:attachment":[{"href":"https:\/\/evertdekker.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=257"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/evertdekker.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=257"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/evertdekker.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}