Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Modbus Slave CR310


GliRam Jul 25, 2024 06:42 PM

Tengo un Cr310 que programe desde CrBasic como servidor Modbus, y quiero que los datos de modbus register sean arrojados en un software aparte que se llama Modbus Slave, o desde Modbus Poll, para el Modbus Slave si logro coneccion con el cr310, pero no se actualiza la tabla ni refleja ningun cambio, y con Modbus Poll al conectar dice que el tiempo de espera vencio, si alguien puede apoyarme con esa parte y ser muy especifico en su respuesta, ya que soy nueva en todo este tema del Modbus.

Inserto mi codigo para revision.

'Declare variables

Public SEVolt(18)

Public PTemp_C

Public BattV

Public ModbusRegister(20)

Public ModbusCoil As Boolean 
Units SEVolt=mV

Units PTemp_C=C

Units BattV=Volts 
'Define Data Tables

DataTable (Hourly,True,-1) 

DataInterval(0,60,Min,10) 

Sample(18,SEVolt(),FP2)

EndTable

DataTable(Daily,True,-1) 

DataInterval(0,1440,Min,10) 

Average (18,SEVolt(),FP2,False)

EndTable

'Main Program'! 

BeginProg   

SW12 (1 )

'provide power to AM16/32B 

ModbusSlave (502,0,1,ModbusRegister(),ModbusCoil,0) 

'Main Scan

 Scan(30,Sec,1,0) 

  '>>>>>> SET 1   

'Turn AM16/32B Multiplexer On, start measurements on multiplexer channel 1   

MuxSelect (C1,C2 ,20,1,1) 

  '3 repetitions, writing to SEVolt(1), SEVolt(2) and SEVolt(3)   

'3 repetitions, measuring 1L, 2H, 2L on multiplexer

 VoltSe(SEVolt(1),3,mv2500,1,True,0,60,1,0) 

  '>>>>>> SET 2 

  PulsePort (C1 ,30000) 'to move to SET 2   

'3 repetitions, writing to SEVolt(4), SEVolt(5) and SEVolt(6)    '3 repetitions, measuring 3L, 4H, 4L on multiplexer 

  VoltSe(SEVolt(4),3,mv2500,1,True,0,60,1,0)   

'>>>>>> SET 3   

PulsePort (C1 ,30000) 'to move to SET 3 

  '3 repetitions, writing to SEVolt(7), SEVolt(8) and SEVolt(9) 

  '3 repetitions, measuring 5L, 6H, 6L on multiplexer 

  VoltSe(SEVolt(7),3,mv2500,1,True,0,60,1,0) 

  'Turn AM16/32B Multiplexer Off 

  PulsePort(C2,30000) 

  VoltSe(SEVolt(10),4,mv2500,1,True,0,60,1,0) 

  PulsePort(C2,30000)    '3 repetitions, writing to SEVolt(11), SEVolt(12) and SEVolt(13) 

  '3 repetitions, measuring 7L, 8H, 8L on multiplexer    VoltSe(SEVolt(14),3,mv2500,1,True,0,60,1,0)   

PulsePort(C2,30000) 

  '3 repetitions, writing to SEVolt(15), SEVolt(16) and SEVolt(17)   

'3 repetitions, measuring 9L, 10H, 11L on multiplexer   

VoltSe(SEVolt(17),2,mv2500,1,True,0,60,1,0)   

PortSet(C2,0)   

'3 repetitions, writing to SEVolt(18), SEVolt(19) and SEVolt(20)   

'3 repetitions, measuring 9L, 10H, 11L on multiplexer 

  ModbusRegister(1)=PTemp_C 

  ModbusRegister(2)=BattV   

ModbusRegister(3)=SEVolt(1)

    ModbusRegister(4)=SEVolt(2)

    ModbusRegister(5)=SEVolt(3)

    ModbusRegister(6)=SEVolt(4)

    ModbusRegister(7)=SEVolt(5)

    ModbusRegister(8)=SEVolt(6)

    ModbusRegister(9)=SEVolt(7) 

  ModbusRegister(10)=SEVolt(8)

    ModbusRegister(11)=SEVolt(9)

    ModbusRegister(12)=SEVolt(10)

    ModbusRegister(13)=SEVolt(11)

    ModbusRegister(14)=SEVolt(12)

    ModbusRegister(15)=SEVolt(13)

    ModbusRegister(16)=SEVolt(14)

    ModbusRegister(17)=SEVolt(15)

    ModbusRegister(18)=SEVolt(16)

    ModbusRegister(19)=SEVolt(17)

    ModbusRegister(20)=SEVolt(18)


    'Call Data Tables and Store Data 

  CallTable Hourly   

CallTable Daily 

NextScanEndProg

Log in or register to post/reply in the forum.