Skip to content

Commit

Permalink
Changed code to send to device
Browse files Browse the repository at this point in the history
  • Loading branch information
jacotay7 committed Jun 10, 2024
1 parent c3a0f7d commit 4ac2649
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions pyRTC/hardware/SUPERPAOWER.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from pyRTC.Pipeline import *
from pyRTC.utils import *
import argparse

import struct
import time
import serial

Expand Down Expand Up @@ -77,7 +77,7 @@ def connectToChip(self):

def setMapping(self):
self.channelMapping = [
(5, 'k'),
(5, 19),
(0,0),
(0,0),
(0,0),
Expand Down Expand Up @@ -111,14 +111,21 @@ def sendToHardware(self):
return

def setSingleDAC(self, pmod, chan, volt):
pmod = str(pmod)
chan = str(chan)
volt = str(volt)

intstructions = [b'e', b'e', pmod.encode(), chan.encode(), volt.encode(), b'\r']
for instruct in intstructions:
self.device.write(instruct) # Send 'e' character
time.sleep(self.communicationPause)
# pmod = str(pmod)
# chan = str(chan)
# volt = str(volt)

pmod = int(pmod)
chan = int(chan)
volt = float(volt)

data = struct.pack('iif', pmod, chan, volt)
self.device.write(data)

# intstructions = [b'e', b'e', pmod.encode(), chan.encode(), volt.encode(), b'\r']
# for instruct in intstructions:
# self.device.write(instruct) # Send 'e' character
# time.sleep(self.communicationPause)

return

Expand Down

0 comments on commit 4ac2649

Please sign in to comment.