How to use the minimalmodbus._print_out function in minimalmodbus

To help you get started, we’ve selected a few minimalmodbus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pyhys / minimalmodbus / test / test_minimalmodbus.py View on Github external
def testInputNotString(self):
        for value in _NOT_STRINGS:
            self.assertRaises(TypeError, minimalmodbus._print_out, value)
github pyhys / minimalmodbus / test / test_minimalmodbus.py View on Github external
def testWriteRegisterSuppressErrorMessageAtWrongCRC(self):
        try:
            self.instrument.write_register(51, 99) # Slave gives wrong CRC
        except ValueError:
            minimalmodbus._print_out('Minimalmodbus: An error was suppressed.')
github pyhys / minimalmodbus / test / test_minimalmodbus.py View on Github external
def assertRaises(self, excClass, callableObj, *args, **kwargs):
        """Prints the caught error message (if :data:`SHOW_ERROR_MESSAGES_FOR_ASSERTRAISES` is :const:`True`)."""
        if SHOW_ERROR_MESSAGES_FOR_ASSERTRAISES:
            try:
                unittest.TestCase.assertRaises(self, _NonexistantError, callableObj, *args, **kwargs)
            except:
                minimalmodbus._print_out( '\n    ' + repr(sys.exc_info()[1]) )
        else:
            unittest.TestCase.assertRaises(self, excClass, callableObj, *args, **kwargs)
github pyhys / minimalmodbus / test / test_minimalmodbus.py View on Github external
def testKnownValues(self):
        minimalmodbus._print_out('ABCDEFGHIJKL')
github pyhys / minimalmodbus / omegacn7500.py View on Github external
PORTNAME = '/dev/tty.usbserial-FTFO1057'
    ADDRESS = 10
    
    minimalmodbus._print_out( 'Port: ' +  str(PORTNAME) + ', Address: ' + str(ADDRESS) )
    
    instr = OmegaCN7500(PORTNAME, ADDRESS)
    
    minimalmodbus._print_out( 'Control:                {0}'.format(  instr.get_control_mode()    ))
    minimalmodbus._print_out( 'SP:                     {0}'.format(  instr.get_setpoint() ))
    minimalmodbus._print_out( 'PV:                     {0}'.format(  instr.get_pv()       ))
    minimalmodbus._print_out( 'OP1:                    {0}'.format(  instr.get_output1()  ))   
    minimalmodbus._print_out( 'Is running:             {0}'.format(  instr.is_running()   ))
    minimalmodbus._print_out( 'Start pattern:          {0}'.format(  instr.get_start_pattern_no()  ))

    minimalmodbus._print_out('DONE!')

pass
github pyhys / minimalmodbus / eurotherm3500.py View on Github external
def get_threshold_alarm1(self):
        """Return the threshold value for Alarm1."""
        return self.read_register(10241, 1)
    
    def is_set_alarmsummary(self):
        """Return True if some alarm is triggered."""
        return self.read_register(10213, 1) > 0
    
########################
## Testing the module ##
########################

if __name__ == '__main__':

    minimalmodbus._print_out( 'TESTING EUROTHERM 3500 MODBUS MODULE')

    a = Eurotherm3500('/dev/cvdHeatercontroller', 1)
    a.debug = False
    
    minimalmodbus._print_out( 'SP1:                    {0}'.format(  a.get_sp_loop1()             ))
    minimalmodbus._print_out( 'SP1 target:             {0}'.format(  a.get_sptarget_loop1()       ))
    minimalmodbus._print_out( 'SP2:                    {0}'.format(  a.get_sp_loop2()             ))
    minimalmodbus._print_out( 'SP-rate Loop1 disabled: {0}'.format(  a.is_sprate_disabled_loop1() ))
    minimalmodbus._print_out( 'SP1 rate:               {0}'.format(  a.get_sprate_loop1()         ))
    minimalmodbus._print_out( 'OP1:                    {0}%'.format( a.get_op_loop1()             ))
    minimalmodbus._print_out( 'OP2:                    {0}%'.format( a.get_op_loop2()             ))
    minimalmodbus._print_out( 'Alarm1 threshold:       {0}'.format(  a.get_threshold_alarm1()     ))
    minimalmodbus._print_out( 'Alarm summary:          {0}'.format(  a.is_set_alarmsummary()      ))
    minimalmodbus._print_out( 'Manual mode Loop1:      {0}'.format(  a.is_manual_loop1()          ))
    minimalmodbus._print_out( 'Inhibit Loop1:          {0}'.format(  a.is_inhibited_loop1()       ))
    minimalmodbus._print_out( 'PV1:                    {0}'.format(  a.get_pv_loop1()             ))
