📄 vcp.lyx
字号:
#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 ChapterVCP\layout SectionVCP: A small example\layout StandardNOTE: 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 Footcollapsed false\layout StandardA .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 StandardPlace the following in the file \family typewriter tiny.vcp\family default :\layout LyX-Codevcp { \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 StandardThe 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 StandardNext we load halvcp, and give it the name of our .vcp file:\layout LyX-Codehalcmd: \series bold loadusr halvcp tiny.vcp\series default \newline halcmd:\layout StandardThere 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 figurewide falsecollapsed 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 StandardSo, 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-Codehalcmd: \series bold show pin\layout LyX-CodeComponent Pins:\newline Owner Type Dir Value Name\newline 03 bit IN FALSE vcp.light\newline 03 bit OUT FALSE vcp.pushbutton\newline halcmd:\layout StandardTo make something happen, we can connect a HAL signal between the button and the light:\layout LyX-Codehalcmd\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 StandardNow push the button, and the the LED should light up!\layout SectionVCP: Another small example with EMC\layout StandardPlace the following in the file \family typewriter estop.vcp\family default :\layout LyX-Codevcp { \newline main-window { \newline toggle { halpin = vcp.estop } \newline }\newline }\layout StandardIn 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-Codeloadusr -W halvcp estop.vcp\newline newsig estop bit\newline linkps vcp.estop => estop\newline linkps estop => iocontrol.0.emc-enable-in\layout StandardNow, when running your machine, the ESTOP button in the GUI is disabled, and the ESTOP button in the VCP window is used instead.\layout SectionVCP Syntax\layout SubsectionBlock\layout StandardA block's format is:\layout LyX-Code\emph on tag\emph default { \emph on contents\emph default }\layout StandardThe contents can consist of attributes that describe the block, or other blocks that nest inside it.\layout StandardA attributes format is\layout LyX-Code\emph on name\emph default = \emph on value\layout StandardThe attribute names that are acceptable for each block depend on the block tag, and will be listed later.\the_end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -