{"id":531,"date":"2010-10-17T17:33:39","date_gmt":"2010-10-17T21:33:39","guid":{"rendered":"http:\/\/protofusion.org\/wordpress\/?p=531"},"modified":"2010-11-21T00:53:07","modified_gmt":"2010-11-21T04:53:07","slug":"the-osram-slg2016-and-avr","status":"publish","type":"post","link":"http:\/\/protofusion.org\/wordpress\/2010\/10\/the-osram-slg2016-and-avr\/","title":{"rendered":"The OSRAM SLG2016 and AVR"},"content":{"rendered":"<p><a href=\"http:\/\/protofusion.org\/wordpress\/wp-content\/uploads\/2010\/07\/slg2016-macro.jpg\" data-rel=\"lightbox-image-0\" data-rl_title=\"\" data-rl_caption=\"\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-545\" title=\"\" src=\"http:\/\/protofusion.org\/wordpress\/wp-content\/uploads\/2010\/07\/slg2016-macro-500x375.jpg\" alt=\"\" width=\"500\" height=\"375\" srcset=\"http:\/\/protofusion.org\/wordpress\/wp-content\/uploads\/2010\/07\/slg2016-macro-500x375.jpg 500w, http:\/\/protofusion.org\/wordpress\/wp-content\/uploads\/2010\/07\/slg2016-macro-300x225.jpg 300w, http:\/\/protofusion.org\/wordpress\/wp-content\/uploads\/2010\/07\/slg2016-macro.jpg 1000w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<p>I happened to scavenge a couple of SLG2016&#8217;s from some old workstation debug displays. After finally locating a datasheet, I realized that they used the standard ASCII charset, so they are extremely easy to drive. <em>Note: The SLG2016 differs from the SLR2016, SLO2016, and SLY2016 only by LED color.<\/em><\/p>\n<p><em><!--more--><\/em><\/p>\n<p><a href=\"http:\/\/protofusion.org\/wordpress\/wp-content\/uploads\/2010\/07\/attiny88-macro.jpg\" data-rel=\"lightbox-image-1\" data-rl_title=\"\" data-rl_caption=\"\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-542\" title=\"\" src=\"http:\/\/protofusion.org\/wordpress\/wp-content\/uploads\/2010\/07\/attiny88-macro-500x375.jpg\" alt=\"\" width=\"500\" height=\"375\" srcset=\"http:\/\/protofusion.org\/wordpress\/wp-content\/uploads\/2010\/07\/attiny88-macro-500x375.jpg 500w, http:\/\/protofusion.org\/wordpress\/wp-content\/uploads\/2010\/07\/attiny88-macro-300x225.jpg 300w, http:\/\/protofusion.org\/wordpress\/wp-content\/uploads\/2010\/07\/attiny88-macro.jpg 1000w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<p>The only downside to these displays is that they use quite a few pins (7 data lines, 2 digit select lines, write line, and optional blanking line). For now, I&#8217;m driving the display with all pins in\u00a0parallel\u00a0on a tiny88 which has plenty of pins; however I plan on using a shift register to cut down on data bus pin usage in the future. The displays only need the data lines to be held stable during a write cycle, making shift registers well-suited to this task.<\/p>\n<p><a href=\"http:\/\/protofusion.org\/wordpress\/wp-content\/uploads\/2010\/07\/buspirate-macro.jpg\" data-rel=\"lightbox-image-2\" data-rl_title=\"\" data-rl_caption=\"\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-544 alignnone\" title=\"\" src=\"http:\/\/protofusion.org\/wordpress\/wp-content\/uploads\/2010\/07\/buspirate-macro-500x375.jpg\" alt=\"\" width=\"500\" height=\"375\" srcset=\"http:\/\/protofusion.org\/wordpress\/wp-content\/uploads\/2010\/07\/buspirate-macro-500x375.jpg 500w, http:\/\/protofusion.org\/wordpress\/wp-content\/uploads\/2010\/07\/buspirate-macro-300x225.jpg 300w, http:\/\/protofusion.org\/wordpress\/wp-content\/uploads\/2010\/07\/buspirate-macro.jpg 1000w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<p>To flash the attiny88, I&#8217;m using a <a href=\"http:\/\/dangerousprototypes.com\/category\/bus-pirate\/\" target=\"_blank\">Bus Pirate<\/a> (pictured above) flashed with the STK500v2 emulation firmware. This allows me to use avr-gcc with AVR Studio to program the chip.<\/p>\n<p>Here is some code I used to test the displays, using PORTD for data lines, and the 2 LSB&#8217;s of PORTC for digit select lines. This is the first time I&#8217;ve worked with AVRs outside of the Arduino environment, so pardon any flagrant errors and drop me a comment if you have any suggestions.<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n#define F_CPU 1000000UL\r\n\r\n#include &lt;avr\/io.h&gt;\r\n#include &lt;util\/delay.h&gt;\r\n#include &lt;string.h&gt;\r\n#include &lt;stdlib.h&gt;\r\n\r\nvoid wr();\r\nvoid wrChar(char toWrite, int dig);\r\nvoid wrWord(char *word);\r\nvoid scrollWord(char *word);\r\nvoid delay_ms(uint16_t ms);\r\n\r\nint main (void){\r\n  DDRC=0xFF;\r\n  DDRD=0xFF;\r\n  PORTD=0x00;\r\n  PORTC=0x00;\r\n\r\n  \/\/ Loop through a few strings for testing\r\n  while(1){\r\n    wrWord(&quot;Helo&quot;);\r\n    delay_ms(500);\r\n    wrWord(&quot;*?%$&quot;);\r\n    delay_ms(500);\r\n  }\r\n}\r\n\r\n\/\/ Toggle write pin (PC0)\r\nvoid wr() {\r\n  PORTD &amp;= ~(1&lt;&lt;7);\r\n  delay_ms(1);\r\n  PORTD |= (1&lt;&lt;7);\r\n}\r\n\r\n\/\/ Write char to position\r\nvoid wrChar(char toWrite, int pos){\r\n  PORTC = pos;  \/\/ Set digit select lines\r\n  PORTD = toWrite;  \/\/ Set data lines\r\n  wr();  \/\/ Toggle write pin\r\n}\r\n\r\n\/\/ Write 4-char word\r\nvoid wrWord(char *word){\r\n  for(int i=3; i&gt;=0; i--){\r\n    wrChar(word&#x5B;i], 3-i);\r\n  }\r\n}\r\n\r\n\/\/ Generic delay function\r\nvoid delay_ms(uint16_t ms) {\r\n  while (ms) {\r\n    _delay_ms(1);\r\n    ms--;\r\n  }\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I happened to scavenge a couple of SLG2016&#8217;s from some old workstation debug displays. After finally locating a datasheet, I realized that they used the standard ASCII charset, so they are extremely easy to drive. Note: The SLG2016 differs from<span class=\"ellipsis\">&hellip;<\/span><\/p>\n<div class=\"read-more\"><a href=\"http:\/\/protofusion.org\/wordpress\/2010\/10\/the-osram-slg2016-and-avr\/\">Read more &#8250;<\/a><\/div>\n<p><!-- end of .read-more --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kadence_starter_templates_imported_post":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[78],"tags":[79,257,80,82,81,83],"class_list":["post-531","post","type-post","status-publish","format-standard","hentry","category-avr","tag-attiny88","tag-avr","tag-osram","tag-slg-2016","tag-slg2016","tag-tiny88"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pNjAs-8z","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/protofusion.org\/wordpress\/wp-json\/wp\/v2\/posts\/531","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/protofusion.org\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/protofusion.org\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/protofusion.org\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/protofusion.org\/wordpress\/wp-json\/wp\/v2\/comments?post=531"}],"version-history":[{"count":16,"href":"http:\/\/protofusion.org\/wordpress\/wp-json\/wp\/v2\/posts\/531\/revisions"}],"predecessor-version":[{"id":715,"href":"http:\/\/protofusion.org\/wordpress\/wp-json\/wp\/v2\/posts\/531\/revisions\/715"}],"wp:attachment":[{"href":"http:\/\/protofusion.org\/wordpress\/wp-json\/wp\/v2\/media?parent=531"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/protofusion.org\/wordpress\/wp-json\/wp\/v2\/categories?post=531"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/protofusion.org\/wordpress\/wp-json\/wp\/v2\/tags?post=531"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}