Page 1 of 1

Modbus Slave Address

Posted: Mon Jul 18, 2016 8:31 pm
by lordhex
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.

Re: Modbus Slave Address

Posted: Wed Jul 20, 2016 10:43 am
by Benj
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.
ModbusSlave.fcpx
(20.88 KiB) Downloaded 407 times
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.

Re: Modbus Slave Address

Posted: Wed Jul 20, 2016 12:36 pm
by Steve001
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

Re: Modbus Slave Address

Posted: Wed Jul 20, 2016 1:23 pm
by Benj
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.

Re: Modbus Slave Address

Posted: Thu Jul 21, 2016 1:29 pm
by lordhex
Benj 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.
The attachment ModbusSlave.fcpx is no longer available
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.
i have a small problem :)
Please see the attach.

Re: Modbus Slave Address

Posted: Thu Jul 21, 2016 2:15 pm
by Benj
Sorry I forgot to make the new macros public. They should be there now.
ModbusSlave.fcpx
(21.15 KiB) Downloaded 410 times

Re: Modbus Slave Address

Posted: Thu Jul 21, 2016 6:31 pm
by lordhex
Benj wrote:Sorry I forgot to make the new macros public. They should be there now.
ModbusSlave.fcpx
As i say before...
You are my hero.
I will always love you and matrix team.

Re: Modbus Slave and Modbus Master not communicates

Posted: Mon Jul 25, 2016 11:13 am
by Konstantiant
Test-Modbus_PresetSingleRegister.fcfx
Modbus Master FCV6 Working
(52.95 KiB) Downloaded 416 times
Hi
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

Re: Modbus Slave Address

Posted: Mon Jul 25, 2016 5:24 pm
by Benj
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?

Re: Modbus Slave Address

Posted: Mon Jul 25, 2016 6:51 pm
by EtsDriver
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?
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...
EtsDriver wrote: But then i spotted this:
Default differences.JPG
(196.84 KiB) Downloaded 2065 times
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]
EDIT: DOH, you dont need default always, silly me :lol:

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);

}
This under V6

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);

}

Re: Modbus Slave Address

Posted: Tue Jul 26, 2016 10:26 am
by Benj
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.

Re: Modbus Slave Address

Posted: Tue Jul 26, 2016 5:25 pm
by Konstantiant
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
USBSuit.png
Logic Analyser
(185.87 KiB) Downloaded 2036 times
Modbus-Slave-RS232 No Display.fcfx
(8.62 KiB) Downloaded 256 times
Thanks

Re: Modbus Slave Address

Posted: Sat Jul 30, 2016 11:34 pm
by Konstantiant
Hello

Does anyone have communicated with Modbus Slave components ?
If there is any malfunction, could you tell me about when you are ready?

Thanks

Re: Modbus Slave Address

Posted: Mon Aug 01, 2016 12:28 pm
by Benj

Re: Modbus Slave Address

Posted: Mon Aug 08, 2016 9:31 pm
by lordhex
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?

Re: Modbus Slave Address

Posted: Tue Aug 09, 2016 9:45 am
by Benj
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.

Re: Modbus Slave Address

Posted: Thu Jul 27, 2017 5:12 pm
by claudemir
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?