11# Import the basic framework components.
2- import atexit
32from softioc import softioc , builder
4- from aioca import caget , caput , _catools
3+ from aioca import caget , caput
54import asyncio
65
76# Set the record prefix
109# Create some records
1110ai = builder .aIn ('AI' , initial_value = 5 )
1211
13- async def update (val ):
12+ def update (val ):
13+ print ("got here" )
14+ print (val )
1415 ai .set (val )
1516
1617ao = builder .aOut ('AO' , initial_value = 12.45 , on_update = update )
@@ -21,10 +22,21 @@ async def update(val):
2122
2223# Perform some reading/writing to the PVs
2324async def do_read_write ():
24- ai_val = await caget ("MY-DEVICE-PREFIX:AI" )
25+ print (await caget ("MY-DEVICE-PREFIX:AO" ))
26+ print (await caget ("MY-DEVICE-PREFIX:AI" ))
2527 await caput ("MY-DEVICE-PREFIX:AO" , "999" )
28+ await asyncio .sleep (10 )
29+ print (await caget ("MY-DEVICE-PREFIX:AI" ))
30+ print (await caget ("MY-DEVICE-PREFIX:AO" ))
2631
32+ #asyncio.run(do_read_write())
2733
28- asyncio .run (do_read_write ())
34+ print (asyncio .run (caget ("MY-DEVICE-PREFIX:AI" )))
35+ print (asyncio .run (caget ("MY-DEVICE-PREFIX:AO" )))
36+ print (asyncio .run (caput ("MY-DEVICE-PREFIX:AO" ,"999" )))
2937
38+ print (asyncio .run (caget ("MY-DEVICE-PREFIX:AI" )))
39+ print (asyncio .run (caget ("MY-DEVICE-PREFIX:AO" )))
3040
41+
42+ softioc .interactive_ioc (globals ())
0 commit comments