Show Posts
Pages: [1]
1  Using Arduino / Interfacing w/ Software on the Computer / Re: Arduino with advancedHMI on: November 14, 2012, 10:45:40 pm
There seems to be a communication problem I need to sort out. I can either read an analog value or control pushbuttons. If I try both the analog display takes up the bandwidth and the pushbutton signals get lost.

I'm guessing maybe a timer on the analog so that it only pulls a reading once every few seconds may work.
2  Using Arduino / Interfacing w/ Software on the Computer / Re: Arduino with advancedHMI on: November 14, 2012, 08:56:34 pm
!!!FACE PALM!!


Figured it out.  Mb.C[8] is either true or false. So the button for ON needs to be "set to true" and the button for OFF needs to be "set to false"

then in code it will look like this:

if(Mb.C[8]) digitalWrite(8,HIGH) ;
   else digitalWrite(8,LOW) ;

That did the trick!
3  Using Arduino / Interfacing w/ Software on the Computer / Re: Arduino with advancedHMI on: November 14, 2012, 08:30:57 pm
I have not been able to get reliable results controlling the digital pins as of yet. I have managed to turn on a led via the HMI, but cannot turn it back off.  I'm sure its a simple setting somewhere but I am not having any luck so far.  Mb.C[8] in the sketch is at PLC address 00009. If I create a button to toggle bit and tell it that PLC address it will turn it on but will not toggle back off. 
4  Using Arduino / Interfacing w/ Software on the Computer / Re: Arduino with advancedHMI on: November 14, 2012, 04:46:21 pm
I am using the Arduino branded Ethernet shield and it uses the same Wiznet w5100, I will guess that the other shield will work the same.
5  Using Arduino / Interfacing w/ Software on the Computer / Re: Arduino with advancedHMI on: November 14, 2012, 01:05:56 am
Ok I took the quickstart guide from Advanced HMI and modified to be tailored to Arduino communication via Mudbus

https://skydrive.live.com/redir?resid=B585278291D16AA7!183&authkey=!AKZlYO_EiLJ0s38
6  Using Arduino / Interfacing w/ Software on the Computer / Re: Arduino with advancedHMI on: November 13, 2012, 09:07:06 pm
The Modbus library that I used was this one for Modbus over ethernet:
http://code.google.com/p/mudbus/

This does require the use of the Ethernet shield.

I used the "Mb" sketch in the example that came with the Mudbus library.

Avoid using pins 4,10,11,12,and 13 when using the Ethernet shield

Modbus has a weird addressing scheme. It stores values in memory locations referred to as registers. These registers are designated in the example as "Mb.R[0], Mb.R[1]" and so on.

// Section of Code from Example Sketch
Mb.R[0] = analogRead(A0); //pin A0 to Mb.R[0]

Here, a value will be read from the analog pin A0 and stored in Register 0

To access register zero in Advanced HMI the PLC address is 40001
To access register one the address would be 40002 and so on.

I hope this helps!
7  Using Arduino / Interfacing w/ Software on the Computer / Re: Arduino with advancedHMI on: November 12, 2012, 03:49:11 am
I was able to get it to work using the Mudbus.h library and the AdvancedHMI Modbus driver. Just remember when the sketch refers to Mb.R[0] that means the Modbus PLC address is 40001.
Pages: [1]