[Home]ContributedHalFiles

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org

Showing revision 4
1. About this page
1.1. Purpose
1.2. How to use a .hal file with emc
1.3. How to use a standalone .hal file
1.4. How to put your .hal file on this page
2. Standalone .hal files
2.1. pluto-servo.hal
3. Files for use with emc

1. About this page

1.1. Purpose

This page is a place for users to contribute useful .hal files and hal file snippets. See also: ContributedComponents

1.2. How to use a .hal file with emc

Edit the .hal file to customize it for your environment and put it in the same directory as your .ini file. Then add a new HALFILE = line to the [HAL] section of the .ini file.

If your existing hal files and the new hal file both load the same component, then you will need to renumber the new hal file so that they can coexist. For instance, if file1.hal has these lines:

  loadrt and2 count=2
and refers to and.0 and and.1, and file2.hal has these lines:
  loadrt and2 count=1
and refers to and.0, you will have to change file1 to loadrt and2 count=3, and change references to and2.0 in file2.hal to and2.2 so that each hal file has its own and blocks to use. The loadrt and2 line in file2.hal is removed.

1.3. How to use a standalone .hal file

Edit the .hal file if necessary to customize it for your environment. Then run it with:
 halrun example.hal
(to shut down hal when the .hal script finishes) or
 halrun -I example.hal
(to show the halcmd prompt when the .hal script finishes). If the .hal file is not in the current directory, then use a path, such as:
 halrun -I /home/yourname/Desktop?/example.hal

1.4. How to put your .hal file on this page

First, follow the BasicSteps so that you can edit the wiki. If your hal file is short, put it inside a <pre> block in this page. If it is long, use the "Upload" link to attach it to the wiki. Add any explanatory text that others may find useful.

2. Standalone .hal files

2.1. pluto-servo.hal

This .hal file is useful for testing that communication with the pluto-p module works. Run it with halcmd -I. It

Compatability: 2.3


loadrt pluto_servo test_encoder=1
loadrt threads name1=thread period1=200000
loadrt siggen 
loadrt sim_encoder
loadrt tristate_bit

setp sim-encoder.0.ppr 2540
setp pluto-servo.encoder.0.scale 10160
setp pluto-servo.pwm.0.enable 1
setp sim-encoder.0.speed 5
setp tristate-bit.0.in 1

addf tristate-bit.0 thread
addf pluto-servo.read thread 
addf siggen.0.update thread
addf sim-encoder.update-speed thread
addf sim-encoder.make-pulses thread
addf pluto-servo.write thread 

net sine siggen.0.sine => pluto-servo.pwm.0.value
net index tristate-bit.0.out => pluto-servo.encoder.0.index-enable
net phA sim-encoder.0.phase-A => pluto-servo.dout.00
net phB sim-encoder.0.phase-B => pluto-servo.dout.01
net phZ sim-encoder.0.phase-Z => pluto-servo.dout.02

start

3. Files for use with emc


LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
This page is read-only. Follow the BasicSteps to edit pages. | View other revisions | View current revision
Edited June 20, 2009 8:14 am by JeffEpler (diff)
Search:
Published under a Creative Commons License