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

Skip to content
Snippets Groups Projects
Commit b1266f5d authored by Holten, Marvin's avatar Holten, Marvin
Browse files

Added AIN recording

-modified adbasic code to record the 16 AIN channels at the times that are specified by labscript
parent 5d0bbfd1
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@
' Optimize = Yes
' Optimize_Level = 4
' Stacksize = 1000
' Info_Last_Save = ATI098-60 ATI098-60\labuser
' Info_Last_Save = LEONARD-LAB1 LEONARD-LAB1\mholt
'<Header End>
#include adwinpro_all.inc
......@@ -17,12 +17,13 @@
' TODO: check these values in labscript_devices files
#define ZERO 32768 ' Zero Volts in Adwin 16bit representation
#define N 32768 ' Max Voltage offset by ZERO
#define MAX_EVENTS 200000 ' Max number of events that can be stored
#define MAX_EVENTS 500000 ' Max number of events that can be stored
#define MAX_PID_EVENTS 2000 ' Max number of changing the AIN channel for PID feedback to AOUT
#define MAX_TICO_EVENTS 2000 ' Max number of Digital Output events
#define A_IN_BUFFER 10000000 ' Size of Array to transmit AIN values to the runner PC
#define MAX_TICO_EVENTS 3000 ' Max number of Digital Output events
#define A_IN_BUFFER 30000000 ' Size of Array to transmit AIN values to the runner PC
#define PIDNO 100 ' Max Number of PIDs
#define AOUTNO 16 ' Number of output channels
#define AINNO 16 ' Number of input channels
' Set Module Adresses
' TODO get or set these values from labscript ?
......@@ -43,17 +44,17 @@ DIM DATA_4[MAX_PID_EVENTS] AS LONG 'Times for changing PID channels
DIM DATA_5[MAX_PID_EVENTS] AS LONG 'PID A_OUT channel
DIM DATA_6[MAX_PID_EVENTS] AS LONG 'PID A_In channel
' Declare arrays for AIN Channel Timings
DIM DATA_7[AINNO] AS LONG 'Start times for channel recording
DIM DATA_8[AINNO] AS LONG 'End times for channel recording
DIM DATA_9[A_IN_BUFFER+16] AS LONG 'Recorded Data - add padding at the end to ensure no overflow happens
'Declare arrays for digital data from experiment control software
DIM DATA_10[MAX_TICO_EVENTS] AS LONG 'DIO1 TiCo times
DIM DATA_11[MAX_TICO_EVENTS] AS LONG 'DIO1 digital output values
DIM DATA_20[MAX_TICO_EVENTS] AS LONG 'DIO2 TiCo times
DIM DATA_21[MAX_TICO_EVENTS] AS LONG 'DIO2 digital output values
'Declare arrays that are used for AIN transmission
DIM DATA_7[A_IN_BUFFER] AS LONG
DIM DATA_8[A_IN_BUFFER] AS LONG
DIM DATA_9[A_IN_BUFFER] AS LONG
'Declare arrays to store TICO memory pointers
DIM PTR_TICO1[150] AS LONG
DIM PTR_TICO2[150] AS LONG
......@@ -77,6 +78,7 @@ DIM pid_prev_dError[AOUTNO] AS FLOAT
DIM processIdx AS LONG
DIM eventIdx AS LONG
DIM pidIdx AS LONG
DIM aInIdx AS LONG
DIM timer AS LONG 'timing the event duration
DIM i AS LONG 'for loop index
......@@ -100,6 +102,7 @@ init:
processIdx = 0
eventIdx = 0
pidIdx = 0
aInIdx = 0
'===========================================================INITIALIZE TICOS============================================================
'Set DIO channels as outputs
......@@ -317,11 +320,16 @@ EVENT:
ENDIF
' Write ADC Values
IF ( processIdx < A_IN_BUFFER ) THEN
DATA_7[processIdx] = act_values[1]
DATA_8[processIdx] = act_values[2]
'DATA_9[processIdx] = act_values[3]
ENDIF
IF (aInIdx < A_IN_BUFFER) THEN
FOR i=1 to AINNO
IF(processIdx <= DATA_8[i]) THEN
IF (processIdx > DATA_7[i]) THEN
inc aInIdx
DATA_9[aInIdx]=act_values[i]
ENDIF 'processIdx > DATA_7[i]
ENDIF 'processIdx <= DATA_8[i]
NEXT i
ENDIF 'aInIdx < A_IN_BUFFER
' Update target values
IF(DATA_1[eventIdx+1] <= processIdx) THEN
......@@ -341,7 +349,7 @@ EVENT:
'### Debug Timer
par_13=READ_TIMER_SYNC() - timer
DATA_9[processIdx] = par_13
'DATA_9[processIdx] = par_13
par_15=processIdx
FINISH:
......
No preview for this file type
......@@ -9,7 +9,7 @@
' Optimize = Yes
' Optimize_Level = 4
' Stacksize = 1000
' Info_Last_Save = ATI098-60 ATI098-60\labuser
' Info_Last_Save = LEONARD-LAB1 LEONARD-LAB1\mholt
'<Header End>
#include adwinpro_all.inc
......@@ -17,12 +17,13 @@
' TODO: check these values in labscript_devices files
#define ZERO 32768 ' Zero Volts in Adwin 16bit representation
#define N 32768 ' Max Voltage offset by ZERO
#define MAX_EVENTS 200000 ' Max number of events that can be stored
#define MAX_EVENTS 500000 ' Max number of events that can be stored
#define MAX_PID_EVENTS 2000 ' Max number of changing the AIN channel for PID feedback to AOUT
#define MAX_TICO_EVENTS 2000 ' Max number of Digital Output events
#define A_IN_BUFFER 10000000 ' Size of Array to transmit AIN values to the runner PC
#define MAX_TICO_EVENTS 3000 ' Max number of Digital Output events
#define A_IN_BUFFER 30000000 ' Size of Array to transmit AIN values to the runner PC
#define PIDNO 100 ' Max Number of PIDs
#define AOUTNO 16 ' Number of output channels
#define AINNO 16 ' Number of input channels
' Set Module Adresses
' TODO get or set these values from labscript ?
......@@ -43,17 +44,17 @@ DIM DATA_4[MAX_PID_EVENTS] AS LONG 'Times for changing PID channels
DIM DATA_5[MAX_PID_EVENTS] AS LONG 'PID A_OUT channel
DIM DATA_6[MAX_PID_EVENTS] AS LONG 'PID A_In channel
' Declare arrays for AIN Channel Timings
DIM DATA_7[AINNO] AS LONG 'Start times for channel recording
DIM DATA_8[AINNO] AS LONG 'End times for channel recording
DIM DATA_9[A_IN_BUFFER+16] AS LONG 'Recorded Data - add padding at the end to ensure no overflow happens
'Declare arrays for digital data from experiment control software
DIM DATA_10[MAX_TICO_EVENTS] AS LONG 'DIO1 TiCo times
DIM DATA_11[MAX_TICO_EVENTS] AS LONG 'DIO1 digital output values
DIM DATA_20[MAX_TICO_EVENTS] AS LONG 'DIO2 TiCo times
DIM DATA_21[MAX_TICO_EVENTS] AS LONG 'DIO2 digital output values
'Declare arrays that are used for AIN transmission
DIM DATA_7[A_IN_BUFFER] AS LONG
DIM DATA_8[A_IN_BUFFER] AS LONG
DIM DATA_9[A_IN_BUFFER] AS LONG
'Declare arrays to store TICO memory pointers
DIM PTR_TICO1[150] AS LONG
DIM PTR_TICO2[150] AS LONG
......@@ -77,6 +78,7 @@ DIM pid_prev_dError[AOUTNO] AS FLOAT
DIM processIdx AS LONG
DIM eventIdx AS LONG
DIM pidIdx AS LONG
DIM aInIdx AS LONG
DIM timer AS LONG 'timing the event duration
DIM i AS LONG 'for loop index
......@@ -100,6 +102,7 @@ init:
processIdx = 0
eventIdx = 0
pidIdx = 0
aInIdx = 0
'===========================================================INITIALIZE TICOS============================================================
'Set DIO channels as outputs
......@@ -317,11 +320,16 @@ EVENT:
ENDIF
' Write ADC Values
IF ( processIdx < A_IN_BUFFER ) THEN
DATA_7[processIdx] = act_values[1]
DATA_8[processIdx] = act_values[2]
DATA_9[processIdx] = act_values[3]
ENDIF
IF (aInIdx < A_IN_BUFFER) THEN
FOR i=1 to AINNO
IF(processIdx <= DATA_8[i]) THEN
IF (processIdx > DATA_7[i]) THEN
inc aInIdx
DATA_9[aInIdx]=act_values[i]
ENDIF 'processIdx > DATA_7[i]
ENDIF 'processIdx <= DATA_8[i]
NEXT i
ENDIF 'aInIdx < A_IN_BUFFER
' Update target values
IF(DATA_1[eventIdx+1] <= processIdx) THEN
......
......@@ -35,9 +35,9 @@ The global variables in the ADwin can be used for data transfer with the compute
| Data_4 | Times for setting or changing PID channels (in number of process cycles) |
| Data_5 | Analog output channel that is controlled by PID loop staring from time in Data_4 |
| Data_6 | Analog input channel used as feedback to stabilize channel in Data_5 via PID controller |
| Data_7 | TODO input |
| Data_8 | TODO input |
| Data_9 | TODO input |
| Data_7 | Times at which recording of each of the 16 AIN channels is started |
| Data_8 | Times at which recording of each of the 16 AIN channels is stopped |
| Data_9 | Recorded AIN data |
| Data_10 | Time for digital outputs of DIO1 (in number of *TiCo* process cycles) |
| Data_11 | **Digital** output bitfield for 32 channels of DIO1 at time from Data_10 |
| Data_20 | Time for digital outputs of DIO2 (in number of *TiCo* process cycles) |
......
......@@ -45,7 +45,7 @@ Event:
Digout_Long(par_1) ' TODO: why do we set the Output every cycle and not just when it changes?
inc par_2
If (Data_1[par_3] >= Par_2)THEN 'check wether next event reached
If (Data_1[par_3] <= Par_2)THEN 'check wether next event reached
Par_1 = DATA_2[par_3]
inc par_3
ENDIF
......
......@@ -7,13 +7,13 @@
' TiCoBasic_Version = 1.6.4
' Optimize = Yes
' Optimize_Level = 2
' Info_Last_Save = ATI098-60 ATI098-60\labuser
' Info_Last_Save = LEONARD-LAB1 LEONARD-LAB1\mholt
'<Header End>
#include DIO32TiCo.inc
#define MAXTICOEVENTS 2001 'Size of Tico Memory
#define MAXTICOEVENTS 3001 'Size of Tico Memory
DIM DATA_1[MAXTICOEVENTS] AS long AT DM_LOCAL 'Time
DIM DATA_2[MAXTICOEVENTS] AS Long AT DM_LOCAL 'Digital Output
......
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