<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Embedded Systems on Michael-F-Bryan</title><link>https://adventures.michaelfbryan.com/tags/embedded-systems/</link><description>Recent content in Embedded Systems on Michael-F-Bryan</description><generator>Hugo</generator><language>en</language><lastBuildDate>Wed, 26 Aug 2026 15:15:33 +0800</lastBuildDate><atom:link href="https://adventures.michaelfbryan.com/tags/embedded-systems/index.xml" rel="self" type="application/rss+xml"/><item><title>Implementing ArrayVec Using Const Generics</title><link>https://adventures.michaelfbryan.com/posts/const-arrayvec/</link><pubDate>Fri, 15 Nov 2019 00:57:00 +0800</pubDate><guid>https://adventures.michaelfbryan.com/posts/const-arrayvec/</guid><description>&lt;p&gt;If you&amp;rsquo;ve ever done much embedded programming in Rust, you&amp;rsquo;ve most probably run&#10;across the &lt;a href="https://crates.io/crates/arrayvec" class="external-link" target="_blank" rel="noopener"&gt;&lt;code&gt;arrayvec&lt;/code&gt;&lt;/a&gt;&#10; crate before. It&amp;rsquo;s awesome. The main purpose&#10;of the crate is to provide the &lt;code&gt;ArrayVec&lt;/code&gt; type, which is essentially like&#10;&lt;code&gt;Vec&amp;lt;T&amp;gt;&lt;/code&gt; from the standard library, but backed by an array instead of some&#10;memory on the heap.&lt;/p&gt;&#10;&lt;p&gt;One of the problems I ran into while writing the &lt;em&gt;Motion Planning&lt;/em&gt; chapter of my&#10;&lt;a href="http://adventures.michaelfbryan.com/tags/adventures-in-motion-control/" class="external-link" target="_blank" rel="noopener"&gt;Adventures in Motion Control&lt;/a&gt;&#10; was deciding how far ahead my motion&#10;planner should plan.&lt;/p&gt;</description></item><item><title>Initial Motion System</title><link>https://adventures.michaelfbryan.com/posts/initial-motion-system/</link><pubDate>Wed, 18 Sep 2019 20:00:00 +0800</pubDate><guid>https://adventures.michaelfbryan.com/posts/initial-motion-system/</guid><description>&lt;p&gt;Now we&amp;rsquo;ve got &lt;a href="https://adventures.michaelfbryan.com/posts/simple-automation-sequences/#the-next-step"&gt;some simple automation&lt;/a&gt;&#10; code, lets start a proper&#10;&lt;em&gt;Motion&lt;/em&gt; system.&lt;/p&gt;&#10;&lt;p&gt;Most &lt;em&gt;Motion&lt;/em&gt; systems are designed around a &lt;em&gt;&amp;ldquo;control mode&amp;rdquo;&lt;/em&gt;, a fancy term for&#10;&lt;em&gt;&amp;ldquo;what is the machine doing right now?&amp;rdquo;&lt;/em&gt; Common control modes are:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;Idle&lt;/code&gt; - the default control mode, machines revert to &lt;code&gt;Idle&lt;/code&gt; whenever they&amp;rsquo;re&#10;not doing anything&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;Automation&lt;/code&gt; - running an automation sequence&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;Recipe&lt;/code&gt; - executing a job (a set of instructions for how to execute a job&#10;and the motion parameters that should be used is often referred to as a&#10;&lt;em&gt;Recipe&lt;/em&gt;)&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;Manual&lt;/code&gt; - manual movement, where velocity may be controlled via a handset&#10;or the user invokes a &lt;em&gt;&amp;ldquo;jog to position&amp;rdquo;&lt;/em&gt; function&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;There are several ways to transition between control modes.&lt;/p&gt;</description></item><item><title>Simple Automation Sequences</title><link>https://adventures.michaelfbryan.com/posts/simple-automation-sequences/</link><pubDate>Sat, 14 Sep 2019 23:55:00 +0800</pubDate><guid>https://adventures.michaelfbryan.com/posts/simple-automation-sequences/</guid><description>&lt;p&gt;Now we can communicate with the outside world, let&amp;rsquo;s start interacting with the&#10;&amp;ldquo;hardware&amp;rdquo; attached to our motion controller. This will be the beginning of our&#10;&lt;em&gt;Motion&lt;/em&gt; system.&lt;/p&gt;&#10;&lt;p&gt;The simplest way to interact with the world is by executing a pre-defined&#10;routine, and one of the simplest useful routines is to move all axes to the&#10;home position.&lt;/p&gt;&#10;&lt;h2 id="system-inputs-and-outputs"&gt;&#10; System Inputs and Outputs&#10; &lt;a class="heading-link" href="#system-inputs-and-outputs"&gt;&#10; &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;&#10; &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;&#10; &lt;/a&gt;&#10;&lt;/h2&gt;&#10;&lt;p&gt;From our &lt;a href="https://adventures.michaelfbryan.com/posts/announcing-adventures-in-motion-control/#identifying-requirements-and-subsystems"&gt;initial requirements gathering&lt;/a&gt;&#10; we know that our 3D&#10;printer will have three linear axes (X, Y, and Z), with limit switches at the&#10;ends of each axis. This gives our new &lt;em&gt;Motion&lt;/em&gt; system six inputs to deal with.&lt;/p&gt;</description></item><item><title>The Communications System: Part 1</title><link>https://adventures.michaelfbryan.com/posts/comms-part-1/</link><pubDate>Fri, 06 Sep 2019 23:00:00 +0800</pubDate><guid>https://adventures.michaelfbryan.com/posts/comms-part-1/</guid><description>&lt;h2 id="prelude"&gt;&#10; Prelude&#10; &lt;a class="heading-link" href="#prelude"&gt;&#10; &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;&#10; &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;&#10; &lt;/a&gt;&#10;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;em&gt;Communications&lt;/em&gt; system is arguably one of the most important parts of&#10;our simulator. After all, it&amp;rsquo;s kinda hard to debug a program when you can&amp;rsquo;t&#10;ask it why something isn&amp;rsquo;t working.&lt;/p&gt;&#10;&lt;p&gt;The user will interact with our simulated motion controller via a single&#10;&lt;em&gt;Serial Port&lt;/em&gt;, which we&amp;rsquo;ll be modelling as a simple thing which sends and&#10;receives bytes. Serial ports are a fairly old technology, and have several&#10;drawbacks compared to the Ethernet and TCP protocols that most programmers&#10;are familiar with.&lt;/p&gt;</description></item><item><title>Top-Level Infrastructure</title><link>https://adventures.michaelfbryan.com/posts/top-level-infrastructure/</link><pubDate>Mon, 02 Sep 2019 21:22:30 +0800</pubDate><guid>https://adventures.michaelfbryan.com/posts/top-level-infrastructure/</guid><description>&lt;p&gt;As mentioned in &lt;a href="https://adventures.michaelfbryan.com/posts/announcing-adventures-in-motion-control/#the-next-step"&gt;the intro article&lt;/a&gt;&#10;, the first task will be to set&#10;up the application&amp;rsquo;s structure and define how the various components will&#10;communicate.&lt;/p&gt;&#10;&lt;h2 id="multitasking"&gt;&#10; Multitasking&#10; &lt;a class="heading-link" href="#multitasking"&gt;&#10; &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;&#10; &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;&#10; &lt;/a&gt;&#10;&lt;/h2&gt;&#10;&lt;p&gt;Most embedded systems will implement multi-tasking by rapidly polling each&#10;system within an infinite loop.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-rust" data-lang="rust"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;loop&lt;/span&gt; {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; poll_comms();&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; poll_motion_planning();&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; poll_io();&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; poll_machine_events();&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A motion controller will normally spend most of its time polling, but there are&#10;places where polling isn&amp;rsquo;t appropriate. For example, accurate movement of a&#10;stepper motor relies on sending pulses at very precise times. Another scenario&#10;is in the handling of communication, where waiting for the next poll to read a&#10;byte may result in missing part of a message.&lt;/p&gt;</description></item><item><title>Announcing Adventures in Motion Control</title><link>https://adventures.michaelfbryan.com/posts/announcing-adventures-in-motion-control/</link><pubDate>Sun, 01 Sep 2019 16:27:15 +0800</pubDate><guid>https://adventures.michaelfbryan.com/posts/announcing-adventures-in-motion-control/</guid><description>&lt;p&gt;This is the first installation in my &lt;em&gt;Adventures in Motion Control&lt;/em&gt; series.&lt;/p&gt;&#10;&lt;p&gt;At &lt;code&gt;$JOB&lt;/code&gt; we build industrial CNC machines, and while developing a simulator&#10;for our machines I noticed a distinct lack of online resources on how&#10;they work under the hood. Hopefully this series will address the situation.&lt;/p&gt;&#10;&lt;h2 id="the-goal"&gt;&#10; The Goal&#10; &lt;a class="heading-link" href="#the-goal"&gt;&#10; &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;&#10; &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;&#10; &lt;/a&gt;&#10;&lt;/h2&gt;&#10;&lt;p&gt;The goal for this series is to develop a simulator which will accurately reflect&#10;how an embedded motion controller is implemented internally.&lt;/p&gt;</description></item></channel></rss>