Author Topic: Charge Controller Communication  (Read 1766 times)

rbelknap

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Charge Controller Communication
« on: February 03, 2017, 12:38:45 PM »
I'm trying to communicate with a Midnite Classic 150 Charge Controller.
I have it setup to charge batteries from a solar array.

I'm using the Modbus TCPIP driver, but think I'm messed up in how to address the registers.

For example the Modbus spec for it shows Register 4101 is the PCB version. 
It's a 16 bit register and I can't seem to make it work.

It's been a bit since I tried it, but I just had a basic label on my form with addresses like:
4101
40101
44101
etc. 

I think if I can get my head wrapped around how to form the address I can make it work.
Any help is much appreciated.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Charge Controller Communication
« Reply #1 on: February 03, 2017, 04:33:17 PM »
Try 44102

To understand Modbus, you have to understand Modicon addressing, Modbus function codes, and Modbus registers.

The underlying protocol uses function codes and register offset to read/write various registers. For example, to read register number 100 in the integer table, you would use function code 3 with an offset of 100. To write to the same register, you would use function code 6.

Modicon addressing is a way to refer to these registers without having to deal with function codes. The first digit in a Modicon address indicates the register memory space. The number after the following digit indicates the register offset. To make things confusing, the first register of Modicon addressing starts with 1, but Modbus starts with 0.

So now lets say you want to access the register mentions above with a Modicon style address. Since it is an integer, the first digit will be 4. The register number is 100, which is really the 101st register. So the Modicon address will be 40101

Note the first digit is really independent of the rest of the address. So 40101 references the same register as 400101

If your documentation says it is register 4101 (assuming it is decimal and not hex), then you add 1 to that and prefix with a 4, therefore making 44102


rbelknap

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Re: Charge Controller Communication
« Reply #2 on: February 07, 2017, 12:54:50 PM »
Archie,

Thanks for the reply.

This is at my seasonal Camp, so I only get to try it on the occasions I'm there.
I will try it this weekend and see how it goes.

Thanks Again.