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.

Problema con cmunicación Modbus RS485 con CR1000X


nanopol Jul 19, 2019 12:31 AM

Hola,

estoy comunicando un inversor solar con un datalogger CR1000X usando el protocolo Modbus y su interfaz RS485 (C7 / C8).

La interfaz del inversor solar es RS485, 19200 baud, no paridad, 8 bits, un bit de parada.

el codigo que uso es el siguiente:

 

Public PTemp, BATT
Dim Modbus_temp As Long
Public Modbus_value(7)
Dim Modbus_address(7) = {15201,15205,15207,15213,25205,25206,25209}
Dim Modbus_slope(7) = {1,0.1,0.1,1,0.1,0.1,0.1}
Public Modbus_result(7)

Alias Modbus_value(1) = Charger_workstate  '15201
Alias Modbus_value(2) = Panel_volt  '15205
Alias Modbus_value(3) = Charger_current  '15207
Alias Modbus_value(4) = Charger_error  '15213
Alias Modbus_value(5) = Battery_volt  '25205
Alias Modbus_value(6) = Inverter_volt  '25206
Alias Modbus_value(7) = Discharge_current  '25209

Dim j

DataTable (Soporte_05_min,1,-1)
	DataInterval (0,5,Min,10)
	Minimum (1,BATT,FP2,False,False)
	Sample (1,PTemp,FP2)
	Sample (1,Charger_workstate,FP2)
	Sample (1,Panel_volt,FP2)
	Sample (1,Charger_current,FP2)
	Sample (1,Charger_error,FP2)
	Sample (1,Battery_volt,FP2)
	Sample (1,Inverter_volt,FP2)
	Sample (1,Discharge_current,FP2)
EndTable

SequentialMode
BeginProg
SerialOpen (ComC7,19200,0,100,100,4)
Scan (5,Sec,0,0)
	SerialFlush(ComC7)
	For j=1 To 7
		ModbusMaster (Modbus_result(j),ComC7,19200,4,3,Modbus_temp,Modbus_address(j)+1,1,1,100,1)
		If Modbus_result(j) = 0 Then
			Modbus_value(j) = Modbus_temp * Modbus_slope(j)
		Else
			Modbus_value(j) = NAN
		EndIf
	Next j
    
		CallTable Soporte_05_min
	NextScan
	
EndProg

 

No se si estoy cometiendo un error en la programacion pero no consigo obtener lecturas. Use un programa similar con un CR1000 y un adaptador RS232-RS485 y el puerto RS232 del datalogger con exito (los puertos Com1 al Com4 solo me leian la mitad de los registros). 

A la espera de sus comentarios, saludos.

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