{"id":563,"date":"2020-04-08T09:30:35","date_gmt":"2020-04-08T09:30:35","guid":{"rendered":"http:\/\/www.chatrail.com\/?page_id=563"},"modified":"2020-04-23T08:23:43","modified_gmt":"2020-04-23T08:23:43","slug":"dcc-dmx","status":"publish","type":"page","link":"http:\/\/www.chatrail.com\/index.php\/dcc-dmx\/","title":{"rendered":"DCC &#038; DMX CONTROL"},"content":{"rendered":"\n<p class=\"has-text-align-right\"><img class=\"wp-image-929\" style=\"height:36px\" src=\"https:\/\/uk.farnell.com\/productimages\/promo\/en_GB\/2007062.jpg\" alt=\"\"> <img class=\"wp-image-928\" style=\"width: 64px;\" src=\"https:\/\/www.microchip.com\/images\/default-source\/mplab\/mplab-x-whats-new-feeds\/190405-dvtl-graph-xide-200x200.png?sfvrsn=126abce0_1\" style=\"height: 56px\" alt=\"\"> <img class=\"wp-image-928\" style=\"width: 64px;\" src=\"http:\/\/www.chatrail.com\/wp-content\/uploads\/2020\/04\/arduino-64.png\" alt=\"\"><\/p>\n\n\n\n<p><p style=\"text-align: justify;\">More of a hobby project that was originally written 20 years ago in C using MPLAB and more recently updated to C++. The original code (a state machine driven from hardware interrupts) ran on a PIC16F driving a full H-Bridge to realise an NMRA compatible DCC (Digital Command Control) locomotive decoder.  <\/p><\/p>\n\n\n\n<p><p style=\"text-align: justify;\">A few years later I got involved with an amateur dramatics group where I helped them update their lighting to DMX512 and saw the opportunity to master another single master multi slave protocol.<\/p><\/p>\n\n\n\n<p><p style=\"text-align: justify;\">Stage lights and model trains don&#8217;t initially look like easy partners but they are both primarily receive, state-driven serial protocols and it was fun to see if I could use class abstraction to have a single code base driving both projects spanning three protocols (<em>NMRA DCC, Hornby Zero-1 and DMX 512<\/em>). Was it overkill? Possibly, but what are hobbies for if not to indulge in an idea or two.<\/p><\/p>\n\n\n\n<p><em>TO DO: Add state diagram and hardware block schematics. <\/em><\/p>\n\n\n\n<p><p style=\"text-align: justify;\">In another little railway project, I used a couple of 16 channel relay boards and a chain of half a dozen 74595s all linked to an Arduino Nano to automate a display layout. Two of the 595&#8217;s drive reed switches with one end connected via steering diodes to a GPIO having a mapped interrupt handler to make a 16 column, single row &#8216;keyboard matrix&#8217;. &#8216;Inputs from outputs&#8217;, neat! To get the scanning performance I needed the SPI hardware built into the AVR chip drives the 595 chain, although not a true SPI application it works a dream. The AVR only has one SPI interface so a 2 line LCD was linked using I2C to give user feedback.<\/p><\/p>\n\n\n\n<p><em>TO DO: include a photo of the controller.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>More of a hobby project that was originally written 20 years ago in C using MPLAB and more recently updated to C++. The original code (a state machine driven from hardware interrupts) ran on a PIC16F driving a full H-Bridge to realise an NMRA compatible DCC (Digital Command Control) locomotive decoder. A few years later [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"http:\/\/www.chatrail.com\/index.php\/wp-json\/wp\/v2\/pages\/563"}],"collection":[{"href":"http:\/\/www.chatrail.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/www.chatrail.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/www.chatrail.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.chatrail.com\/index.php\/wp-json\/wp\/v2\/comments?post=563"}],"version-history":[{"count":22,"href":"http:\/\/www.chatrail.com\/index.php\/wp-json\/wp\/v2\/pages\/563\/revisions"}],"predecessor-version":[{"id":1086,"href":"http:\/\/www.chatrail.com\/index.php\/wp-json\/wp\/v2\/pages\/563\/revisions\/1086"}],"wp:attachment":[{"href":"http:\/\/www.chatrail.com\/index.php\/wp-json\/wp\/v2\/media?parent=563"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}