@@ -4,8 +4,8 @@ Creating an IOC
44Introduction
55------------
66
7- Once the module has been installed (see `installation `) we can create a
8- simple EPICS Input/Output Controller (IOC).
7+ Once the module has been installed (see `installation `) we can create a
8+ simple EPICS Input/Output Controller (IOC).
99
1010An EPICS IOC created with the help of ``pythonIoc `` and `softioc ` is
1111referred to as a "Python soft IOC". The code below illustrates a simple IOC
@@ -19,30 +19,32 @@ Each section is explained in detail below:
1919 :start-after: # Import
2020 :end-before: # Set
2121
22- The `softioc ` library is part of ``pythonIoc ``. The two submodules
23- `softioc.softioc ` and `softioc.builder ` provide the basic
22+ The `softioc ` library is part of ``pythonIoc ``. The two submodules
23+ `softioc.softioc ` and `softioc.builder ` provide the basic
2424functionality for Python soft IOCs and are the ones that are normally used.
2525
2626`cothread ` is one of the two possible libraries the IOC can use for
27- asynchronous operations.
28- (see `../how-to/use-asyncio-in-an-ioc ` for the alternative)
27+ asynchronous operations.
2928
29+ .. note ::
3030
31+ `cothread ` doesn't work on Windows or on a Mac M1. You can use `asyncio `
32+ instead by following `../how-to/use-asyncio-in-an-ioc `
3133
3234.. literalinclude :: ../examples/example_cothread_ioc.py
33- :start-after: # Create
35+ :start-after: # Create
3436 :end-before: # Boilerplate
3537
3638PVs are normally created dynamically using `softioc.builder `. All PV
37- creation must be done before initialising the IOC. We define a lambda function for
38- `on_update ` on ``ao `` such that whenever we set ``ao ``, ``ai `` will be set to the
39- same value. The ``always_update `` flag ensures that the ``on_update `` function is always
39+ creation must be done before initialising the IOC. We define a lambda function for
40+ `on_update ` on ``ao `` such that whenever we set ``ao ``, ``ai `` will be set to the
41+ same value. The ``always_update `` flag ensures that the ``on_update `` function is always
4042triggered, which is not the default behaviour if the updated value is the same as the
4143current value.
4244
4345
4446.. literalinclude :: ../examples/example_cothread_ioc.py
45- :start-after: # Boilerplate
47+ :start-after: # Boilerplate
4648 :end-before: # Start
4749
4850
@@ -52,14 +54,14 @@ which must be called in this order. After calling
5254:func: `~softioc.builder.LoadDatabase ` it is no longer possible to create PVs.
5355
5456.. literalinclude :: ../examples/example_cothread_ioc.py
55- :start-after: # Start
57+ :start-after: # Start
5658 :end-before: # Finally
5759
5860We define a long-running operation that will increment the value of ``ai `` once per
59- second. This is run as a background thread by `cothread `.
61+ second. This is run as a background thread by `cothread `.
6062
6163.. literalinclude :: ../examples/example_cothread_ioc.py
62- :start-after: # Finally
64+ :start-after: # Finally
6365
6466Finally the application must refrain from exiting until the IOC is no longer
6567needed. The :func: `~softioc.softioc.interactive_ioc ` runs a Python
@@ -69,7 +71,7 @@ internals of the IOC while it's running. The alternative is to call something
6971like :func: `cothread.WaitForQuit ` or some other `cothread ` blocking
7072action.
7173
72- In this interpreter there is immediate access to methods defined in the
74+ In this interpreter there is immediate access to methods defined in the
7375`softioc.softioc ` module. For example the :func: `~softioc.softioc.dbgf ` function
7476can be run to observe the increasing value of ``AI ``::
7577
@@ -79,15 +81,15 @@ can be run to observe the increasing value of ``AI``::
7981 DBF_DOUBLE: 37
8082
8183And the :func: `~softioc.softioc.dbpf ` method allows data to be set and to observe
82- the functionality of the lambda passed to ``on_update `` . We set the value on ``AO ``
84+ the functionality of the lambda passed to ``on_update `` . We set the value on ``AO ``
8385and read the value on ``AI `` (exact values will vary based on time taken)::
8486
8587 >>> dbgf("MY-DEVICE-PREFIX:AI")
8688 DBF_DOUBLE: 15
8789 >>> dbpf("MY-DEVICE-PREFIX:AO","999")
88- DBF_DOUBLE: 999
90+ DBF_DOUBLE: 999
8991 >>> dbgf("MY-DEVICE-PREFIX:AI")
90- DBF_DOUBLE: 1010
92+ DBF_DOUBLE: 1010
9193
9294
9395Creating PVs
0 commit comments