⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 intro.lyx

📁 CNC 的开放码,EMC2 V2.2.8版
💻 LYX
📖 第 1 页 / 共 2 页
字号:
iocontrol\begin_inset LatexCommand \index{iocontrol}\end_inset  A user space module that accepts NML I/O commands and interacts with HAL \layout Descriptionclassicladder\begin_inset LatexCommand \index{ClassicLadder}\end_inset  A PLC using HAL for all I/O\layout Descriptionhalui\begin_inset LatexCommand \index{halui}\end_inset  A user space program that interacts with HAL and sends NML commands, it is intended to work as a full User Interface using external knobs & switches \layout Subsection\begin_inset LatexCommand \label{sub:InternalComponents}\end_inset Internal Components\layout Descriptionstepgen\begin_inset LatexCommand \index{stepgen}\end_inset  Software step pulse generator with position loop. See section \begin_inset LatexCommand \ref{sec:Stepgen}\end_inset \layout Descriptionencoder\begin_inset LatexCommand \index{encoder}\end_inset  Software based encoder counter. See section \begin_inset LatexCommand \ref{sec:Encoder}\end_inset \layout Descriptionpid\begin_inset LatexCommand \index{pid}\end_inset  Proportional/Integral/Derivative control loops. See section \begin_inset LatexCommand \ref{sec:PID}\end_inset \layout Descriptionsiggen\begin_inset LatexCommand \index{siggen}\end_inset  A sine/cosine/triangle/square wave generator for testing. See section \begin_inset LatexCommand \ref{sec:Siggen}\end_inset \layout Descriptionsupply\begin_inset LatexCommand \index{supply}\end_inset  a simple source for testing\layout Descriptionblocks\begin_inset LatexCommand \index{blocks}\end_inset  assorted useful components (mux, demux, or, and, integ, ddt, limit, wcomp, etc.)\layout Subsection\begin_inset LatexCommand \label{sub:HardwareDrivers}\end_inset Hardware Drivers\layout Descriptionhal_ax5214h\begin_inset LatexCommand \index{hal-ax5214h}\end_inset  A driver for the Axiom Measurement & Control AX5241H digital I/O board\layout Descriptionhal_m5i20\begin_inset LatexCommand \index{hal-m5i20}\end_inset  Mesa Electronics 5i20 board\layout Descriptionhal_motenc\begin_inset LatexCommand \index{hal-motenc}\end_inset  Vital Systems MOTENC-100 board\layout Descriptionhal_parport\begin_inset LatexCommand \index{hal-parport}\end_inset  PC parallel port. See section \begin_inset LatexCommand \ref{sec:Parport}\end_inset \layout Descriptionhal_ppmc\begin_inset LatexCommand \index{hal-ppmc}\end_inset  Pico Systems family of controllers (PPMC, USC and UPC)\layout Descriptionhal_stg\begin_inset LatexCommand \index{hal-stg}\end_inset  Servo To Go card (version 1 & 2)\layout Descriptionhal_vti\begin_inset LatexCommand \index{hal-vti}\end_inset  Vigilant Technologies PCI ENCDAC-4 controller\layout Subsection\begin_inset LatexCommand \label{sub:ToolsUtilities}\end_inset Tools and Utilities\layout Descriptionhalcmd\begin_inset LatexCommand \index{halcmd}\end_inset  Command line tool for configuration and tuning. See section \begin_inset LatexCommand \ref{sec:Halcmd}\end_inset  \layout Descriptionhalgui GUI tool for configuration and tuning (not implemented yet).\layout Descriptionhalmeter\begin_inset LatexCommand \index{halmeter}\end_inset  A handy multimeter for HAL signals. See section \begin_inset LatexCommand \ref{sec:Halmeter}\end_inset \layout Descriptionhalscope\begin_inset LatexCommand \index{halscope}\end_inset  A full featured digital storage oscilloscope for HAL signals. See section \begin_inset LatexCommand \ref{sec:Halscope}\end_inset \layout StandardEach of these building blocks is described in detail in later chapters. \layout Section\begin_inset LatexCommand \label{sec:Tinkertoys}\end_inset Tinkertoys, Erector Sets, Legos and the HAL\layout StandardA first introduction to HAL concepts can be mind boggling. Building anything with blocks can be a challenge but some of the toys that we played with as kids can be an aid to building things with the HAL.\layout SubsectionTower\layout QuoteI'm watching as my son and his six year old daughter build a tower from a box full of random sized blocks, rods, jar lids and such. The aim is to see how tall they can make the tower. The narrower the base the more blocks left to stack on top. But the narrower the base, the less stable the tower. I see them studying both the next block and the shelf where they want to place it to see how it will balance out with the rest of the tower. \layout StandardThe notion of stacking cards to see how tall you can make a tower is a very old and honored way of spending spare time. At first read, the integrator may have gotten the impression that building a HAL was a bit like that. It can be but with proper planning an integrator can build a stable system as complex as the machine at hand requires. \layout SubsectionErector Sets\begin_inset Footcollapsed false\layout StandardThe Erector Set was an invention of AC Gilbert\end_inset \layout StandardWhat was great about the sets was the building blocks, metal struts and angles and plates, all with regularly spaced holes. You could design things and hold them together with the little screws and nuts. \layout QuoteI got my first erector set for my fourth birthday. I know the box suggested a much older age than I was. Perhaps my father was really giving himself a present. I had a hard time with the little screws and nuts. I really needed four arms, one each for the screwdriver, screw, parts to be bolted together, and nut. Perseverence, along with father's eventual boredom, got me to where I had built every project in the booklet. Soon I was lusting after the bigger sets that were also printed on that paper. Working with those regular sized pieces opened up a world of construction for me and soon I moved well beyond the illustrated projects. \layout StandardHal components are not all the same size and shape but they allow for grouping into larger units that will do useful work.In this sense they are like the parts of an Erector set. Some components are long and thin. They essentially connect high level commands to specific physical pins. Other components are more like the rectangular platforms upon which whole machines could be built. An integrator will quickly get beyond the brief examples and begin to bolt together components in ways that are unique to them.\layout SubsectionTinkertoys\begin_inset Footcollapsed false\layout StandardTinkertoy is now a registered trademark of the Hasbro company.\end_inset \layout QuoteWooden Tinker toys had a more humane feel that the cold steel of Erector Sets. The heart of construction with Tinker Toys was a round connector with eight holes equally spaced around the circumference. It also had a hole in the center that was perpendicular to all the holes around the hub.\layout QuoteHubs were connected with rods of several different lengths. Builders would make large wheels by using these rods as spokes sticking out from the center hub. \layout QuoteMy favorite project was a rotating space station. Short spokes radiated from all the holes in the center hub and connected with hubs on the ends of each spoke. These outer hubs were connected to each other with longer spokes. I'd spend hours dreaming of living in such a device, walking from hub to hub around the outside as it slowly rotated producing near gravity in weightless space. Supplies traveled through the spokes in elevators that transfered them to an from rockets docked at the center hub while they transfered their precious cargos.\layout StandardThe idea of one pin or component being the hub for many connections is also an easy concept within the HAL. Examples two and four (see section \begin_inset LatexCommand \ref{cha:HAL-Tutorial}\end_inset ) connect the meter and scope to signals that are intended to go elsewhere. Less easy is the notion of a hub for several incoming signals but that is also possible with proper use of functions within that hub component that handle those signals as they arrive from other components.\layout StandardAnother thought that comes forward from this toy is a mechanical representation of HAL threads. A thread might look a bit like a centipede, caterpillar, or earwig. A backbone of hubs, HAL components, strung together with rods, HAL signals. Each component takes in it own parameters and input pins and passes on output pins and parameters to the next component. Signals travel along the backbone from end to end and are added to or modified by each component in turn. \layout StandardThreads are all about timing and doing a set of tasks from end to end. A mechanical representation is available with Tinkertoys also when we think of the length of the toy as a measure of the time taken to get from one end to the other. A very different thread or backbone is created by connecting the same set of hubs with different length rods. The total length of the backbone can be changed by the length of rods used to connect the hubs. The order of operations is the same but the time to get from beginning to end is very diferent. \layout Subsection\begin_inset LatexCommand \label{sub:A-Lego-Example}\end_inset A Lego Example\begin_inset Footcollapsed true\layout StandardThe Lego name is a trademark of the Lego company. \end_inset \layout StandardWhen Lego blocks first arrived in our stores they were pretty much all the same size and shape. Sure there were half sized one and a few quarter sized as well but that rectangular one did most of the work. Lego blocks interconnected by snapping the holes in the underside of one onto the pins that stuck up on another. By overlapping layers, the joints between could be made very strong, even around corners or tees. \layout QuoteI watched my children and grandchildren build with legos -- the same legos. There are a few thousand of them in an old ratty but heavy duty cardboard box that sits in a corner of the recreation room. It stays there in the open because it was too much trouble to put the box away and then get it back out for every visit and it is always used during a visit. There must be Lego parts in there from a couple dozen different sets. The little booklets that came with them are long gone but the magic of building with interlocking pieces all the same size is something to watch. \layout Section\begin_inset LatexCommand \label{sec:Timing-Issues}\end_inset Timing Issues In HAL\layout StandardUnlike the physical wiring models between black boxes that we have said that HAL is based upon, simply connecting two pins with a hal-signal falls far short of the action of the physical case. \layout StandardTrue relay logic consists of relays connected together, and when a contact opens or closes, current flows (or stops) immediately. Other coils may change state, etc, and it all just "happens". But in PLC style ladder logic, it doesn't work that way. Usually in a single pass through the ladder, each rung is evaluated in the order in which it appears, and only once per pass. A perfect example is a single rung ladder, with a NC contact in series with a coil. The contact and coil belong to the same relay. \layout StandardIf this were a conventional relay, as soon as the coil is energized, the contacts begin to open and de-energize it. That means the contacts close again, etc, etc. The relay becomes a buzzer.\layout StandardWith a PLC, if the coil is OFF and the contact is closed when the PLC begins to evaluate the rung, then when it finishes that pass, the coil is ON. The fact that turning on the coil opens the contact feeding it is ignored until the next pass. On the next pass, the PLC sees that the contact is open, and de-energizes the coil. So the relay still switches rapidly between on and off, but at a rate determined by how often the PLC evaluates the rung. \layout StandardIn HAL, the function is the code that evaluates the rung(s). In fact, the HAL-aware realtime version of ClassicLadder exports a function to do exactly that. Meanwhile, a thread is the thing that runs the function at specific time intervals. Just like you can choose to have a PLC evaluate all its rungs every 10mS, or every second, you can define HAL threads with different periods.\layout StandardWhat distinguishes one thread from another is \emph on not\emph default  what the thread does - that is determined by which functions are connected to it. The real distinction is simply how often a thread runs.\layout StandardIn EMC you might have a 50\begin_inset Formula $\mu$\end_inset s thread and a 1ms thread. These would be created baseds on BASE_PERIOD and SERVO_PERIOD--the actual times depend on the ini.\layout StandardThe next step is to decide what each thread needs to do. Some of those decisions are the same in (nearly) any emc system--For instance, motion-command-handler is always added to servo-thread.\layout StandardOther connections would be made by the integrator. These might include hooking the STG driver's encoder read and DAC write functions to the servo thread, or hooking stepgen's function to the base-thread, along with the parport function(s) to write the steps to the port.\the_end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -