Not applicable
Feb 04, 2015
01:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 04, 2015
01:58 AM
Hi,
I have just started with the implementation of a MODBUS RTU slave according to DAVE3 app MODBUS001_Example.
By using the callback function " MyHoldingCB" in the Example2, I always receive with the variable "usAddress" with a value bigger by 1 as my adjusted address.
Here the declaration of this function:
eMBErrorCode MyHoldingCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs, eMBRegisterMode eMode );
Has some one recognised the same behavior or can explain the reason for that?
Thanks,
I have just started with the implementation of a MODBUS RTU slave according to DAVE3 app MODBUS001_Example.
By using the callback function " MyHoldingCB" in the Example2, I always receive with the variable "usAddress" with a value bigger by 1 as my adjusted address.
Here the declaration of this function:
eMBErrorCode MyHoldingCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs, eMBRegisterMode eMode );
Has some one recognised the same behavior or can explain the reason for that?
Thanks,
3 Replies
Not applicable
Feb 04, 2015
05:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 04, 2015
05:25 AM
Maybe this behavior caused by the Modbus-Master system. In some documents I have found " 0-based, 1-based, addressing style".
I'm using the Modbus Devices Tester by Global Multimedia.
I'm using the Modbus Devices Tester by Global Multimedia.
Feb 11, 2015
04:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 11, 2015
04:14 AM
Hi abkai,
From the software function, it seems quite reasonable for the "usAddress" to be more than value 1 else it is consider an error. Did you manage to get into the switch (eMode)?
if( ( usAddress >= REG_HOLDING_START ) &&
( usAddress + usNRegs <= REG_HOLDING_START + REG_HOLDING_NREGS ) )
{
iRegIndex = ( int )( usAddress - usRegHoldingStart );
switch ( eMode )
{
/* Pass current register values to the protocol stack. */
case MB_REG_READ:
From the software function, it seems quite reasonable for the "usAddress" to be more than value 1 else it is consider an error. Did you manage to get into the switch (eMode)?
if( ( usAddress >= REG_HOLDING_START ) &&
( usAddress + usNRegs <= REG_HOLDING_START + REG_HOLDING_NREGS ) )
{
iRegIndex = ( int )( usAddress - usRegHoldingStart );
switch ( eMode )
{
/* Pass current register values to the protocol stack. */
case MB_REG_READ:
Not applicable
Mar 19, 2015
03:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 19, 2015
03:57 AM
Hi Travis,
If I understand you right, the address will start from 1.
On my MODBUS Master system I can choose the address range (starting form 0 or 1). When the Master systems starts from 1 anything is fine. But if I choose the start address from 0, I could not adjust this in the MODBUS functions. I have to handle this in my application code.
In the main.c software from Dave3 example the start address is set to 1 (usRegHoldingStart=1) but when you chamge it to 0 or another value it has no influance on the MOSBUS function.
If I understand you right, the address will start from 1.
On my MODBUS Master system I can choose the address range (starting form 0 or 1). When the Master systems starts from 1 anything is fine. But if I choose the start address from 0, I could not adjust this in the MODBUS functions. I have to handle this in my application code.
In the main.c software from Dave3 example the start address is set to 1 (usRegHoldingStart=1) but when you chamge it to 0 or another value it has no influance on the MOSBUS function.