µTasker Forum > MODBUS

MODBUS IP to serial (RTU) gateway

<< < (2/3) > >>

jezc:
Hi Mark,

  Thanks for sending the password (again). ;D

With the latest MODBUS files I've managed to get the Kinetis project compiling ok in the simulator (C++ 2010 Express) - I'm struggling to get the same project working on the 2009 version on a different PC but I'll upgrade to 2010 & see if that sorts it.

Thanks once again for your help with this - it really is appreciated.

I'll let you know when I've sorted it all.

Cheers,
    Jez

PS - I've just tried to get the MODBUS working in the simulator for the LPC1768 (Keil MCB17xx board) target to compare with the Kinetis but that's still reporting compile errors relating to stTIMER_INTERRUPT_SETUP as below

1>c:\downloads\utasker\utasker_lpc17xx_v1.4-1\utasker\modbus\modbus.c(1618): error C2039: 'timer_us_value' : is not a member of 'stTIMER_INTERRUPT_SETUP'
1>          c:\downloads\utasker\utasker_lpc17xx_v1.4-1\hardware\lpc17xx\lpc17xx.h(3661) : see declaration of 'stTIMER_INTERRUPT_SETUP'
1>c:\downloads\utasker\utasker_lpc17xx_v1.4-1\utasker\modbus\modbus.c(1619): error C2039: 'timer_us_value' : is not a member of 'stTIMER_INTERRUPT_SETUP'
1>          c:\downloads\utasker\utasker_lpc17xx_v1.4-1\hardware\lpc17xx\lpc17xx.h(3661) : see declaration of 'stTIMER_INTERRUPT_SETUP'
1>c:\downloads\utasker\utasker_lpc17xx_v1.4-1\utasker\modbus\modbus.c(1622): error C2039: 'timer_us_value' : is not a member of 'stTIMER_INTERRUPT_SETUP'
1>          c:\downloads\utasker\utasker_lpc17xx_v1.4-1\hardware\lpc17xx\lpc17xx.h(3661) : see declaration of 'stTIMER_INTERRUPT_SETUP'
1>c:\downloads\utasker\utasker_lpc17xx_v1.4-1\utasker\modbus\modbus.c(1623): error C2039: 'timer_us_value' : is not a member of 'stTIMER_INTERRUPT_SETUP'
1>          c:\downloads\utasker\utasker_lpc17xx_v1.4-1\hardware\lpc17xx\lpc17xx.h(3661) : see declaration of 'stTIMER_INTERRUPT_SETUP'
1>c:\downloads\utasker\utasker_lpc17xx_v1.4-1\utasker\modbus\modbus.c(1626): error C2039: 'timer_us_value' : is not a member of 'stTIMER_INTERRUPT_SETUP'
1>          c:\downloads\utasker\utasker_lpc17xx_v1.4-1\hardware\lpc17xx\lpc17xx.h(3661) : see declaration of 'stTIMER_INTERRUPT_SETUP'
1>c:\downloads\utasker\utasker_lpc17xx_v1.4-1\utasker\modbus\modbus.c(1627): error C2039: 'timer_us_value' : is not a member of 'stTIMER_INTERRUPT_SETUP'
1>          c:\downloads\utasker\utasker_lpc17xx_v1.4-1\hardware\lpc17xx\lpc17xx.h(3661) : see declaration of 'stTIMER_INTERRUPT_SETUP'
1>c:\downloads\utasker\utasker_lpc17xx_v1.4-1\utasker\modbus\modbus.c(1630): error C2039: 'timer_us_value' : is not a member of 'stTIMER_INTERRUPT_SETUP'
1>          c:\downloads\utasker\utasker_lpc17xx_v1.4-1\hardware\lpc17xx\lpc17xx.h(3661) : see declaration of 'stTIMER_INTERRUPT_SETUP'
1>c:\downloads\utasker\utasker_lpc17xx_v1.4-1\utasker\modbus\modbus.c(1631): error C2039: 'timer_us_value' : is not a member of 'stTIMER_INTERRUPT_SETUP'
1>          c:\downloads\utasker\utasker_lpc17xx_v1.4-1\hardware\lpc17xx\lpc17xx.h(3661) : see declaration of 'stTIMER_INTERRUPT_SETUP'
1>c:\downloads\utasker\utasker_lpc17xx_v1.4-1\utasker\modbus\modbus.c(1635): error C2039: 'timer_us_value' : is not a member of 'stTIMER_INTERRUPT_SETUP'
1>          c:\downloads\utasker\utasker_lpc17xx_v1.4-1\hardware\lpc17xx\lpc17xx.h(3661) : see declaration of 'stTIMER_INTERRUPT_SETUP'
1>c:\downloads\utasker\utasker_lpc17xx_v1.4-1\utasker\modbus\modbus.c(1636): error C2039: 'timer_us_value' : is not a member of 'stTIMER_INTERRUPT_SETUP'
1>          c:\downloads\utasker\utasker_lpc17xx_v1.4-1\hardware\lpc17xx\lpc17xx.h(3661) : see declaration of 'stTIMER_INTERRUPT_SETUP'
1>c:\downloads\utasker\utasker_lpc17xx_v1.4-1\utasker\modbus\modbus.c(1639): error C2039: 'timer_us_value' : is not a member of 'stTIMER_INTERRUPT_SETUP'
1>          c:\downloads\utasker\utasker_lpc17xx_v1.4-1\hardware\lpc17xx\lpc17xx.h(3661) : see declaration of 'stTIMER_INTERRUPT_SETUP'
1>c:\downloads\utasker\utasker_lpc17xx_v1.4-1\utasker\modbus\modbus.c(1640): error C2039: 'timer_us_value' : is not a member of 'stTIMER_INTERRUPT_SETUP'
1>          c:\downloads\utasker\utasker_lpc17xx_v1.4-1\hardware\lpc17xx\lpc17xx.h(3661) : see declaration of 'stTIMER_INTERRUPT_SETUP'
1>c:\downloads\utasker\utasker_lpc17xx_v1.4-1\utasker\modbus\modbus.c(1643): error C2039: 'timer_us_value' : is not a member of 'stTIMER_INTERRUPT_SETUP'
1>          c:\downloads\utasker\utasker_lpc17xx_v1.4-1\hardware\lpc17xx\lpc17xx.h(3661) : see declaration of 'stTIMER_INTERRUPT_SETUP'
1>c:\downloads\utasker\utasker_lpc17xx_v1.4-1\utasker\modbus\modbus.c(1644): error C2039: 'timer_us_value' : is not a member of 'stTIMER_INTERRUPT_SETUP'
1>          c:\downloads\utasker\utasker_lpc17xx_v1.4-1\hardware\lpc17xx\lpc17xx.h(3661) : see declaration of 'stTIMER_INTERRUPT_SETUP'
1>c:\downloads\utasker\utasker_lpc17xx_v1.4-1\utasker\modbus\modbus.c(1648): error C2039: 'timer_us_value' : is not a member of 'stTIMER_INTERRUPT_SETUP'
1>          c:\downloads\utasker\utasker_lpc17xx_v1.4-1\hardware\lpc17xx\lpc17xx.h(3661) : see declaration of 'stTIMER_INTERRUPT_SETUP'
1>c:\downloads\utasker\utasker_lpc17xx_v1.4-1\utasker\modbus\modbus.c(1649): error C2039: 'timer_us_value' : is not a member of 'stTIMER_INTERRUPT_SETUP'
1>          c:\downloads\utasker\utasker_lpc17xx_v1.4-1\hardware\lpc17xx\lpc17xx.h(3661) : see declaration of 'stTIMER_INTERRUPT_SETUP'

