# Presentation: 090522

## EPICS Channel Access Overview

- 2006
- _[kasemirk@ornl.gov](mailto:kasemirk@ornl.gov)_

## Channel Access: The EPICS Network Protocol

**Read and write Process Variables over the network.**
**To many, CA **_**is**_** EPICS.**
**Especially to users of systems that have no IOC database.**
**"Integrate into EPICS" can mean:****Talk CA on the network.**

## History

**CA was **_**not**_** defined via a protocol specification.**
**Jeff Hill (LANL) provides CA server and client libraries in C/C++.**
**Odd, but resulted in very stable implementation, avoiding conflicts caused by differing interpretations of the protocol by different persons. **
**Cosylab recently has reverse-engineered the protocol specification, and implemented a pure Java version.**
**Which is great for the future of CA.**
**... ****but for now suffers from interpretation issues, possibly crashing CA servers on IOCs.**

## What is a Process Variable?

**Good question!**
**Need to revisit.**
**"A named piece of data with attributes".**
**Consider this record:**
**	****	****record(calc, "t1:calcExample")**
**	****	****{**
**	****	****        ****field(DESC, "Sawtooth Ramp")**
**	****	****        ****field(SCAN, "1 second")**
**	****	****        ****field(CALC, "(A<10)?(A+1):0")**
**	****	****        ****field(INPA, "t1:calcExample.VAL")**
**	****	****}**
**Fine print:****Your soft IOC will have a "t1:calcExample" with a slightly more complicated "CALC=(A<B)?(A+C):D", because it uses variables B and C instead of fixed values 10 and 0. Plus it defaults to B=9, not 10 as used in this example.**

## What is a PV, given that record?

**"t1:calcExample"**
**PV for the current value of the record.**
**Number 0...10, changes each second.**
**"t1:calcExample.DESC"**
**PV for the DESC (description) field of the record.**
**String "Sawtooth Ramp", static.**
**"t1:calcExample.VAL"**
**Same as "t1:calcExample".**
**Pretty much every field of a record can be a PV:**
**"{record name}.{field name}"**
**".VAL" is implied when the field is left off.**

## 'caget', 'caput' Experiments

**'caget' command-line tool comes with EPICS base:**
**> caget t1:calcExample**
**t1:calcExample                 6 **
**> caget t1:calcExample.VAL**
**t1:calcExample.VAL             9 **
**> caget t1:calcExample.DESC**
**t1:calcExample.DESC            Sawtooth Ramp **
**'caput' allows writing:**
**> caput t1:calcExample.DESC "Howdy"**
**Old : t1:calcExample.DESC            Sawtooth Ramp **
**New : t1:calcExample.DESC            Howdy**** **

## 'camonitor'

**'camonitor' *****monitors***** value changes:**
**> camonitor t1:calcExample**
**t1:calcExample                 2006-10-06 13:26:03.332756 6 **
**t1:calcExample                 2006-10-06 13:26:04.332809 7 **
**t1:calcExample                 2006-10-06 13:26:05.332866 8 **
**t1:calcExample                 2006-10-06 13:26:06.332928 9 **
**t1:calcExample                 2006-10-06 13:26:07.332981 10 **
**t1:calcExample                 2006-10-06 13:26:08.333034 0 **
**t1:calcExample                 2006-10-06 13:26:09.333097 1 **
**t1:calcExample                 2006-10-06 13:26:10.333143 2**
**... ****plus one more each second...**
**... ****press Ctrl-C to stop ...**
**> camonitor t1:calcExample.DESC**
**t1:calcExample.DESC            2006-10-06 13:29:12.442257 Howdy**
**... ****and then nothing ... **
**Idea called *****publish***** and *****subscribe*****.**

## probe

**Graphical tool similar****to caget/put.**
**Run****	****probe &**
**Enter PV name**
**Press 'start' to subscribe,**
**... ****'stop' to unsubscribe.**
**Press 'adjust' to write/put.**

## StripTool

**Plots value over time.**
**Run****StripTool &**
**Enter PV name**
**Maybe adjust the min/max value range or color.**
**Based on (configurable) sampling, defaulting to once per second.**
**Note occasional hickup when data also changes at 1Hz, but isn't synchronized with the sampling.**
**Fix: Configure StripTool to sample every 0.5 secs.**

## Intermediate Summary

**CA is the EPICS network protocol.**
**CA can get/monitor/put PVs**
**read, listen, write**
**PV can be**
**"{record name}"**
**"{record name}.{field name}"**
**Useful Tools:**
**caget, caput, camonitor, (and cainfo)**
**probe, StripTool **
**... ****to be continued...**

## Acknowledgements

**Material and ideas have been copied from**
**Bob Dalesio (LANL)**
**Ned Arnold (APS)**
**Ken Evans (APS)**