#LyX 1.3 created this file. For more info see http://www.lyx.org/ \lyxformat 221 \textclass book \begin_preamble \usepackage[plainpages=false,pdfpagelabels,colorlinks=true,linkcolor=blue]{hyperref} \end_preamble \language english \inputencoding default \fontscheme bookman \graphics default \float_placement !htbp \paperfontsize default \spacing single \papersize letterpaper \paperpackage a4 \use_geometry 1 \use_amsmath 1 \use_natbib 0 \use_numerical_citations 0 \paperorientation portrait \leftmargin 1in \topmargin 1in \rightmargin 0.8in \bottommargin 0.8in \secnumdepth 1 \tocdepth 5 \paragraph_separation skip \defskip smallskip \quotes_language english \quotes_times 2 \papercolumns 1 \papersides 1 \paperpagestyle default \layout Chapter VCP \layout Section VCP: A small example \layout Standard 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. \begin_inset Foot collapsed false \layout Standard 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. \end_inset \layout Standard Place the following in the file \family typewriter tiny.vcp \family default : \layout LyX-Code vcp { \newline main-window { \newline box { \newline button { \newline halpin = vcp.pushbutton \newline label { text = "Push Me" } \newline } \newline LED { \newline halpin = vcp.light \newline } \newline } \newline } \newline } \layout Standard 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: \layout LyX-Code $ \series bold halrun \layout Standard Next we load halvcp, and give it the name of our .vcp file: \layout LyX-Code halcmd: \series bold loadusr halvcp tiny.vcp \series default \newline halcmd: \layout Standard 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 \begin_inset LatexCommand \ref{fig:tiny.vpc_onscreen} \end_inset . \layout Standard \begin_inset Float figure wide false collapsed false \layout Standard \align center \begin_inset Graphics filename tinyvcp.png rotateOrigin center \end_inset \layout Caption \begin_inset LatexCommand \label{fig:tiny.vpc_onscreen} \end_inset tiny.vcp on the screen \end_inset \layout Standard 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: \layout LyX-Code halcmd: \series bold show pin \layout LyX-Code Component Pins: \newline Owner Type Dir Value Name \newline 03 bit IN FALSE vcp.light \newline 03 bit OUT FALSE vcp.pushbutton \newline halcmd: \layout Standard To make something happen, we can connect a HAL signal between the button and the light: \layout LyX-Code halcmd \series bold : \series default \series bold newsig jumper bit \newline \series default halcmd: \series bold linksp jumper vcp.pushbutton \newline \series default halcmd: \series bold linksp jumper vcp.light \newline \series default halcmd: \series bold show sig \newline \series default Signals: \newline Type Value Name \newline bit FALSE jumper \newline ==> vcp.light \newline <== vcp.pushbutton \newline halcmd: \layout Standard Now push the button, and the the LED should light up! \layout Section VCP: Another small example with EMC \layout Standard Place the following in the file \family typewriter estop.vcp \family default : \layout LyX-Code vcp { \newline main-window { \newline toggle { halpin = vcp.estop } \newline } \newline } \layout Standard In your .hal file, remove any existing signal linked to \family typewriter iocontrol.0.emc-enable-in \family default and add the following lines: \layout LyX-Code loadusr -W halvcp estop.vcp \newline newsig estop bit \newline linkps vcp.estop => estop \newline linkps estop => iocontrol.0.emc-enable-in \layout Standard Now, when running your machine, the ESTOP button in the GUI is disabled, and the ESTOP button in the VCP window is used instead. \layout Section VCP Syntax \layout Subsection Block \layout Standard A block's format is: \layout LyX-Code \emph on tag \emph default { \emph on contents \emph default } \layout Standard The contents can consist of attributes that describe the block, or other blocks that nest inside it. \layout Standard A attributes format is \layout LyX-Code \emph on name \emph default = \emph on value \layout Standard The attribute names that are acceptable for each block depend on the block tag, and will be listed later. \the_end