This documentation is no longer maintained. For documentation of the current version of emc2, please see http://www.linuxcnc.org/docview/html

Table of Contents

List of figures

1 VCP

1.1 VCP: A small example

NOTE: VCP is deprecated, and will most likely not be getting any new development or additional widgets. We strongly recommend using pyVCP. However, pyVCP won't be released until version 2.2 comes out, and VCP is in version 2.1. That means some people will wind up using VCP, so we can't simply drop it.1

Place the following in the file tiny.vcp:

vcp { 
main-window {
box {
button {
halpin = vcp.pushbutton
label { text = "Push Me" }
}
LED {
halpin = vcp.light
}
}
}
}

The above file describes a tiny Virtual Control Panel, with one push button, and one light. To see what it looks like, we need to start HAL:

$ halrun

Next we load halvcp, and give it the name of our .vcp file:

halcmd: loadusr halvcp tiny.vcp
halcmd:

There may be some text printed as halvcp parses the tiny.vcp file, but when it finishes, there should be a small window on your screen, with a button and an LED. It will look something like figure [.].

Figure: tiny.vcp on the screen

So, we have a button and an LED, but they aren't connected to anything, so nothing happens when you push the button. However, the LED and the button both have HAL pins associated with them:

halcmd: show pin
Component Pins:
Owner Type Dir Value Name
03 bit IN FALSE vcp.light
03 bit OUT FALSE vcp.pushbutton
halcmd:

To make something happen, we can connect a HAL signal between the button and the light:

halcmd: newsig jumper bit
halcmd: linksp jumper vcp.pushbutton
halcmd: linksp jumper vcp.light
halcmd: show sig
Signals:
Type Value Name
bit FALSE jumper
==> vcp.light
<== vcp.pushbutton
halcmd:

Now push the button, and the the LED should light up!

1.2 VCP: Another small example with EMC

Place the following in the file estop.vcp:

vcp { 
main-window {
toggle { halpin = vcp.estop }
}
}

In your .hal file, remove any existing signal linked to iocontrol.0.emc-enable-in and add the following lines:

loadusr -W halvcp estop.vcp
newsig estop bit
linkps vcp.estop => estop
linkps estop => iocontrol.0.emc-enable-in

Now, when running your machine, the ESTOP button in the GUI is disabled, and the ESTOP button in the VCP window is used instead.

1.3 VCP Syntax

1.3.1 Block

A block's format is:

tag { contents }

The contents can consist of attributes that describe the block, or other blocks that nest inside it.

A attributes format is

name = value

The attribute names that are acceptable for each block depend on the block tag, and will be listed later.

Footnotes

1   A .vcp to .xml translator that takes a vcp file and turns it into one that pyVCP can use is on my to-do list. That would enable VCP users to easily switch over to pyVCP. If such a translator is written, VCP may be removed from the version 2.2 release. back