Changing the target back to LPC1788 is still giving me the same errors.

Any ideas?

Cheers,
    Jez

kiryat8:
Did you ever get resolved the lack of the lacking timer_us_value field in TIMER_INTERRUPT_SETUP.
I am implementing the Modbus now using the LPC1768 chip and get the same errors.
Thanks

kiryat8:
I downloaded the latest Modbus code to be used with the latest LPC code base.
As I wrote there is no timer_us_value field in the TIMER_INTERRUPT_SETUP structure.
There is also no "_TCP_SOCKET_MASK" macro defined.
Should I use a different Modbus version or where can I get the new defines?

Thanks

kiryat8:
In the LPC's tcpip.h file I added the following that I found in the kinetis version.
Now

// ?!? added
#if IP_INTERFACE_COUNT > 1 || IP_NETWORK_COUNT > 1                       // {74}
    #define _TCP_SOCKET_MASK_ASSIGN(uSocket)  (uSocket &= (SOCKET_NUMBER_MASK))
    #define _TCP_SOCKET_MASK(uSocket)  (USOCKET)((uSocket) & (SOCKET_NUMBER_MASK))
    #define _UDP_SOCKET_MASK_ASSIGN(uSocket)  (uSocket &= (SOCKET_NUMBER_MASK))
    #define _UDP_SOCKET_MASK(uSocket)  (USOCKET)((uSocket) & (SOCKET_NUMBER_MASK))
#else
    #define _TCP_SOCKET_MASK_ASSIGN(uSocket)                             // does nothing when single interface and single networks
    #define _TCP_SOCKET_MASK(uSocket) (uSocket)
    #define _UDP_SOCKET_MASK_ASSIGN(uSocket)
    #define _UDP_SOCKET_MASK(uSocket) (uSocket)
#endif

mark:
Hi

The LPC17xx project doesn't use "timer_us_value"but instead uses "timer_value". [this is partly historical due to compatibility with the LPC2xxx code and partly due to its hardware timer capability - usually this detail is not really noticed by users]

This is controlled in the MODBUS code by the conditional expression:
#if defined _LM3SXXXX || defined _STM32 || (defined _HW_TIMER_MODE && (defined _LPC23XX || defined _LPC17XX))

_HW_TIMER_MODE is a fixed define (see lpc17xx.h) so it looks like _LPC17XX is missing when building this file. _LPC17XX is passed as a pre-processor define to all files - eg. in the GCC make file:
-D _GNU -D _LPC17XX

If you are using a different tool chain and you added these files to the project they "may" have been added without these so edit the build property of MODBUS.c (in the IDE's property setting) and then I expect that the problem will be solved.

In the case of _TCP_SOCKET_MASK() the LPC17xx project needs this as an empty macro #define _TCP_SOCKET_MASK(uSocket) (uSocket). This allows the MODBUS module to be used on multiple networks, interfaces and/or VLANs (eg. one socket on the Ethernet, one on a serial interface and multiple IP addresses). Since the LPC17XX project doesn't (presently) include multi-networking code the define needs to be added manually (since quite recently). I have just added a note in the release notes to avoid this difficulty again.

Regards

Mark



Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version