Advertisement
DeaD_EyE

asi_address

Nov 23rd, 2016
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. def asi_address(start, length):
  2.     """
  3.    Yields the logical address together with ASi address
  4.    look here: http://www.brix.de/elektrik/sps/asi_s7_cp342.html
  5.    """
  6.     n = 0
  7.     for byte in range(start, start + length):
  8.         for bit in range(4, 8):
  9.             yield ('{}.{}'.format(byte, bit), n)
  10.         n += 1
  11.         for bit in range(0, 4):
  12.             yield ('{}.{}'.format(byte, bit), n)
  13.         n += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement