<script>ecbox_number=1;</script><style type="text/css" style="display:none;" id="easycode_inline_style">
.easycodebox li {white-space:pre !important; word-wrap:normal !important; word-break:keep-all; list-style-type:decimal-leading-zero !important;}
.easycodebox .main ol {font-family: 'Consolas','Consolas_WEB',Consolas,monaco,monospace !important; font-size: 90% !important;}

.easycodebox .headbar .message:after {content:"- Show or hide the code";}</style><script>ecbox_number=2;</script>{"id":43,"date":"2016-09-08T17:28:17","date_gmt":"2016-09-08T17:28:17","guid":{"rendered":"http:\/\/taptronics.com\/taptronics\/?p=43"},"modified":"2017-12-01T14:47:23","modified_gmt":"2017-12-01T14:47:23","slug":"convert-light-bulb-control-panel-into-lcd-alarm-and-warning-system-with-arduino","status":"publish","type":"post","link":"http:\/\/taptronics.com\/taptronics\/convert-light-bulb-control-panel-into-lcd-alarm-and-warning-system-with-arduino\/","title":{"rendered":"Convert legacy control panel into  LCD alarm and warning system with Arduino."},"content":{"rendered":"<p><span style=\"color: #000000;\">In the old days, We used to have electronic controllers or PLCs to send the warnings or alarms on the panel by turning combination of\u00a0 light indicators\u00a0 on or off. To understand these signals we have to refer their operation manuals to interpret these messages. For example if they have three indicators on the panel which has Light A(LA), Light B(LB) and Light C(LC),\u00a0 it will be 2^3 =8 combinations of warning\/alarms. To make it easy to understand , they provide us a troubleshooting table to tell operators or technicians to trace the problem.<!--more--><!--more--><!--more--><!--more--><!--more--><\/span><\/p>\n<p><span style=\"color: #000000;\">LA=0, LB=0, LC=0 -&gt; &#8221; Machine OK&#8221; ,<\/span><\/p>\n<p><span style=\"color: #000000;\">LA=1,LB=0, LC=0 -&gt; &#8221; Motor Overload&#8221; ,<\/span><\/p>\n<p><span style=\"color: #000000;\">LA=1, LB=1 ,LC=0 -&gt; &#8220;Motor Overtemperature&#8221;, <\/span><\/p>\n<p><span style=\"color: #000000;\">etc, etc<\/span><\/p>\n<p><span style=\"color: #000000;\">(0 =OFF, 1 =ON) .<\/span><\/p>\n<p><span style=\"color: #000000;\">I am sure such devices or control panels still exists and still be produced today. Sometimes it is not easy to troubleshoot the problem because of missing manuals or any other reasons. For this purpose we will design and\u00a0 build Alarm messaging system using Arduino to retrofit old panels and to convert\u00a0 light bulb\/LED\u00a0 indicators into a LCD display. Here is the example. Let says that we had an old PLC that control the following system (pic1). The ladder diagram showed here\u00a0 just to demonstrate how to manipulate 3 coil or relay outputs. Of course we can build more than 3 outputs when we need it.<br \/>\n<\/span><\/p>\n<p><span style=\"color: #000000;\">.<img loading=\"lazy\" decoding=\"async\" class=\"wp-image-46 aligncenter\" src=\"http:\/\/taptronics.com\/taptronics\/wp-content\/uploads\/2016\/09\/valve-300x169.jpg\" alt=\"valve\" width=\"822\" height=\"463\" srcset=\"http:\/\/taptronics.com\/taptronics\/wp-content\/uploads\/2016\/09\/valve-300x169.jpg 300w, http:\/\/taptronics.com\/taptronics\/wp-content\/uploads\/2016\/09\/valve-768x432.jpg 768w, http:\/\/taptronics.com\/taptronics\/wp-content\/uploads\/2016\/09\/valve-800x450.jpg 800w, http:\/\/taptronics.com\/taptronics\/wp-content\/uploads\/2016\/09\/valve.jpg 960w\" sizes=\"(max-width: 822px) 100vw, 822px\" \/><\/span><\/p>\n<p><span style=\"color: #000000;\">Pic.1<\/span><\/p>\n<p><span style=\"color: #000000;\">The ladder diagram looks like this :<\/span><\/p>\n<p><span style=\"color: #000000;\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-47 aligncenter\" src=\"http:\/\/taptronics.com\/taptronics\/wp-content\/uploads\/2016\/09\/oldladder-300x190.jpg\" alt=\"oldladder\" width=\"802\" height=\"508\" srcset=\"http:\/\/taptronics.com\/taptronics\/wp-content\/uploads\/2016\/09\/oldladder-300x190.jpg 300w, http:\/\/taptronics.com\/taptronics\/wp-content\/uploads\/2016\/09\/oldladder-320x202.jpg 320w, http:\/\/taptronics.com\/taptronics\/wp-content\/uploads\/2016\/09\/oldladder.jpg 745w\" sizes=\"(max-width: 802px) 100vw, 802px\" \/><\/span><\/p>\n<p><span style=\"color: #000000;\">Pic2.<\/span><\/p>\n<p><span style=\"color: #000000;\">Basically, this program tell us to open the\u00a0 valve 5 seconds\u00a0 before turning the centrifugal pump on. When we press &#8220;Xstart&#8221; button,\u00a0 it will open the valve. The Ylight1 will turn on after\u00a0 valve open limit switch (XLSopen)\u00a0 become true. Ylight2 shows the pump is running meanwhile Ylight3 indicate that there is low pressure(XLowPressure) on discharge line.The normal operation should give us Ylight1=1, Ylight2=1 and Ylight3=0. This means valve is fully opened, motor is running and we got normal pressure. Since we can make 8 combinations from these lights, We can convert these states\u00a0 into meaningful messages with Arduino. There is two options to use Arduino for this purpose. The first one is just for converting the state of indicators into messages. Secondly it can be utilized as both PLC and warning\/alarm messages. We will use the later for this example.<\/span><\/p>\n<p><span style=\"color: #000000;\"><strong>Things we need to build this Project:<\/strong><\/span><\/p>\n<ol>\n<li><span style=\"color: #000000;\"><em><strong>Arduino Board.<\/strong><\/em><\/span><\/li>\n<li><span style=\"color: #000000;\"><em><strong>Arduino IDE.<\/strong><\/em><\/span><\/li>\n<li><span style=\"color: #000000;\"><em><strong>LCD display (serial or I2C) with Arduino Library.<\/strong><\/em><\/span><\/li>\n<li><span style=\"color: #000000;\"><em><strong>LDMicro.<\/strong><\/em><\/span><\/li>\n<li><span style=\"color: #000000;\"><em><strong>PHP script to build\u00a0 Arduino Library header (optional).<\/strong><\/em><\/span><\/li>\n<\/ol>\n<h3><span style=\"color: #000000;\">Any Arduino board can be used for this project. All I\/O will be configured using Arduino header. Download LDmicro from this site :<a style=\"color: #000000;\" href=\"http:\/\/cq.cx\/ladder.pl\"><strong> http:\/\/cq.cx\/ladder.pl\u00a0\u00a0<\/strong> <\/a><\/span><\/h3>\n<p><span style=\"color: #000000;\">The beauty of this LDmicro is that we can compile the ladder diagram into ANSI- C code and from this cpp format we can build the library for Arduino IDE. <\/span><\/p>\n<h2><span style=\"color: #000000;\">For PHP script to generate a header we can get it from here : <a style=\"color: #000000;\" href=\"https:\/\/github.com\/ah01\/LDmicro2arduino\">https:\/\/github.com\/ah01\/LDmicro2arduino\u00a0 \u00a0<\/a><\/span><\/h2>\n<p><span style=\"color: #000000;\">Please remember to run php script, we need to install PHP program\u00a0 in our computer. For PHP for windows\u00a0 download the program here : http:\/\/windows.php.net\/download<\/span><\/p>\n<p><span style=\"color: #000000;\">Now Lets modify the ladder diagram from pic1.<\/span><\/p>\n<p><span style=\"color: #000000;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-62\" src=\"http:\/\/taptronics.com\/taptronics\/wp-content\/uploads\/2016\/09\/newladder-300x298.jpg\" alt=\"newladder\" width=\"972\" height=\"966\" srcset=\"http:\/\/taptronics.com\/taptronics\/wp-content\/uploads\/2016\/09\/newladder-300x298.jpg 300w, http:\/\/taptronics.com\/taptronics\/wp-content\/uploads\/2016\/09\/newladder-150x150.jpg 150w, http:\/\/taptronics.com\/taptronics\/wp-content\/uploads\/2016\/09\/newladder.jpg 749w\" sizes=\"(max-width: 972px) 100vw, 972px\" \/><\/span><\/p>\n<p><span style=\"color: #000000;\">When we look at new ladder diagram, there are some changes and\u00a0 some rungs additions which have accumulator instruction (Acc ) inserted to them. These four extra rungs actually to convert binary status into decimal, Binary Coded Decimal (BCD). From three coil status, we can generate 8 messages.<\/span><\/p>\n<p><span style=\"color: #000000;\">Save this ladder diagram as ladder.ld ( we can choose any name for this file). Next step is to choose a microprocessor. On &#8220;Setting&#8221;-&gt;&#8221;Microcontrollers&#8221; , choose ANSI-C code. Then\u00a0 go to &#8220;Compile&#8221; -&gt;&#8221;Compile as&#8230; &#8221; and save it as ladder.cpp. Click OK and it will shows :<\/span><\/p>\n<p><span style=\"color: #000000;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-66\" src=\"http:\/\/taptronics.com\/taptronics\/wp-content\/uploads\/2016\/09\/error-300x137.jpg\" alt=\"error\" width=\"434\" height=\"198\" srcset=\"http:\/\/taptronics.com\/taptronics\/wp-content\/uploads\/2016\/09\/error-300x137.jpg 300w, http:\/\/taptronics.com\/taptronics\/wp-content\/uploads\/2016\/09\/error.jpg 494w\" sizes=\"(max-width: 434px) 100vw, 434px\" \/><\/span><\/p>\n<p><span style=\"color: #000000;\">Don&#8217;t worry about this warning. Like it said on pop-up window, this is not complete program so we have to build header by itself.\u00a0 C\/C++ programming skills is not really needed. Just use this cpp together with header we are going to build to create a library to be used in Arduino IDE.<\/span><\/p>\n<p><span style=\"color: #000000;\">Now It is time to build a header(Ladder.h) The header below built using ladder-gen.php ( see\u00a0 previous link above to download it). Follow instruction there how to run and to build a header for Arduino. We can see that all I\/O pins fo Arduino\u00a0 can be configured here.<br \/>\n<\/span><\/p>\r\n\t<div class='easycodebox  ' id='easycodebox-1'>\r\n\t<div class='headbar' onclick='EasyCodeClass(this).ShowCode();'  title=\"Click here to show\/hide the code.\"> ladder.h<\/div>\r\n\t<div class='flex-box'>\r\n\t<div class='scrollbox'  ondblclick=\"EasyCodeClass(this).editCode(1);\">\r\n\t<div class='ecside'>&nbsp;<\/div>\r\n\t<div class='main'><ol>\n<li>\u00a0#ifndef\u00a0LADDER_H<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0#define\u00a0LADDER_H<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0#if\u00a0ARDUINO\u00a0&gt;=\u00a0100<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0#include\u00a0\"Arduino.h\"<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0#else<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0#include\u00a0\"WProgram.h\"<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0#endif<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0#define\u00a0BOOL\u00a0boolean<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0#define\u00a0SWORD\u00a0int<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0#define\u00a0EXTERN_EVERYTHING<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0#define\u00a0NO_PROTOTYPES<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0EXTERN\u00a0INT\u00a0U_i_arduino;<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0void\u00a0PlcCycle(void);<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0\/*\u00a0Configure\u00a0digital\u00a0I\/O\u00a0according\u00a0to\u00a0LD\u00a0(call\u00a0this\u00a0in\u00a0setup()).\u00a0*\/<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0inline\u00a0void\u00a0PlcSetup()<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0{<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0pinMode(11,\u00a0INPUT);<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0pinMode(12,\u00a0INPUT);<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0pinMode(5,\u00a0OUTPUT);<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0pinMode(9,\u00a0INPUT);<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0pinMode(6,\u00a0OUTPUT);<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0pinMode(10,\u00a0INPUT);<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0}<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0\/*\u00a0Individual\u00a0pins\u00a0(this\u00a0code\u00a0is\u00a0used\u00a0in\u00a0ladder.cpp)\u00a0*\/<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0inline\u00a0extern\u00a0BOOL\u00a0Read_U_b_XSTART(void)<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0{<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0return\u00a0digitalRead(11);<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0}<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0inline\u00a0extern\u00a0BOOL\u00a0Read_U_b_XSTOP(void)<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0{<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0return\u00a0digitalRead(12);<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0}<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0inline\u00a0BOOL\u00a0Read_U_b_YValve(void)<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0{<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0return\u00a0digitalRead(5);<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0}<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0inline\u00a0void\u00a0Write_U_b_YValve(BOOL\u00a0v)<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0{<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0digitalWrite(5,\u00a0v);<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0}<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0inline\u00a0extern\u00a0BOOL\u00a0Read_U_b_XLSopen(void)<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0{<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0return\u00a0digitalRead(9);<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0}<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0inline\u00a0extern\u00a0BOOL\u00a0Read_U_b_XOverload(void)<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0{<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0\/\/\u00a0TODO<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0}<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0inline\u00a0BOOL\u00a0Read_U_b_Ymotor(void)<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0{<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0return\u00a0digitalRead(6);<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0}<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0inline\u00a0void\u00a0Write_U_b_Ymotor(BOOL\u00a0v)<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0{<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0digitalWrite(6,\u00a0v);<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0}<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0inline\u00a0extern\u00a0BOOL\u00a0Read_U_b_XLowPressure(void)<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0{<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0return\u00a0digitalRead(10);<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0}<\/li>\n<li>    #endif<\/li>\n<li><\/span><\/span><\/li><\/ol><\/div>\r\n\t<\/div><\/div><\/div><p>&nbsp;<\/p>\n<p><span style=\"color: #0000ff;\">To write an Arduino sketch, the first step is to create a new folder. Name it as &#8220;Ladder&#8221; and put both ladder.cpp and ladder.h inside this folder. Copy or move it into Dir:\/\/Path\/to\/Arduino\/libraries.<\/span><\/p>\n<p><span style=\"color: #0000ff;\">It &#8216;s time to write an interesting sketch in Arduino IDE.<\/span><\/p>\r\n\t<div class='easycodebox  ' id='easycodebox-2'>\r\n\t<div class='headbar' onclick='EasyCodeClass(this).ShowCode();'  title=\"Click here to show\/hide the code.\"> Ladder.ino<\/div>\r\n\t<div class='flex-box'>\r\n\t<div class='scrollbox'  ondblclick=\"EasyCodeClass(this).editCode(1);\">\r\n\t<div class='ecside'>&nbsp;<\/div>\r\n\t<div class='main'><ol>\n<li>#define\u00a0_Digole_Serial_UART_<\/li>\n<li>#include\u00a0\"DigoleSerial.h\"<\/li>\n<li>DigoleSerialDisp\u00a0mydisp(&amp;Serial1,\u00a09600);<\/li>\n<li>#include\u00a0\"ladder.h\"<\/li>\n<li>\/*\u00a0Plc\u00a0cycle\u00a0interval,\u00a0set\u00a0this\u00a0according\u00a0to\u00a0LDmicro\u00a0settings.\u00a0(micro\u00a0sec.)\u00a0*\/<\/li>\n<li>#define\u00a0PLC_INTERVAL\u00a010000<\/li>\n<li>#define\u00a0LCDCol\u00a016<\/li>\n<li>#define\u00a0LCDRow\u00a02<\/li>\n<li>int\u00a0ptr;<\/li>\n<li>const\u00a0char\u00a0a[]\u00a0=\u00a0\"Arduino\u00a0PLC\";<\/li>\n<li>void\u00a0setup()<\/li>\n<li>{<\/li>\n<li>\u00a0\u00a0\u00a0<\/li>\n<li>\u00a0\u00a0mydisp.begin();\u00a0<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0mydisp.clearScreen();<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0mydisp.disableCursor();\u00a0\/\/disable\u00a0cursor,\u00a0enable\u00a0cursore\u00a0use:\u00a0enableCursor();<\/li>\n<li>\u00a0\u00a0\/\/\u00a0\u00a0mydisp.drawStr(4,\u00a00,\u00a0\"Testing\");<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0mydisp.setPrintPos(2,\u00a00);<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0mydisp.print(a);\u00a0\/\/\u00a0display\u00a0a\u00a0char\u00a0array<\/li>\n<li>\u00a0\u00a0\/\/\u00a0\u00a0resetpos();<\/li>\n<li>\u00a0\u00a0\u00a0{<\/li>\n<li>\u00a0\u00a0\u00a0<\/li>\n<li>\u00a0\u00a0PlcSetup();<\/li>\n<li>}<\/li>\n<li>}<\/li>\n<li>void\u00a0loop()<\/li>\n<li>{<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0if\u00a0(IsPlcInterval())<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0{<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0PlcCycle();<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0switch\u00a0(U_i_alarm)\u00a0{<\/li>\n<li>\u00a0\u00a0case\u00a00:<\/li>\n<li>\u00a0\u00a0\u00a0mydisp.drawStr(4,\u00a01,\u00a0\"Valve\u00a0closed\");<\/li>\n<li>\u00a0 break;<\/li>\n<li>\u00a0\u00a0case\u00a01:<\/li>\n<li>\u00a0\u00a0mydisp.drawStr(4,\u00a01,\u00a0\"Valve\u00a0opened\u00a0\u00a0\u00a0\");<\/li>\n<li>\u00a0\u00a0break;<\/li>\n<li>\u00a0\u00a0case\u00a02:<\/li>\n<li>\u00a0\u00a0mydisp.drawStr(4,\u00a01,\u00a0\"Check\u00a0if\u00a0valve\u00a0is\u00a0OK\u00a0?\u00a0\u00a0\u00a0\");<\/li>\n<li>\u00a0\u00a0break;<\/li>\n<li>\u00a0\u00a0case\u00a03:<\/li>\n<li>\u00a0\u00a0mydisp.drawStr(4,\u00a01,\u00a0\"Pump and Valve\u00a0OK\u00a0\u00a0\u00a0\");<\/li>\n<li>\u00a0break;\u00a0<\/li>\n<li>\u00a0case\u00a04:<\/li>\n<li>\u00a0\u00a0mydisp.drawStr(4,\u00a01,\u00a0\"Low\u00a0Pressure\u00a0,\u00a0Valve and Pump\u00a0off\u00a0\u00a0\u00a0\");<\/li>\n<li>\u00a0\u00a0break;<\/li>\n<li>\u00a0\u00a0case\u00a05:<\/li>\n<li>\u00a0\u00a0mydisp.drawStr(4,\u00a01,\u00a0\"Low\u00a0pressure\u00a0,\u00a0check Pump!\u00a0\u00a0\u00a0\");<\/li>\n<li>\u00a0break;\u00a0<\/li>\n<li>\u00a0\u00a0case\u00a06:<\/li>\n<li>\u00a0\u00a0mydisp.drawStr(4,\u00a01,\u00a0\"Low\u00a0pressure\u00a0,\u00a0check\u00a0Valve!\u00a0\u00a0\u00a0\u00a0\");<\/li>\n<li>\u00a0break;\u00a0<\/li>\n<li>\u00a0case\u00a07:<\/li>\n<li>\u00a0\u00a0mydisp.drawStr(4,\u00a01,\u00a0\"Low\u00a0pressure\u00a0,\u00a0check\u00a0the\u00a0line\/leak\u00a0\u00a0\u00a0\");<\/li>\n<li>\u00a0break;\u00a0\u00a0\u00a0\u00a0\u00a0<\/li>\n<li>\u00a0}<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0}<\/li>\n<li>}<\/li>\n<li>\/*\u00a0Plc\u00a0Cycle\u00a0timing\u00a0function.\u00a0*\/<\/li>\n<li>boolean\u00a0IsPlcInterval()<\/li>\n<li>{<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0static\u00a0unsigned\u00a0long\u00a0last_run;<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0if\u00a0(micros()\u00a0-\u00a0last_run\u00a0&gt;=\u00a0PLC_INTERVAL)<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0{<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0last_run\u00a0=\u00a0micros();<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return\u00a0true;<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0}<\/li>\n<li>\u00a0\u00a0\u00a0\u00a0return\u00a0false;<\/li>\n<li>}<\/span><\/li><\/ol><\/div>\r\n\t<\/div><\/div><\/div><p>&nbsp;<\/p>\n<p><span style=\"color: #000000;\">In the example above we use Digole serial LCD to display the messages. The good thing about\u00a0 LDmicro is that it much easier to create ladder program\u00a0 and then modify in the future with no change or few change in Arduino sketch itself. As long we have same numbers of I\/O pins we don&#8217;t need generate a new header, what we need is\u00a0 just to compile a new ladder (\u00a0 newladder.ld)\u00a0 and to save it as\u00a0 newladder. cpp then to copy it to an arduino library folder.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the old days, We used to have electronic controllers or PLCs to send the warnings or alarms on the panel by turning combination of\u00a0 light indicators\u00a0 on or off. To understand these signals we have to refer their operation manuals to interpret these messages. For example if they have three indicators on the panel &hellip; <a href=\"http:\/\/taptronics.com\/taptronics\/convert-light-bulb-control-panel-into-lcd-alarm-and-warning-system-with-arduino\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Convert legacy control panel into  LCD alarm and warning system with Arduino.<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/taptronics.com\/taptronics\/wp-json\/wp\/v2\/posts\/43"}],"collection":[{"href":"http:\/\/taptronics.com\/taptronics\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/taptronics.com\/taptronics\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/taptronics.com\/taptronics\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/taptronics.com\/taptronics\/wp-json\/wp\/v2\/comments?post=43"}],"version-history":[{"count":35,"href":"http:\/\/taptronics.com\/taptronics\/wp-json\/wp\/v2\/posts\/43\/revisions"}],"predecessor-version":[{"id":141,"href":"http:\/\/taptronics.com\/taptronics\/wp-json\/wp\/v2\/posts\/43\/revisions\/141"}],"wp:attachment":[{"href":"http:\/\/taptronics.com\/taptronics\/wp-json\/wp\/v2\/media?parent=43"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/taptronics.com\/taptronics\/wp-json\/wp\/v2\/categories?post=43"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/taptronics.com\/taptronics\/wp-json\/wp\/v2\/tags?post=43"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}