Third party software and hardware support forums. > Modbus

Arduino Modbus, Complete, Documented and free

(1/16) > >>

Shilling:
All,
Had a little extra time on my hands so I created a Modbus slave for Mach 3 using an Arduino Uno.  Costs roughly $30 to get and uses completely free software to configure and implement.  Also included is my documentation of all code, settings and building a basic brain for Mach.
Please feel free to use and build upon,
Shilling

NV50:
Hello,
Great job and very good documentation

Just a few details when I compile the "Modbus Slave.pde"
Arduino IDE identifies four errors.

"Config_IO" was not Declared In This scope
"Kill_IO" was not Declared In This scope
"Updates_Pin_states" was not Declared In This scope
"UpdatesAN_States" was not Declared In This scope

thanks

zafarsalam:
Shilling,

Wonderful job. The documentation is very impressive and detailed too.

I am using arduino with modbus slave sketch by Juan Pablo. It only implements funtions 3,4 and 16 of modbus. I am using it mainly for tool change, auxillary keypads and analog inputs for FRO and spindle override. Programming the chip with Uno and putting it on my BOB with serial port. This way it costs me less than $10.

I have yet to try your sketch on my Uno. Have you tried connecting MPG through it?

Zafar

mrprecise44:
Hello Tim:

Looks very promising for Modbus. I have a Cubloc PLC, and am connecting it up to my back-up computer for testing. The (3)potentiometers for Feedrate override, Jog %, and Rapid override all work fine with my brains written for the Cubloc; just had to change the address in the setup screen.

Are the digital input pins, (1 thru 12) fixed at present state? They are all 5v/High state, and apparently must be pulled to ground to activate a digital signal input.

If it is (or is not) possible to change the pin mode state, please explain.

I loaded the Modbus program on a Mega 1280, and the standard 328p. Both load fine.

However, trying to load with the latest Arduino ver. 1.0 would not compile. Compile and upload worked fine on Arduino IDE 0021, and 0022. I am sure 0023 works also, as that shows in as the version you used for the screen shot pictures in the manual.

Also, when I ran the blinking LED test, the timer interferred with the Cycle Start screen button in my MSM screen set. It blinked the little white triangle rapidly. When I unchecked the enable box for the timer config, the mad blinking stopped.

The MSM screen set is produced by David Bagby at Calypso Inc., and is an excellent replacement for the standard Mach3 screen. It also has an enormous pdf manual, and a very comprehensive probing screen, with many videos to explain everything it does.

Also, thanks for the superb pdf manual.   








mrprecise44:
More info on making input buttons to work:

So far, I am using the pushbutton in pull-down, 0 volts mode. Works fine. It took some time trying different check boxes for the proper function for the brains.

Each button has to be in the Set-up page, under a separate config#'s. The address entered into the Mach3 setup table Address column,for each button is the Arduino pin number you are going to use.

I could not get pins 0, and 1 to work. These are default Rx (pin 0), Tx (pin 1) on the Arduino.

So, my pushbuttons start with pin 2. Pin 13 on my Arduino standard (328p) is internally connected to an LED. I did not use pin 13.

The first part of a brain for each button will look like:  MOD:0 - D0 - P:5 : 1

The MOD:0 is the Register address for the I/O, per Table 4 - Register Map, page 15 of manual. All inputs up to 15 will have this 0.

The D0 is from checking the box for bits, and setting bit number to 0. All of the I/O brains had to be like this.

The P:5, is the Config# in the Modbus setup table in Mach3. The pin address (Arduino pin #) is in the Modbus setup table, and is not entered into the brain checkbox's. This number is unique to each button, since each one has it's own config.

The last number above, : 1, is what the brain looks like when viewed in the Brain viewer. When you push the button, this 1 changes to a 0, zero. It does not show up when you make the brain.

So far, all is working well. I have (3) 10k potentiometers working, and they are actually easier than the buttons. The 328p Arduino has 6 analog inputs, which can be either Analog or Digital.

I am sure there are other configurations that will work with this program, but these numbers will get results.

Since an Arduino is about $30, this is a very nice, inexpensive solution for analog and digital I/O. If you need more pushbutton I/O than the small Arduino, the Mega is slightly more money, but has about more than triple the analog and digital I/O.

Hope this is useful.

Navigation

[0] Message Index

[#] Next page

Go to full version