Hello Guest it is April 27, 2024, 11:05:11 AM

Author Topic: Modbus registers not updating but M4 registers are... ??  (Read 1120 times)

0 Members and 1 Guest are viewing this topic.

Modbus registers not updating but M4 registers are... ??
« on: October 14, 2023, 01:30:29 PM »
Hi all,

I am working on my toolchanger integration and currently have a test panel set up in Mach that sends/receives commands from my toolchanger PLC over ModbusTCP.

I've noticed that the outgoing Modbus holding registers are not updating but the coils are.  I'm using sliders for the holding regs and buttons for the coils.  The Mach variables corresponding to the modbus regs will update, but for some reason, the modbus register is not.

I think here a picture is worth 1000 words .  As you can see, register TC_87 "changer command" on the GUI slider has no issue updating the M4 registers, but for some reason, the same register in the Modbus Diagnostics tool is not updating.

I've also attached the modbus config in case there's something I missed.

The coils work perfectly.  I haven't tested the incoming HREGs but that is next...
Re: Modbus registers not updating but M4 registers are... ??
« Reply #1 on: October 14, 2023, 02:24:36 PM »
Another item:  I have each of the coils tied to a signal, this is not possible for the hregs. that could be my issue.

Here is the machine.ini excerpt for my hregs:
Code: [Select]
[ModbusDevice/H7\ ToolChanger/function2]
Desc=F2_Outgoing
Type=7
SlaveAddr=1
MbAddr=87
NbrRegs=3
BitPack=0
Bits=0
ReadAs=0
InitialState=1
ScanDenominator=1
Res0=TC87_CMD_ACTION
Res1=TC88_CMD_SLOT
Res2=TC89_CMD_SLOT_FCN
[ModbusDevice/H7\ ToolChanger/function2/TC87_CMD_ACTION]
Desc=TC87_CMD_ACTION: int 0 (do nothing), 1 (get), 2 (replace), 3 (deploy arm), 4(stow arm), 5 (rehome), 6(rescan slots)
Type=256
RegIndex=0
BitIndex=0
[ModbusDevice/H7\ ToolChanger/function2/TC88_CMD_SLOT]
Desc=TC88_CMD_SLOT: slot number: int 0(no movement), 1 - 10(slot number)
Type=256
RegIndex=0
BitIndex=0
[ModbusDevice/H7\ ToolChanger/function2/TC89_CMD_SLOT_FCN]
Desc=TC89_CMD_SLOT_FCN: Slot Function: int 0 (do nothing), 1 (go), 2(retry), 3(check tool presence from memory)
Type=256
RegIndex=0
BitIndex=0

Incidentally, if this helps anyone, I decided to organize my modbus communication into functions.  This way I could group the similar actions and maintain continuous register numbering (for higher throughput).