UT330BUI/model/UT330.py
def write_datetime(self, timestamp):

        """Syncs the time to the timestamp"""

        # The command to send, note we'll be overriding some bytes
        self._buffer = [0xab, 0xcd, 0x09, 0x12, 0, 0, 0, 0, 0, 0, 0, 0]

        self._buffer[4] = timestamp.year - 2000
        self._buffer[5] = timestamp.month
        self._buffer[6] = timestamp.day
        self._buffer[7] = timestamp.hour
        self._buffer[8] = timestamp.minute
        self._buffer[9] = timestamp.second

        # Add the CRC bytes
        self._buffer[11], self._buffer[10] = modbusCRC(self._buffer[0:10])

        self._write_buffer()

        # Now get the response data from the buffer
        self._read_buffer(7)

        # Check the return code shows the data was correctly written
        if [171, 205, 4, 18, 0, 114, 21] != self._buffer:
            raise IOError("Error! Writing datetime returned error code.")
Syncs the time to the timestamp
Syncs the time to the timestamp
Syncs the time to the timestamp
def write_datetime(self, timestamp):
        self._buffer = [0xab, 0xcd, 0x09, 0x12, 0, 0, 0, 0, 0, 0, 0, 0]
        self._buffer[4] = timestamp.year - 2000
        self._buffer[5] = timestamp.month
        self._buffer[6] = timestamp.day
        self._buffer[7] = timestamp.hour
        self._buffer[8] = timestamp.minute
        self._buffer[9] = timestamp.second
        self._buffer[11], self._buffer[10] = modbusCRC(self._buffer[0:10])
        self._write_buffer()
        self._read_buffer(7)
        if [171, 205, 4, 18, 0, 114, 21] != self._buffer:
            raise IOError("Error! Writing datetime returned error code.")
def write_datetime ( self , timestamp ) : self . _buffer = [ 0xab , 0xcd , 0x09 , 0x12 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] self . _buffer [ 4 ] = timestamp . year - 2000 self . _buffer [ 5 ] = timestamp . month self . _buffer [ 6 ] = timestamp . day self . _buffer [ 7 ] = timestamp . hour self . _buffer [ 8 ] = timestamp . minute self . _buffer [ 9 ] = timestamp . second self . _buffer [ 11 ] , self . _buffer [ 10 ] = modbusCRC ( self . _buffer [ 0 : 10 ] ) self . _write_buffer ( ) self . _read_buffer ( 7 ) if [ 171 , 205 , 4 , 18 , 0 , 114 , 21 ] != self . _buffer : raise IOError ( "Error! Writing datetime returned error code." )
Syncs the time to the timestamp
Syncs the time to the timestamp
"""Syncs the time to the timestamp""" # The command to send, note we'll be overriding some bytes # Add the CRC bytes # Now get the response data from the buffer # Check the return code shows the data was correctly written
self
timestamp