{"id":920,"date":"2024-06-23T13:39:04","date_gmt":"2024-06-23T13:39:04","guid":{"rendered":"https:\/\/iotthinghub.com\/?p=920"},"modified":"2024-08-11T14:50:35","modified_gmt":"2024-08-11T14:50:35","slug":"build-your-own-custom-character","status":"publish","type":"post","link":"https:\/\/iotthinghub.com\/?p=920","title":{"rendered":"Build your own custom character"},"content":{"rendered":"\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-7387b849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-large is-resized\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"334\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/LCD-Internal-Connection-1024x334.jpg\" alt=\"\" class=\"wp-image-921\" style=\"width:402px;height:auto\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/LCD-Internal-Connection-1024x334.jpg 1024w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/LCD-Internal-Connection-300x98.jpg 300w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/LCD-Internal-Connection-768x251.jpg 768w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/LCD-Internal-Connection.jpg 1134w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p class=\"wp-block-paragraph\">We previously learn about LCD display. In this article we build our own custom character. A standard alphanumeric LCD display has CGRAM area to create user defined patterns.&nbsp; To build a custom pattern we need to write values to the CGRAM area defining which pixel to glow. The values are to be written in the CGRAM address starting from 0x40. The CGRAM has a total of 64bits.<\/p>\n<\/div>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">When you are using LCD as 5&#215;8 dots in function set, then you can defined a total of 8 user defined patterns containing 1 byte for each raw and rows for each pattern. When LCD is working in 5&#215;10 dots you can defined 4 user defined pattern. If you are using the cursor than it is recommended not to use the 8<sup>th<\/sup> raw.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Let begin our examination by making a \u2018tone\u2019 pattern as shown bellow-<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-7387b849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:66.66%\">\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"377\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/pixel-draw-1024x377.jpg\" alt=\"\" class=\"wp-image-926\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/pixel-draw-1024x377.jpg 1024w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/pixel-draw-300x110.jpg 300w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/pixel-draw-768x282.jpg 768w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/pixel-draw.jpg 1297w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.33%\">\n<p class=\"wp-block-paragraph\">Here&nbsp;&nbsp; 1&#8212;&#8212;&#8211; Pixel is glowing<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&#8212;&#8212;&#8211; pixel is off<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The next step is to store the value in DDROM. Let\u2019s build a complete 8 user defined pattern and display it in LCD. Fast thing is you need is to draw the custom character and find the coding.<\/p>\n<\/div>\n<\/div>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"441\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/bangladesh-1024x441.jpg\" alt=\"\" class=\"wp-image-931\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/bangladesh-1024x441.jpg 1024w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/bangladesh-300x129.jpg 300w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/bangladesh-768x331.jpg 768w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/bangladesh.jpg 1345w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now our pattern is ready. The next step is to store those values. Let\u2019s store this value in a two dimensional character array.i.e.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>unsigned char pattern[8][8]={<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0x1F, 0x06, 0x0A, 0x12, 0x0A, 0x06, 0x02, 0x00},<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb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, 0x0C, 0x14, 0x04, 0x00},<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0x1E, 0x1A, 0x12, 0x02, 0x02, 0x02, 0x02, 0x00}<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;         &nbsp; &nbsp;};<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We need to send the bit pattern in proper location in DDROM. Let\u2019s look into the table bellow-<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"70\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/location-1024x70.jpg\" alt=\"\" class=\"wp-image-934\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/location-1024x70.jpg 1024w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/location-300x20.jpg 300w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/location-768x52.jpg 768w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/location.jpg 1354w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Since the position has an incremental value we have to build one function to store the value in DDROM with start address 0x40.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"313\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/DDROM-1024x313.jpg\" alt=\"\" class=\"wp-image-935\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/DDROM-1024x313.jpg 1024w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/DDROM-300x92.jpg 300w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/DDROM-768x235.jpg 768w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/DDROM.jpg 1346w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Similarly other pattern can be written in CGRAM. To display the custom character let\u2019s make a function \u2013<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"153\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/Custom-display-1024x153.jpg\" alt=\"\" class=\"wp-image-936\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/Custom-display-1024x153.jpg 1024w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/Custom-display-300x45.jpg 300w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/Custom-display-768x115.jpg 768w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/Custom-display.jpg 1338w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">LCD driver file[ lcd.c &amp; lcd.h ] contain all the necessary function. To write your own custom character just replace your custom with pattern[8][8] that we already discuss before. The main function-<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\n#include&lt;avr\/io.h&gt;\n#include&lt;util\/delay.h&gt;\n#include&lt;stdio.h&gt;\n#include&quot;lcd.h&quot;        \/\/ PORTD as LCD port\nint main(void)\n{\nLCD_INIT();\nLCD_Clear();\nwhile(1)\n\t{\n\n\t\t\t\tLCD_write_string(1,1,&quot;ARM Electronic&quot;);\n\t\t\t\tLCD_write_custom(1,2,0);\n\t\t\t\tLCD_write_custom(2,2,1);\n\t\t\t\tLCD_write_custom(3,2,2);\n\t\t\t\tLCD_write_custom(4,2,3);\n\t\t\t\tLCD_write_custom(5,2,4);\n\t\t\t\tLCD_write_custom(6,2,5);\n\t\t\t\tLCD_write_custom(7,2,6);\n\t\t\t\tLCD_write_custom(8,2,7);\n\t}\nreturn 0;\n}\n<\/pre><\/div>\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-7387b849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.33%\">\n<div class=\"wp-block-buttons is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-3e41869c wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/08\/Custom-Character.rar\" style=\"border-radius:14px;padding-top:var(--wp--preset--spacing--30);padding-right:var(--wp--preset--spacing--40);padding-bottom:var(--wp--preset--spacing--30);padding-left:var(--wp--preset--spacing--40)\">download<\/a><\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:66.66%\">\n<p class=\"has-upper-heading-font-size wp-block-paragraph\"><strong><a href=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/08\/Custom-Character.rar\">Download the full program with proteus simulation<\/a><\/strong><\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>We previously learn about LCD display. In this article we build our own custom character. A standard alphanumeric LCD display has CGRAM area to create user defined patterns.&nbsp; To build a custom pattern we need to write values to the CGRAM area defining which pixel to glow. The values are to be written in the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-920","post","type-post","status-publish","format-standard","hentry","category-i-o-port-operations"],"_links":{"self":[{"href":"https:\/\/iotthinghub.com\/index.php?rest_route=\/wp\/v2\/posts\/920","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/iotthinghub.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/iotthinghub.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/iotthinghub.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/iotthinghub.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=920"}],"version-history":[{"count":9,"href":"https:\/\/iotthinghub.com\/index.php?rest_route=\/wp\/v2\/posts\/920\/revisions"}],"predecessor-version":[{"id":2543,"href":"https:\/\/iotthinghub.com\/index.php?rest_route=\/wp\/v2\/posts\/920\/revisions\/2543"}],"wp:attachment":[{"href":"https:\/\/iotthinghub.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=920"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/iotthinghub.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=920"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/iotthinghub.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=920"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}