{"id":320,"date":"2010-06-13T18:23:38","date_gmt":"2010-06-13T22:23:38","guid":{"rendered":"http:\/\/ve2cuy.wordpress.com\/?p=320"},"modified":"2010-06-13T18:23:38","modified_gmt":"2010-06-13T22:23:38","slug":"320","status":"publish","type":"post","link":"https:\/\/ve2cuy.com\/blog\/index.php\/2010\/06\/13\/320\/","title":{"rendered":"Optrex F-51159 glcd controlled by an Arduino"},"content":{"rendered":"<p>Just got some Optrex F-51159 GLCD&rsquo;s from eBay.<\/p>\n<p>If you ever need the datasheet or some code example to make them work with an Arduino, read further:<\/p>\n<p>glcd_demo.pde<br \/>\n============================================================================<br \/>\n\/*<br \/>\n\u00a0\u00a0 Demo of a Optrex F-51159 controlled by an Arduino.<br \/>\n\u00a0\u00a0<br \/>\n\u00a0\u00a0 Note:<br \/>\n\u00a0\u00a0<br \/>\n\u00a0\u00a0 There is no CSEL1, CSEL2 on the F-51159.\u00a0<span style=\"color:#ff0000;\"> Connect CS to\u00a0 pin 14 (analog_0)<\/span>, Nothing on pin 15 (analog_1)<br \/>\n\u00a0\u00a0 See: <a href=\"http:\/\/www.arduino.cc\/playground\/Code\/GLCDks0108\">http:\/\/www.arduino.cc\/playground\/Code\/GLCDks0108<\/a><br \/>\n\u00a0\u00a0<br \/>\n\u00a0\u00a0 <span style=\"color:#ff0000;\">LCD Bias voltage (-12 to -5 volts) to\u00a0glcd pin 3 is mandatory<\/span>.<\/p>\n<p>\u00a0\u00a0 Display is 120 x 64 dots, so make these changes to &lsquo;ks0108_Panel.h&rsquo; :<br \/>\n\u00a0\u00a0 &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ for F-51159NYJ-SEW-AA<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color:#ff0000;\">\u00a0 #define DISPLAY_WIDTH 120<br \/>\n<\/span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 #define DISPLAY_HEIGHT 64<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ panel controller chips<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color:#ff0000;\">#define CHIP_WIDTH\u00a0\u00a0\u00a0\u00a0 60\u00a0 \/\/ pixels per chip<br \/>\n<\/span>\u00a0\u00a0 &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\n\u00a0*\/<\/p>\n<p>#include &lt;ks0108.h&gt;<br \/>\n#include \u00ab\u00a0Arial14.h\u00a0\u00bb\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<br \/>\n#include \u00ab\u00a0clock.h\u00a0\u00bb\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Clock bitmap<\/p>\n<p>unsigned long startMillis;<\/p>\n<p>void setup(){<br \/>\n\u00a0 GLCD.Init(NON_INVERTED);\u00a0\u00a0<br \/>\n\u00a0 GLCD.ClearScreen();\u00a0<br \/>\n\u00a0 GLCD.DrawBitmap(clock, 0,0, BLACK);<br \/>\n\u00a0 GLCD.SelectFont(Arial_14);<br \/>\n\u00a0 GLCD.GotoXY(60, 2);<br \/>\n\u00a0 GLCD.Puts(\u00ab\u00a0Pixel Show\u00a0\u00bb);<br \/>\n\u00a0 GLCD.GotoXY(61, 47);<br \/>\n\u00a0 GLCD.Puts(\u00ab\u00a0by ve2cuy\u00a0\u00bb);<br \/>\n\u00a0 countdown(9);<br \/>\n}<\/p>\n<p>void countdown(int count){<br \/>\n\u00a0\u00a0\u00a0 while(count&#8211;){<br \/>\n\u00a0\u00a0\u00a0\u00a0 GLCD.GotoXY(30, 40);<br \/>\n\u00a0\u00a0\u00a0\u00a0 GLCD.PutChar(count + &lsquo;0&rsquo;);<br \/>\n\u00a0\u00a0\u00a0\u00a0 delay(1000);\u00a0<br \/>\n\u00a0\u00a0\u00a0\u00a0 GLCD.GotoXY(30, 40);<br \/>\n\u00a0\u00a0\u00a0\u00a0 GLCD.Puts(\u00a0\u00bb\u00a0 \u00ab\u00a0);<br \/>\n\u00a0 }\u00a0<br \/>\n}<\/p>\n<p>void\u00a0 loop(){<br \/>\n\u00a0 GLCD.ClearScreen();<\/p>\n<p>\u00a0 startMillis = millis();<br \/>\n\u00a0 while( millis() &#8211; startMillis &lt; 15000){<br \/>\n\u00a0\u00a0\u00a0 GLCD.SetDot( random(120), random(64), BLACK);<br \/>\n\u00a0 }<\/p>\n<p>\u00a0 startMillis = millis();<br \/>\n\u00a0 while( millis() &#8211; startMillis &lt; 15000){<br \/>\n\u00a0\u00a0\u00a0 GLCD.SetDot( random(120), random(64), WHITE);<br \/>\n\u00a0 }<\/p>\n<p>\u00a0 GLCD.Init(INVERTED);\u00a0<br \/>\n\u00a0 GLCD.ClearScreen();<br \/>\n\u00a0 GLCD.GotoXY(36, 24);<br \/>\n\u00a0 GLCD.Puts(\u00ab\u00a0The\u00a0 end&#8230;\u00a0\u00bb);<br \/>\n\u00a0 while (true){}<br \/>\n}<br \/>\n============================================================================<\/p>\n<p>Datasheet:<\/p>\n<p><a href=\"http:\/\/ve2cuy.com\/blog\/wp-content\/uploads\/2010\/06\/f-51159.pdf\">F-51159<\/a><\/p>\n<p><code>[youtube=http:\/\/www.youtube.com\/watch?v=yUbRnAU_2Is]<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Just got some Optrex F-51159 GLCD&rsquo;s from eBay. If you ever need the datasheet or some code example to make them work with an Arduino, read further: glcd_demo.pde ============================================================================ \/* \u00a0\u00a0 Demo of a Optrex F-51159 controlled by an Arduino. \u00a0\u00a0 \u00a0\u00a0 Note: \u00a0\u00a0 \u00a0\u00a0 There is no CSEL1, CSEL2 on the F-51159.\u00a0 Connect CS [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,8],"tags":[],"class_list":["post-320","post","type-post","status-publish","format-standard","hentry","category-arduino","category-microcontroller-projects"],"_links":{"self":[{"href":"https:\/\/ve2cuy.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/320","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ve2cuy.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ve2cuy.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ve2cuy.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ve2cuy.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=320"}],"version-history":[{"count":0,"href":"https:\/\/ve2cuy.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/320\/revisions"}],"wp:attachment":[{"href":"https:\/\/ve2cuy.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=320"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ve2cuy.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=320"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ve2cuy.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=320"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}