Modbus Slave Address
Moderator: Benj
-
- Posts: 54
- Joined: Mon Dec 30, 2013 2:09 am
- Has thanked: 15 times
- Been thanked: 10 times
- Contact:
Modbus Slave Address
Modbus Slave address and baud rate can be edited by component macro call commands.
For exemple i want to use Switch Array for editing slave address and baud rate but i can't do it now.
Every time i have to edit in program modbus slave component properties.
In this case you can't write a common program.
For exemple i want to use Switch Array for editing slave address and baud rate but i can't do it now.
Every time i have to edit in program modbus slave component properties.
In this case you can't write a common program.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Modbus Slave Address
Hello,
Good suggestion there.
I have now added additional macros to allow the Baud rate and Slave address to be overridden in software so they are no longer fixed in stone by the property settings.
For now I left the slave address byte count fixed by the property to avoid using another RAM location but this could easily be changed too.
Let me know how you get on.
Good suggestion there.
I have now added additional macros to allow the Baud rate and Slave address to be overridden in software so they are no longer fixed in stone by the property settings.
For now I left the slave address byte count fixed by the property to avoid using another RAM location but this could easily be changed too.
Let me know how you get on.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Steve001
- Valued Contributor
- Posts: 1189
- Joined: Wed Dec 31, 2008 3:37 pm
- Has thanked: 460 times
- Been thanked: 523 times
- Contact:
Re: Modbus Slave Address
could I add a suggestion please ?
I haven't had chance to look at V7 yet though sorry if it's answered
could the parity be made adjustable in software also odd, even, none ?
Steve
I haven't had chance to look at V7 yet though sorry if it's answered
could the parity be made adjustable in software also odd, even, none ?
Steve
Success always occurs in private and failure in full view.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Modbus Slave Address
Hi Steve,
We don't currently deal at all with parity. You can force it yourself by putting the comms into 9-bit mode and calculating the parity on the 8-bit data your sending.
However this is quite long hand and would be tricky if not impossible to do for multi layer components like Modbus.
Therefore we could automate as an optional feature from the CAL UART and then expose the options in the components that might need it. I'll add it to the tracked requests list.
We don't currently deal at all with parity. You can force it yourself by putting the comms into 9-bit mode and calculating the parity on the 8-bit data your sending.
However this is quite long hand and would be tricky if not impossible to do for multi layer components like Modbus.
Therefore we could automate as an optional feature from the CAL UART and then expose the options in the components that might need it. I'll add it to the tracked requests list.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 54
- Joined: Mon Dec 30, 2013 2:09 am
- Has thanked: 15 times
- Been thanked: 10 times
- Contact:
Re: Modbus Slave Address
i have a small problemBenj wrote:Hello,
Good suggestion there.
I have now added additional macros to allow the Baud rate and Slave address to be overridden in software so they are no longer fixed in stone by the property settings.
For now I left the slave address byte count fixed by the property to avoid using another RAM location but this could easily be changed too.
Let me know how you get on.
Please see the attach.
- Attachments
-
- prb1.jpg
- (364.07 KiB) Downloaded 2169 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Modbus Slave Address
Sorry I forgot to make the new macros public. They should be there now.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 54
- Joined: Mon Dec 30, 2013 2:09 am
- Has thanked: 15 times
- Been thanked: 10 times
- Contact:
Re: Modbus Slave Address
As i say before...Benj wrote:Sorry I forgot to make the new macros public. They should be there now.
You are my hero.
I will always love you and matrix team.
-
- Posts: 12
- Joined: Sun May 09, 2010 7:57 pm
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Re: Modbus Slave and Modbus Master not communicates
The Modbus Master on Flowcode V6 communicate correct.
The Modbus Master and slave on Flowcode V7 no communicates
Use the device ATXMega 32A4
I attach the program used
Please check the componets
Thanks
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Modbus Slave Address
Hello Konstantiant,
Are you saying a program created using Flowcode v6 works fine but the exact same program and setup using Flowcode v7 has a problem?
If so then please can you post the C files created by v6 and v7 and I will investigate the differences. The Modbus master component has not been massively changed for v7 so there shouldn't be any massive differences causing problems.
Or are you saying that the new Modbus Slave component in v7 is not working how you are expecting?
Are you saying a program created using Flowcode v6 works fine but the exact same program and setup using Flowcode v7 has a problem?
If so then please can you post the C files created by v6 and v7 and I will investigate the differences. The Modbus master component has not been massively changed for v7 so there shouldn't be any massive differences causing problems.
Or are you saying that the new Modbus Slave component in v7 is not working how you are expecting?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 444
- Joined: Tue Apr 15, 2014 4:19 pm
- Location: Kajaani, Finland
- Has thanked: 345 times
- Been thanked: 227 times
- Contact:
Re: Modbus Slave Address
By creating FC6 and FC7 from the flowchart and comparing those in notepad++ attached there, the V7 has something new on ASCII characters, but not codebreaking...Benj wrote:Hello Konstantiant,
Are you saying a program created using Flowcode v6 works fine but the exact same program and setup using Flowcode v7 has a problem?
If so then please can you post the C files created by v6 and v7 and I will investigate the differences. The Modbus master component has not been massively changed for v7 so there shouldn't be any massive differences causing problems.
Or are you saying that the new Modbus Slave component in v7 is not working how you are expecting?
EDIT: DOH, you dont need default always, silly meEtsDriver wrote: But then i spotted this: The default statement is missing on FC7 created file? Could this be the bug Konstantiant has encountered when loading hex created from this to MCU? [/size]
Could it be that the FC7 doesnt like the buffered display he is using? --> cant find same component on FC7 display's menu?
Could you verify that the display you are using is working correctly on V7 alone, without MODBUS component? Thats only thing that seems to differ in generated code, the handling of ascii characters part:
This under V7
Code: Select all
/*========================================================================*\
Use :Base_GLCD
:Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
Use :Gets a byte of the embedded ASCII font data.
:
:Parameters for macro ReadASCIILUT:
: pos_str : ASCII position -32 so A = 'A' - 32 = 33
: count : Font column Ranging 0-4
:
:Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_0ba71_Base_GLCD__ReadASCIILUT(MX_UINT8 FCL_POS_STR, MX_UINT8 FCL_COUNT)
{
//Local variable definitions
MX_UINT16 FCL_POSITION;
MX_UINT8 FCR_RETVAL;
#if (1) // 1 == 1
if (FCL_POS_STR > 94)
{
FCR_RETVAL = 0xaa;
} else {
FCL_POSITION = (FCL_POS_STR * 5) + FCL_COUNT;
FCR_RETVAL = FCD_00fb1_ASCIIData__INTLIST(FCL_POSITION);
}
// #else
//Code has been optimised out by the pre-processor
#endif
return (FCR_RETVAL);
}
Code: Select all
/*========================================================================*\
Use :Base_GLCD
:Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
Use :Gets a byte of the embedded ASCII font data.
:
:Parameters for macro ReadASCIILUT:
: pos_str : ASCII position -32 so A = 'A' - 32 = 33
: count : Font column Ranging 0-4
:
:Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_0ba71_Base_GLCD__ReadASCIILUT(MX_UINT8 FCL_POS_STR, MX_UINT8 FCL_COUNT)
{
//Local variable definitions
MX_UINT8 FCL_POSITION;
MX_UINT8 FCR_RETVAL;
#if (1) // 1 == 1
FCL_POSITION = FCL_POS_STR / 12;
switch (FCL_POSITION)
{
case 0:
{
FCL_POSITION = (FCL_POS_STR * 5) + FCL_COUNT;
FCR_RETVAL = FCD_00fb1_ASCII0__INTLIST(FCL_POSITION);
break;
}
case 1:
{
FCL_POSITION = ((FCL_POS_STR - 12) * 5) + FCL_COUNT;
FCR_RETVAL = FCD_00fb2_ASCII1__INTLIST(FCL_POSITION);
break;
}
case 2:
{
FCL_POSITION = ((FCL_POS_STR - 24) * 5) + FCL_COUNT;
FCR_RETVAL = FCD_00fb3_ASCII2__INTLIST(FCL_POSITION);
break;
}
case 3:
{
FCL_POSITION = ((FCL_POS_STR - 36) * 5) + FCL_COUNT;
FCR_RETVAL = FCD_00fb4_ASCII3__INTLIST(FCL_POSITION);
break;
}
case 4:
{
FCL_POSITION = ((FCL_POS_STR - 48) * 5) + FCL_COUNT;
FCR_RETVAL = FCD_00fb5_ASCII4__INTLIST(FCL_POSITION);
break;
}
case 5:
{
FCL_POSITION = ((FCL_POS_STR - 60) * 5) + FCL_COUNT;
FCR_RETVAL = FCD_00fb6_ASCII5__INTLIST(FCL_POSITION);
break;
}
case 6:
{
FCL_POSITION = ((FCL_POS_STR - 72) * 5) + FCL_COUNT;
FCR_RETVAL = FCD_00fb8_ASCII6__INTLIST(FCL_POSITION);
break;
}
case 7:
{
FCL_POSITION = ((FCL_POS_STR - 84) * 5) + FCL_COUNT;
FCR_RETVAL = FCD_00fb7_ASCII7__INTLIST(FCL_POSITION);
break;
}
default:
{
FCR_RETVAL = 0;
FCR_RETVAL = 0xaa;
}
}
// #else
//Code has been optimised out by the pre-processor
#endif
return (FCR_RETVAL);
}
- Attachments
-
- Test-Modbus_PresetSingleRegister_v7.c
- V7
- (69.95 KiB) Downloaded 257 times
-
- Test-Modbus_PresetSingleRegister.c
- V6 file
- (76.45 KiB) Downloaded 288 times
Ill just keep the good work up!
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Modbus Slave Address
Hello,
Nothing is jumping out as obvious to me. I had changed the way the gLCD fonts work slightly as arrays greater than 256 characters are now allowed on 8-bit PIC and everything else so I simply use one font array instead of 8. I also added a new font type but again this shouldn't cause any issues. If the gLCD is working well in other programs and correctly printing out values then I can't see the changes having any ill effect.
Nothing is jumping out as obvious to me. I had changed the way the gLCD fonts work slightly as arrays greater than 256 characters are now allowed on 8-bit PIC and everything else so I simply use one font array instead of 8. I also added a new font type but again this shouldn't cause any issues. If the gLCD is working well in other programs and correctly printing out values then I can't see the changes having any ill effect.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 12
- Joined: Sun May 09, 2010 7:57 pm
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Re: Modbus Slave Address
Hello
I noticed that the program that I sent you (Test-Modbus_PresetSingleRegister), when you disable the Display the Modbus Master of function properly as in version 6. But,the Modbus Slave I have not been able to communicate. The settings I use is:Baud Rate=9600, Data Bits=8, Parity=None, Stop Bits=1, Time Out=1000ms on the Modbus Tester
Could you send me a example your own that works properly in Modbus Slave AVR
Thanks
I noticed that the program that I sent you (Test-Modbus_PresetSingleRegister), when you disable the Display the Modbus Master of function properly as in version 6. But,the Modbus Slave I have not been able to communicate. The settings I use is:Baud Rate=9600, Data Bits=8, Parity=None, Stop Bits=1, Time Out=1000ms on the Modbus Tester
Could you send me a example your own that works properly in Modbus Slave AVR
Thanks
-
- Posts: 12
- Joined: Sun May 09, 2010 7:57 pm
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Re: Modbus Slave Address
Hello
Does anyone have communicated with Modbus Slave components ?
If there is any malfunction, could you tell me about when you are ready?
Thanks
Does anyone have communicated with Modbus Slave components ?
If there is any malfunction, could you tell me about when you are ready?
Thanks
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Modbus Slave Address
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 54
- Joined: Mon Dec 30, 2013 2:09 am
- Has thanked: 15 times
- Been thanked: 10 times
- Contact:
Re: Modbus Slave Address
Ben i want to stop asking but you know i am like a litle child
In the future will we have an option TCP/IP for modbus slave?
In the future will we have an option TCP/IP for modbus slave?
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Modbus Slave Address
Hello,
TCP/IP would certainly be very nice. The main thing blocking this at the moment is which TCP/IP module to choose from. They all work in different ways meaning implementing one size fits all is not really possible. We could do an on-board TCP/IP stack but then we need to implement this and it is a fair amount of work. For me the ESP8266 and ENC28J60 are both viable options for a wired or wireless connection but as I say we would likely have to force commonality between the modules to help make this possible.
We want to do more networking bits and pieces in the future, specifically things like IOT and LoraWAN so hopefully we will bite off a piece of technology that will also allow TCP/IP with Modbus.
TCP/IP would certainly be very nice. The main thing blocking this at the moment is which TCP/IP module to choose from. They all work in different ways meaning implementing one size fits all is not really possible. We could do an on-board TCP/IP stack but then we need to implement this and it is a fair amount of work. For me the ESP8266 and ENC28J60 are both viable options for a wired or wireless connection but as I say we would likely have to force commonality between the modules to help make this possible.
We want to do more networking bits and pieces in the future, specifically things like IOT and LoraWAN so hopefully we will bite off a piece of technology that will also allow TCP/IP with Modbus.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 58
- Joined: Sat Nov 03, 2012 7:43 am
- Has thanked: 12 times
- Been thanked: 5 times
- Contact:
Re: Modbus Slave Address
Hello Benj
With the constant evolution of the flowcode and together with the technology of industrial electronic equipment, has it been possible to verify the creation of a modbus TCP IP component to communicate with the Ethernet module w5100?
With the constant evolution of the flowcode and together with the technology of industrial electronic equipment, has it been possible to verify the creation of a modbus TCP IP component to communicate with the Ethernet module w5100?