HAL Manual V2.5, 2018-10-21 I

HAL Manual V2.5, 2018-10-21 I

HAL Manual V2.5, 2018-10-21 i HAL Manual V2.5, 2018-10-21 HAL Manual V2.5, 2018-10-21 ii Contents I Hardware Abstract Layer1 1 HAL Introduction 2 1.1 HAL is based on traditional system design techniques................................2 1.1.1 Part Selection.................................................2 1.1.2 Interconnection Design............................................2 1.1.3 Implementation................................................3 1.1.4 Testing....................................................3 1.1.5 Summary...................................................3 1.2 HAL Concepts....................................................4 1.3 HAL components...................................................5 1.3.1 External Programs with HAL hooks.....................................5 1.3.2 Internal Components.............................................5 1.3.3 Hardware Drivers...............................................6 1.3.4 Tools and Utilities..............................................6 1.4 Timing Issues In HAL................................................6 2 Advanced HAL Tutorial 8 2.1 Introduction......................................................8 2.1.1 Notation...................................................8 2.1.2 Tab-completion................................................8 2.1.3 The RTAPI environment...........................................8 2.2 A Simple Example..................................................9 2.2.1 Loading a component.............................................9 2.2.2 Examining the HAL.............................................9 2.2.3 Making realtime code run.......................................... 10 2.2.4 Changing Parameters............................................. 12 2.2.5 Saving the HAL configuration........................................ 12 2.2.6 Exiting halrun................................................ 13 2.2.7 Restoring the HAL configuration....................................... 13 HAL Manual V2.5, 2018-10-21 iii 2.2.8 Removing HAL from memory........................................ 13 2.3 Halmeter....................................................... 13 2.4 Stepgen Example................................................... 15 2.4.1 Installing the components.......................................... 15 2.4.2 Connecting pins with signals......................................... 16 2.4.3 Setting up realtime execution - threads and functions............................ 17 2.4.4 Setting parameters.............................................. 18 2.4.5 Run it!.................................................... 19 2.5 Halscope....................................................... 19 2.5.1 Hooking up the scope probes......................................... 21 2.5.2 Capturing our first waveforms........................................ 24 2.5.3 Vertical Adjustments............................................. 25 2.5.4 Triggering................................................... 26 2.5.5 Horizontal Adjustments........................................... 28 2.5.6 More Channels................................................ 29 2.5.7 More samples................................................. 30 3 General Reference 31 3.1 General Naming Conventions............................................. 31 3.2 Hardware Driver Naming Conventions....................................... 31 3.2.1 Pin/Parameter names............................................. 31 3.2.2 Function Names............................................... 32 4 Canonical Device Interfaces 34 4.1 Introduction...................................................... 34 4.2 Digital Input...................................................... 34 4.2.1 Pins...................................................... 34 4.2.2 Parameters.................................................. 34 4.2.3 Functions................................................... 34 4.3 Digital Output..................................................... 34 4.3.1 Pins...................................................... 35 4.3.2 Parameters.................................................. 35 4.3.3 Functions................................................... 35 4.4 Analog Input..................................................... 35 4.4.1 Pins...................................................... 35 4.4.2 Parameters.................................................. 35 4.4.3 Functions................................................... 35 4.5 Analog Output.................................................... 35 4.5.1 Pins...................................................... 35 4.5.2 Parameters.................................................. 36 4.5.3 Functions................................................... 36 HAL Manual V2.5, 2018-10-21 iv 5 HAL Tools 37 5.1 Halcmd........................................................ 37 5.2 Halmeter....................................................... 37 5.3 Halscope....................................................... 38 6 Basic HAL Tutorial 39 6.1 HAL Commands................................................... 39 6.1.1 loadrt..................................................... 40 6.1.2 addf..................................................... 40 6.1.3 loadusr.................................................... 41 6.1.4 net...................................................... 41 6.1.5 setp...................................................... 42 6.1.6 sets...................................................... 43 6.1.7 unlinkp.................................................... 43 6.1.8 Obsolete Commands............................................. 43 6.1.8.1 linksp............................................... 43 6.1.8.2 linkps............................................... 44 6.1.8.3 newsig............................................... 44 6.2 HAL Data....................................................... 44 6.2.1 Bit...................................................... 44 6.2.2 Float..................................................... 44 6.2.3 s32...................................................... 44 6.2.4 u32...................................................... 44 6.3 HAL Files....................................................... 45 6.4 HAL Components................................................... 45 6.5 Logic Components.................................................. 45 6.5.1 and2...................................................... 45 6.5.2 not...................................................... 46 6.5.3 or2...................................................... 46 6.5.4 xor2...................................................... 46 6.5.5 Logic Examples............................................... 47 6.6 Conversion Components............................................... 47 6.6.1 weighted_sum................................................ 47 7 Halshow 49 7.1 Starting Halshow................................................... 49 7.2 HAL Tree Area.................................................... 49 7.3 HAL Show Area................................................... 51 7.4 HAL Watch Area................................................... 54 HAL Manual V2.5, 2018-10-21 v 8 HAL Components 56 8.1 Commands and Userspace Components....................................... 56 8.2 Realtime Components List.............................................. 57 8.2.1 Core LinuxCNC components......................................... 57 8.2.2 Logic and bitwise components........................................ 57 8.2.3 Arithmetic and float-components....................................... 58 8.2.4 Type conversion............................................... 59 8.2.5 Hardware drivers............................................... 60 8.2.6 Kinematics.................................................. 60 8.2.7 Motor control................................................. 61 8.2.8 BLDC and 3-phase motor control...................................... 61 8.2.9 Other..................................................... 62 8.3 HAL API calls.................................................... 63 8.4 RTAPI calls...................................................... 64 9 HAL Component Descriptions 66 9.1 Stepgen........................................................ 66 9.2 PWMgen....................................................... 73 9.3 Encoder........................................................ 74 9.4 PID.......................................................... 77 9.5 Simulated Encoder.................................................. 79 9.6 Debounce....................................................... 80 9.7 Siggen......................................................... 80 9.8 lut5.......................................................... 81 10 Parallel Port Driver 83 10.1 Parport......................................................... 83 10.1.1 Installing................................................... 83 10.1.2 Pins...................................................... 84 10.1.3 Parameters.................................................. 85 10.1.4 Functions................................................... 85 10.1.5 Common problems.............................................. 85 10.1.6 Using DoubleStep.............................................. 86 10.2 probe_parport..................................................... 86 10.2.1 Installing................................................... 86 11 HAL Examples 87 11.1 Manual Toolchange.................................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    114 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us