| 
	
	|  |  |  
	
		| View previous topic :: View next topic |  
		| Author | Message |  
		| alikaptan 
 
 
 Joined: 06 Nov 2018
 Posts: 1
 
 
 
			      
 
 | 
			
				| modbus rtu |  
				|  Posted: Mon May 25, 2020 6:43 am |   |  
				| 
 |  
				| hi can you share a short data sending and sending program with modbus rtu? The current library is a little difficult to make a complex meaning, can you share a short code to understand?  |  |  
		|  |  
		| temtronic 
 
 
 Joined: 01 Jul 2010
 Posts: 9588
 Location: Greensville,Ontario
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Mon May 25, 2020 7:11 am |   |  
				| 
 |  
				| quick answer... MODBUS IS complex !!! There's no such thing as a 'simple' program...
 one reason why I don't use it.
 
 Jay
 |  |  
		|  |  
		| dluu13 
 
 
 Joined: 28 Sep 2018
 Posts: 395
 Location: Toronto, ON
 
 
			      
 
 | 
			
				|  |  
				|  Posted: Mon May 25, 2020 9:57 am |   |  
				| 
 |  
				| Did you only check out the library files, or did you also check out the modbus master and slave examples in the example folder? 
 Even then, it only shows you one example of how you might implement modbus in your system. There, they have a couple of arrays for your various registers. Modbus is a protocol. Where you choose to point your hold/input registers and stuff is totally up to you.
 
 Nevertheless, the examples work pretty much out of the box. If you just want to use Modbus, without needing to understand all the nitty gritty details, that'll work fine.
 |  |  
		|  |  
		| Gabriel 
 
 
 Joined: 03 Aug 2009
 Posts: 1074
 Location: Panama
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Mon May 25, 2020 8:24 pm |   |  
				| 
 |  
				| I'll bite. 
 Temtronic, this is your second (this week at least) post with a bad rep for modbus.
 
 What is the +30 year old hacker proof 24 baud protocol?
 I am genuinely interested. I find a lot of "old" tech is better tech, which can be rebooted with new hardware to make it even better.
 
 So, what is it?
 _________________
 CCS PCM 5.078 & CCS PCH 5.093
 |  |  
		|  |  
		| Ttelmah 
 
 
 Joined: 11 Mar 2010
 Posts: 19966
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Tue May 26, 2020 1:14 am |   |  
				| 
 |  
				| His communications may well be proprietary. 
 I use ModBus quite a bit, and share the hatred of it....
 
 It was originally designed for a particular family of PLC controllers. It's
 supported data types, and operations were all designed for these controllers,
 rather than for more general use. The only reason it became popular, was
 that it was quite well documented, and usable 'royalty free'. Unfortunately
 this has led to widespread adoption, at a significant 'cost' in terms of
 actual convenience...
   
 For most applications that do not require the ability to connect to other
 devices supporting ModBus, you are much better off designing a protocol
 that actually does what you want.
 
 Now (for example), you can take advantage of the ability to use 9 bit,
 and have the 9th bit as a 'command' flag. Then if you allow (say) 32
 devices to be addressed, and use a byte for the address, you still have
 three bits left in the address range. So (again for example), use these
 as a range of indicators, with '000' meaning 'command is for this device
 only', perhaps '001', as 'command for all heating units', etc. etc..
 Allows you to massively reduce the number of transmissions needed.
 Similarly, if RS485 is the hardware, then implementing multi master
 would allow devices to send alerts without having to be polled. Or you
 could have an extra 'service needed' wire, and use an open collector
 drive on this, have the 'slave' units pull this low when they need to
 talk. Then the master doesn't have to 'poll' the slaves, until this signal
 is seen to go low. With a bit of thought, the protocol becomes much
 better suited to what you actually need to do. Then if the protocol is
 designed to reduce the actual amount of transmissions needed, this
 allows lower data rates. In terms of how far you can send and how
 reliably, 'slower is better'....
 |  |  
		|  |  
		|  |  
  
	| 
 
 | You cannot post new topics in this forum You cannot reply to topics in this forum
 You cannot edit your posts in this forum
 You cannot delete your posts in this forum
 You cannot vote in polls in this forum
 
 |  
 Powered by phpBB © 2001, 2005 phpBB Group
 
 |