SR Memory Addressing

  • Matt Kaniaris
    Matt Kaniaris


    I am interested in writing a few scripts in python which need to be able to access the AIC inputs for control, particularly the AICin 5 It channel. I understand the general code structure for writing to or reading from memory, and this is not the problem. I am confused as to which address the information is at. I have gathered for the output channels, the addresses are magic[10] + 8 through magic[10] + 8 + 7 corresponding in kind to AIC out 0- AIC out 7 where the magic array is read from index 0x4000. I have verified that i can write to the Ub channel with an external scope, but I can't seem to read from the input channels. I have tried to look at FB_spm_dataexchange.h. as Weyers suggested, but my script just returns a string of constants at those addresses with varying input. Does anyone know what the problem might be or could anyone offer some general help in the matter?


    • Matt Kaniaris
      Matt Kaniaris

      Some more information: the following script functions properly verified on an external scope.

      !/usr/bin/env python

      version = "2.1.0"

      import pygtk

      import gobject, gtk
      import os # use os because python IO is bugy
      import time
      import math

      import GtkExtra

      import struct
      import array

      Get the magic adressses @0x4000.

      The Analog IO structure "analog" is at magic[10]

      Details can be found in the FB_spm_dataexchange.h

      sr = open ("/dev/sranger0","r")
      os.lseek (sr.fileno(), 0x4000, 0)
      magic = struct.unpack (magic_fmt, (struct.calcsize (magic_fmt)))
      sr.close ()

      i = 0.0
      output = 0

      sr = open ("/dev/sranger0", "wb")
      while (i < 100000) :
      output = int (math.sin(i/100)*10000)
      os.lseek (sr.fileno(), magic[10]+8+6, 1)
      os.write (sr.fileno(), struct.pack (">h", output))
      i = i + 1
      print (int (i), output)
      sr.close ()

      However, I am only able to write to the address magic[10]+8+6, the Ub channel. I am unable to write to the other outputs, and similarly the addresses from magic[10] 0-8 are constant with varying inputs. Does anyone know why this would be the case?