Skip to content
Snippets Groups Projects
Commit e350a8d3 authored by whooie's avatar whooie
Browse files

add stuff for a5791 dac

parent 3893d91b
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,9 @@ from lib.system import ( ...@@ -26,7 +26,9 @@ from lib.system import (
CONNECTIONS, CONNECTIONS,
FLIR, FLIR,
MOGRF, MOGRF,
ad5791_init_val, AD5791_INIT,
AD5791_CTRL,
AD5791_DAC,
) )
from lib.dataio import ( from lib.dataio import (
get_timestamp, get_timestamp,
......
...@@ -40,6 +40,9 @@ CONNECTIONS = ConnectionLayout( ...@@ -40,6 +40,9 @@ CONNECTIONS = ConnectionLayout(
mot3_coils_onoff = Digital(0, 2, 1), mot3_coils_onoff = Digital(0, 2, 1),
mot3_coils_cur = Analog(0, 3.45), mot3_coils_cur = Analog(0, 3.45),
mot3_coils_vol = Analog(1, 7.00), mot3_coils_vol = Analog(1, 7.00),
mot3_coils_sig = Digital(0, 8, 0),
mot3_coils_clk = Digital(0, 10, 0),
mot3_coils_sync = Digital(0, 14, 1),
shim_coils_ud = Analog(2, 0.00), shim_coils_ud = Analog(2, 0.00),
shim_coils_lr = Analog(3, 0.00), shim_coils_lr = Analog(3, 0.00),
shim_coils_fb = Analog(4, 0.00), shim_coils_fb = Analog(4, 0.00),
...@@ -74,20 +77,7 @@ FLIR = Grasshopper(FLIR_SERIAL) ...@@ -74,20 +77,7 @@ FLIR = Grasshopper(FLIR_SERIAL)
MOGRF_COM = 3 MOGRF_COM = 3
MOGRF = MOGDriver("COM", MOGRF_COM) MOGRF = MOGDriver("COM", MOGRF_COM)
def ad5791_init_val(register: int, value: int) -> int: AD5791_CTRL = 0b0010
""" AD5791_INIT = 0b00000000000000010010
Returns the 24-bit integer value to send to the AD5791 DAC encoding the AD5791_DAC = 0b0001
operation mode.
Parameters
----------
register : uint8
value : uint24
"""
r = register % 256
B10 = value % 65536
B2 = (value >> 16) % 256
return (((B2 & 0x0f) | r) << 16) + B10
AD5791_CTRL = ad5791_init_val(0x20, 0x0012)
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