*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
Commit 3f05ce9a authored by Schabbauer, Johannes's avatar Schabbauer, Johannes
Browse files

First untested code for labscript waits:

Added parameters to pause and resume both the main
process and the TiCo processes. Moved the time increment
in the main process to earlier position, for better sync
when TiCos are resumed. Still need to test on hardware.
parent 6ee8955b
No related branches found
No related tags found
No related merge requests found
......@@ -112,6 +112,7 @@ init:
'Set Processdelay to 2us
PROCESSDELAY = 2000
par_1 = 1 'Process Status
par_4 = 0 'Wait counter
'Initialize Variables
processIdx = 0
......@@ -150,7 +151,11 @@ init:
'Initialize event counter for digital channels
P2_Set_Par(DIO1,1,3,2)
P2_Set_Par(DIO2,1,3,2)
'Set wait start of TiCo (must pause at same time as main process)
P2_Set_Par(DIO1,1,4,Par_9)
P2_Set_Par(DIO2,1,4,Par_19)
'=========================== PID SETTINGS ============================
'Initialize Integrator and Difference
FOR i=1 TO AOUTNO
......@@ -263,10 +268,24 @@ EVENT:
'Synchronize DIO Channels (once after 20 events)
if(processIdx = 20) then
P2_set_par(DIO1,1,20,1) 'starte tico event Modul 1
P2_set_par(DIO2,1,20,1) 'starte tico event Modul 5
P2_set_par(DIO1,1,20,1) 'start tico event
P2_set_par(DIO2,1,20,1) 'start tico event
endif
'======================= INCREASE TIME (IF NO WAIT) ======================
IF (Par_3 <> processIdx) THEN
inc processIdx
ELSE
' If Par_3 == processIdx we reached a wait. This means we pause the 'clock' until we get the singnal to continue.
' This signal can either be that Par_6 was set to 1, or we reach the timeout (in Par_5)
IF ((Par_6 = 1) OR (processIdx+Par_4 = Par_5)) THEN
Par_3 = -1 'Disable wait
P2_Set_Par(DIO1,1,4,-1) 'Resume DIO1
P2_Set_Par(DIO2,1,4,-1) 'Resume DIO2
ENDIF
inc Par_4
ENDIF
'Set all voltages synchronously
P2_Sync_All(110000b)
......@@ -274,15 +293,14 @@ EVENT:
' Write ADC Values
' TODO: Array length is checked in labscript, do we still need that here?
FOR i=1 to AINNO
IF(processIdx < DATA_8[i]) THEN
IF (processIdx >= DATA_7[i]) THEN
IF(processIdx <= DATA_8[i]) THEN
IF (processIdx > DATA_7[i]) THEN
DATA_199[ain_index[i]]=act_values[i]
inc ain_index[i]
ENDIF 'processIdx > DATA_7[i]
ENDIF 'processIdx <= DATA_8[i]
NEXT i
inc processIdx
'=========================== CHECK END OF RUN ==========================
IF (processIdx >= par_2) THEN
......
......@@ -25,10 +25,16 @@ The global variables in the ADwin can be used for data transfer with the compute
|----------|-------------------------------------|
| Par_1 | Process status (running=1, finshed=0) |
| Par_2 | Stop time (in number of process cycles) |
| Par_3 | Wait start (no. of process cycles) |
| Par_4 | Wait counter (no. of process cycles)|
| Par_5 | Wait timeout (no. of process cycles)|
| Par_6 | Wait trigger to continue (init. to 0, continue when 1)
| Par_9 | Wait start for *DIO1*, written in *Par_4* of TiCo |
| Par_10 | Tico Process status of *DIO1* at end of shot, running (fine) = 1, stopped (error) = 0 |
| Par_11 | Start parameter of process for *manual programming* |
| Par_13 | Total workload during the shot in number of CPU cycles (1ns) |
| Par_15 | Process index, updated every event loop |
| Par_19 | Wait start for *DIO2*, written in *Par_4* of TiCo |
| Par_20 | Tico Process status of *DIO2* at end of shot, running (fine) = 1, stopped (error) = 0 |
| Par_21 | PID No. which gets its parameters set from GUI |
| Par_22 | Total numbers of PIDs with settings, that are set in the INIT block |
......@@ -76,6 +82,7 @@ The global variables in the ADwin can be used for data transfer with the compute
| Par_1 | Output bitfield, from Data_2 |
| Par_2 | Process index of TiCo process|
| Par_3 | Event index, tracks current item of Data_1 and Data_2 |
| Par_4 | Wait start (no. of process cycles) |
| Par_20 | Start signal from main process (after 80 TiCo process cycles) |
| Data_1 | Times for digital output, copy of Data_10 or Data_20 from main process |
| Data_2 | Bitfield for digital output, copy of Data_11 or Data_21 from main process |
......@@ -32,7 +32,10 @@ INIT:
Event:
Digout_Long(par_1)
inc par_2
IF Par_2 <> Par_4 THEN
inc par_2
ENDIF 'wait: pause time until Par_4 is changed from main process
If (Data_1[par_3] = Par_2) THEN 'check wether next event reached
Par_1 = DATA_2[par_3]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment