Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - gfulk

Pages: [1]
1
Support Questions / Re: ModBus RTU Parrallel Programming
« on: March 16, 2018, 11:44:30 AM »
I enabled logging and didnt see anything out of the ordinary. We are starting to err on the side of this being a hardware problem due to inconsistencies between machines. Thanks for the response though!

2
Support Questions / ModBus RTU Parrallel Programming
« on: March 14, 2018, 03:34:58 PM »
Hi Archie,
We at my company love your product and have adapted some of our HMI programs to use this product and the capability of .NET.  I am working on an application utilizing the Modbus RTU Driver in c#.  I am using a task to read the registers currently something like this.
Code: [Select]
try
            {

                System.Threading.Thread.Sleep(75);
                lock (_MyModbusCom)
                {
                    preCompactionReading = Convert.ToDouble(_MyModbusCom.Read("L40001", 1)[0]);
                }
                while (recording)
                {
                    lock (_MyModbusCom)
                    {
                        LiveCompression = Convert.ToDouble(_MyModbusCom.Read("L40001", 1)[0]);
                        CurrentSetpoint = _MyModbusCom.Read("L40013", 1)[0];
                        if (!SPReached)
                        {
                            PeakCompression = Convert.ToDouble(_MyModbusCom.Read("L40007", 1)[0]);
                        }
                        else
                        {
                            preCompactionReading = Convert.ToDouble(_MyModbusCom.Read("L40001", 1)[0]);
                        }
                        Dosing = Convert.ToDouble(_MyModbusCom.Read("L40027", 1)[0]) / 10;
                    }
                    System.Threading.Thread.Sleep(50);
                }
            }catch(Exception ex)
            {
                throw ex;
            }

This is the inside of the Task that reads the Modbus registers. These values get used for data visualization but I am having an issue where in the middle of execution I get an error stating "No Response from PLC, ensure driver settings are correct". I know my driver settings are correct. I would assume this is because I am "Overloading" the read/write capabilities of the driver/hardware(RedLion PAXCDC4 MBRTU card). I don't know if the lock statements are causing an issue but I am monitoring the class properties from another task here:

Code: [Select]
System.Threading.Thread.Sleep(250);
            while (recording)
            {
                var cp = PeakCompression;
                System.Threading.Thread.Sleep(50);
                if (PeakCompression < cp)
                {
                    SPReached = true;
                    _EventAggregator.GetEvent<SetPointAchievedEvent>().Publish(cp);//Publish setpoint reached event with peak compression as its payload
                    //IsEjecting = true;
                    while (SPReached)
                    {
                        postCompactionReading = LiveCompression;
                        if (IsEjecting)
                        {   
                            Ejection = Math.Abs(postCompactionReading - preCompactionReading);
                            _EventAggregator.GetEvent<EjectionAchievedEvent>().Publish(Ejection);
 //Publish ejection event with the ejection force as its payload
                            lock (_MyModbusCom)
                            {
                                preCompactionReading = Convert.ToDouble(_MyModbusCom.Read("L40001", 1)[0]);
                            }
                            //SPReached = false;
                            IsEjecting = false;
                        }
                    }
                }
            }


Here I am monitoring the values so I can step into the next part of the process. I was looking into the BeginRead() method that returns an int value, I had planned on breaking that apart and looking at the individual bytes in the int, but they returned all 0's. If you have any advice on parallel programming with the Modbus RTU driver and the best ways to return these values it'd be appreciated.
Thanks

3
Archie,
I am able to modify a modbus drivers address dynamically from code behind and it works in the VSHost for debugging, but when I publish and run the click once application it does not work. I am setting the comport name from a global variable when the view with the driver is opened.

Code: [Select]
   
myModbus_Com.BeginInit();
            myModbus_Com.BaudRate = 38400;
            myModbus_Com.StationAddress = 247;
            myModbus_Com.DataBits = 8;
            myModbus_Com.Parity = Parity.None;
            myModbus_Com.StopBits = StopBits.One;
            myModbus_Com.PortName = comPortCombo.SelectedItem.ToString();
            myModbus_Com.EndInit();

This works in debug but running the exe I get an error on the BasicLabels saying that the present key isnt in the dictionary.

Thanks

4
Support Questions / Check for connection
« on: August 11, 2017, 02:33:47 PM »
Is there a way to check if a ModbusRTU connection is there or not?
I tried the IsSubscriptionActive() method, but it didn't behave how i thought it would.

5
Support Questions / Re: RedLion PaxDP10 via Modbus RTU
« on: June 15, 2017, 03:20:46 PM »
After doing more research I found that i had to bring it over as a "u40021". I am now returning the proper value.

6
Support Questions / Re: RedLion PaxDP10 via Modbus RTU
« on: June 15, 2017, 11:05:52 AM »
No luck

7
Support Questions / Re: RedLion PaxDP10 via Modbus RTU
« on: June 15, 2017, 09:54:03 AM »
Archie,
Thanks for getting back to me, I have already tried this and there is no change.

8
Support Questions / RedLion PaxDP10 via Modbus RTU
« on: June 15, 2017, 09:01:08 AM »
Hello,
I am currently developing an app that will connect to a RedLion Panel Meter used to display compression values. Once the compression hits a setpoint set in the meter a coil will change states and fires a solenoid.

This meter does not handle the Modbus Function code FC01 for reading coils. This coil has a mirror register(40021) and a bit(bit 3) within that register that changes when this coil fires. I have tried drilling down to the bit level visa the .Net framework BitArray class and the BitVector32 struct . I tried to display the entire register as a ushort on screen and no change when the setpoint was fired .

I have tested getting the bit and the word change visa a small Indusoft app using their built in Modbus RTU driver. I saw the change in the register and the bit going this route of comms.

If you need code snippets or any other information I am happy to send.

Thanks,


Pages: [1]