github pyhys / minimalmodbus / eurotherm3500.py View on Github external
a = Eurotherm3500('/dev/cvdHeatercontroller', 1)
    a.debug = False
    
    minimalmodbus._print_out( 'SP1:                    {0}'.format(  a.get_sp_loop1()             ))
    minimalmodbus._print_out( 'SP1 target:             {0}'.format(  a.get_sptarget_loop1()       ))
    minimalmodbus._print_out( 'SP2:                    {0}'.format(  a.get_sp_loop2()             ))
    minimalmodbus._print_out( 'SP-rate Loop1 disabled: {0}'.format(  a.is_sprate_disabled_loop1() ))
    minimalmodbus._print_out( 'SP1 rate:               {0}'.format(  a.get_sprate_loop1()         ))
    minimalmodbus._print_out( 'OP1:                    {0}%'.format( a.get_op_loop1()             ))
    minimalmodbus._print_out( 'OP2:                    {0}%'.format( a.get_op_loop2()             ))
    minimalmodbus._print_out( 'Alarm1 threshold:       {0}'.format(  a.get_threshold_alarm1()     ))
    minimalmodbus._print_out( 'Alarm summary:          {0}'.format(  a.is_set_alarmsummary()      ))
    minimalmodbus._print_out( 'Manual mode Loop1:      {0}'.format(  a.is_manual_loop1()          ))
    minimalmodbus._print_out( 'Inhibit Loop1:          {0}'.format(  a.is_inhibited_loop1()       ))
    minimalmodbus._print_out( 'PV1:                    {0}'.format(  a.get_pv_loop1()             ))
    minimalmodbus._print_out( 'PV2:                    {0}'.format(  a.get_pv_loop2()             ))
    minimalmodbus._print_out( 'PV module 3:            {0}'.format(  a.get_pv_module3()           ))
    minimalmodbus._print_out( 'PV module 4:            {0}'.format(  a.get_pv_module4()           ))
    minimalmodbus._print_out( 'PV module 6:            {0}'.format(  a.get_pv_module6()           ))

    #a.set_sprate_loop1(30)
    #a.enable_sprate_loop1() 

    minimalmodbus._print_out( 'DONE!' )

pass
github pyhys / minimalmodbus / omegacn7500.py View on Github external
# Calculate register address
    address = REGISTER_START[registertype] + \
                patternnumber * REGISTER_OFFSET_PER_PATTERN[registertype] + \
                stepnumber * REGISTER_OFFSET_PER_STEP[registertype]
        
    return address
    
    
########################
## Testing the module ##
########################

if __name__ == '__main__':

    minimalmodbus._print_out('TESTING OMEGA CN7500 MODBUS MODULE')

    PORTNAME = '/dev/tty.usbserial-FTFO1057'
    ADDRESS = 10
    
    minimalmodbus._print_out( 'Port: ' +  str(PORTNAME) + ', Address: ' + str(ADDRESS) )
    
    instr = OmegaCN7500(PORTNAME, ADDRESS)
    
    minimalmodbus._print_out( 'Control:                {0}'.format(  instr.get_control_mode()    ))
    minimalmodbus._print_out( 'SP:                     {0}'.format(  instr.get_setpoint() ))
    minimalmodbus._print_out( 'PV:                     {0}'.format(  instr.get_pv()       ))
    minimalmodbus._print_out( 'OP1:                    {0}'.format(  instr.get_output1()  ))   
    minimalmodbus._print_out( 'Is running:             {0}'.format(  instr.is_running()   ))
    minimalmodbus._print_out( 'Start pattern:          {0}'.format(  instr.get_start_pattern_no()  ))

    minimalmodbus._print_out('DONE!')
github pyhys / minimalmodbus / omegacn7500.py View on Github external
########################
## Testing the module ##
########################

if __name__ == '__main__':

    minimalmodbus._print_out('TESTING OMEGA CN7500 MODBUS MODULE')

    PORTNAME = '/dev/tty.usbserial-FTFO1057'
    ADDRESS = 10
    
    minimalmodbus._print_out( 'Port: ' +  str(PORTNAME) + ', Address: ' + str(ADDRESS) )
    
    instr = OmegaCN7500(PORTNAME, ADDRESS)
    
    minimalmodbus._print_out( 'Control:                {0}'.format(  instr.get_control_mode()    ))
    minimalmodbus._print_out( 'SP:                     {0}'.format(  instr.get_setpoint() ))
    minimalmodbus._print_out( 'PV:                     {0}'.format(  instr.get_pv()       ))
    minimalmodbus._print_out( 'OP1:                    {0}'.format(  instr.get_output1()  ))   
    minimalmodbus._print_out( 'Is running:             {0}'.format(  instr.is_running()   ))
    minimalmodbus._print_out( 'Start pattern:          {0}'.format(  instr.get_start_pattern_no()  ))

    minimalmodbus._print_out('DONE!')

pass
github pyhys / minimalmodbus / eurotherm3500.py View on Github external
minimalmodbus._print_out( 'OP1:                    {0}%'.format( a.get_op_loop1()             ))
    minimalmodbus._print_out( 'OP2:                    {0}%'.format( a.get_op_loop2()             ))
    minimalmodbus._print_out( 'Alarm1 threshold:       {0}'.format(  a.get_threshold_alarm1()     ))
    minimalmodbus._print_out( 'Alarm summary:          {0}'.format(  a.is_set_alarmsummary()      ))
    minimalmodbus._print_out( 'Manual mode Loop1:      {0}'.format(  a.is_manual_loop1()          ))
    minimalmodbus._print_out( 'Inhibit Loop1:          {0}'.format(  a.is_inhibited_loop1()       ))
    minimalmodbus._print_out( 'PV1:                    {0}'.format(  a.get_pv_loop1()             ))
    minimalmodbus._print_out( 'PV2:                    {0}'.format(  a.get_pv_loop2()             ))
    minimalmodbus._print_out( 'PV module 3:            {0}'.format(  a.get_pv_module3()           ))
    minimalmodbus._print_out( 'PV module 4:            {0}'.format(  a.get_pv_module4()           ))
    minimalmodbus._print_out( 'PV module 6:            {0}'.format(  a.get_pv_module6()           ))

    #a.set_sprate_loop1(30)
    #a.enable_sprate_loop1() 

    minimalmodbus._print_out( 'DONE!' )

pass