def fetch_int_data_from_LA(self,bytes,chan=1):
"""
fetches the data stored by DMA. integer address increments
.. tabularcolumns:: |p{3cm}|p{11cm}|
============== ============================================================================================
**Arguments**
============== ============================================================================================
bytes: number of readings(integers) to fetch
chan: channel number (1-4)
============== ============================================================================================
"""
try:
self.H.__sendByte__(CP.TIMING)
self.H.__sendByte__(CP.FETCH_INT_DMA_DATA)
self.H.__sendInt__(bytes)
self.H.__sendByte__(chan-1)
ss = self.H.fd.read(int(bytes*2))
t = np.zeros(bytes*2)
for a in range(int(bytes)):
t[a] = CP.ShortInt.unpack(ss[a*2:a*2+2])[0]
self.H.__get_ack__()
except Exception as ex:
self.raiseException(ex, "Communication Error , Function : "+inspect.currentframe().f_code.co_name)
t=np.trim_zeros(t)
b=1;rollovers=0
while b<len(t):
if(t[b]<t[b-1] and t[b]!=0):
rollovers+=1
t[b:]+=65535
b+=1
return t
评论列表
文章目录