-----Mensaje original----- De: Les Newell [mailto:les.new...@fastmail.co.uk] Enviado el: Jueves, 25 de Octubre de 2012 07:42 a.m. Para: EMC developers Asunto: Re: [Emc-developers] I would like to contribute a "modbus to hal" component, AKA mb2hal.
> I haven't been following this thread but I found a couple of bugs in modbus.c some time back. > I don't know if they are the same problems Victor found. The patch that i mention and have included in mb2hal is your patch, without any modification, so if it will be commited your name will appears not mine. The only NEW bug that i found was fixed here: http://git.linuxcnc.org/gitweb?p=linuxcnc.git;a=commit;h=4ad05d67dd11a555e72 9b750c4ed3944be044a8b (note is currently in 2.5_branch not in master). > By the way, did anyone try the Modbus module I posted on the list a > while back? <http://www.shootspammers.org.uk/modbus.zip>. It is a > multi-threaded module that can handle any number of modbus clients on > any number of ports (serial or Ethernet). It can create HAL pins for > coils, inputs, holding registers and input registers. Registers can be > either integers or floating point with scaling and offsetting. It has > been tested fairly thoroughly on serial but I haven't tested Ethernet. Yes i have tried it in depth and have totally rewritten it to create mb2hal. Note that in the header i mention it: +/* + * mb2hal.c + * Userspace HAL component to communicate with one or more Modbus devices. + * + * Victor Rocco, adapted from Les Newell's modbuscomms.c which is + * Copyright (C) 2009-2012 Les Newell <l...@sheetcam.com> + * source code in +http://wiki.linuxcnc.org/cgi-bin/wiki.pl?ContributedComponents Just to know the history of mb2hal: - I was looking for a modbus component for my lathe conversion. - Did a chance to try your implementation. - But have to translate from EMC to LinuxCNC in order to install it. - Found very interesting your implementation, working for my RS-232 device but not for my TCP device (now i know it was a bug in modbus.c, not in your code). - So I started to debug the code. Adding more and more debug information. - When there was a big mess of code and i feel it confusing y started to make some cosmetic changes (indentation, variable name clarification, function names clarification, standardization of debug levels and messages, and more). - When I found the bug (modbus.c wich is now in 2.5_branch) y found the program has a totally new code, but the logic intact. - So i did a step further and prepared it for a contribution: # Use the suggested coding style of LinuxCNC http://linuxcnc.org/docs/html/code/Style_Guide.html # Added signal catch logic for halrun unloadusr and unload. # Added some functions to INI file (SLOWDOWN, TCP_PORT) # Put the program in a new subdirectory. # Did some in depth testing for RS-232 and TCP devices and documented the results and INI files. # In order to help the new user, added some debug information to the INI file at program init, changed the names of the variables and added some help information to the INI file. # Change the HAL pins creation order (from one by one reading of transactions and creating HAL pins, to first parse all transactions and then create all HAL pins). # Did some change in the threads attributes because the threads didn't die after halrun unloadusr. # I feel i did some others things that i don't remember ;=) Regards, Victor. ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct _______________________________________________ Emc-developers mailing list Emc-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-developers