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 - neptun2002

Pages: [1] 2
1
Open Discussion / Re: Arduino & RS485
« on: April 27, 2015, 03:02:53 AM »
Hi rexlee in fact I tested the AdvancedHmi rtu driver with more than three USB to RS485 and I did not have this problem it works great may be the usb driver deal with this problem try this setup I am sure it will work with you

thanks

2
Open Discussion / Re: Arduino & RS485
« on: April 26, 2015, 02:52:36 AM »
Hi you have to make some change in the library by your self for arduino-modbus-slave library in the fowling link I added the control pin for the main function to become like this 

//void modbusSlave::run(void)
void modbusSlave::run(int SSerialTxControlPin)

so now whenever you want use the RS485 you have to control it the code I made is like this


//****************************************************************************************

#define SSerialTxControl 2   //RS485 Direction control
#define RS485Transmit    HIGH
#define RS485Receive     LOW

      digitalWrite(SSerialTxControlPin, RS485Transmit);  // Enable RS485 Transmit
      
      
            for(i = 0 ; i < _len ; i++)
               {
               Serial1.write(_msg);
               Serial.write(_msg);
               }
      delay(10);
      digitalWrite(SSerialTxControlPin, RS485Receive);  // Disable RS485 Transmit             
//****************************************************************************************


https://code.google.com/p/arduino-modbus-slave/

3
OK I see

So I am waiting next release :) thank you so much Archie

4
Hi Archie I am using it with modbusrtu driver
Thank you

5
Hi..

there are to many libraries for Modbus RTU but I found that this one is practical it needs some improvement but it works

pleas have a look to the following link also there is example ready to use

https://code.google.com/p/arduino-modbus-slave/downloads/list

thanks

6
Open Discussion / How to configyre DigitalPanelMeter as unsigned int ?
« on: April 25, 2015, 09:55:38 AM »
I am currently trying to use Digital Panel Meter I need the value to be shown as unsigned integer ? does any one know how to configure it like that ??

I am sure I used before in a previous version not remember which one so any help will be highly appreciated thanks.

7
Dear Archie I am trying to read tow MODBUS devices one with Station ID=100 the other one   with Station ID=101

Connected to Rs485 Bus and connected to the PC Via USB to Rs485 Converter to com5

how can I read each device with a different Station ID ??

I tried to add another ModbusRTUCom2 Driver on the same com5 with a different Station ID But always I can read the one connected to ModbusRTUCom1

it seems like the com is open and not closed after the reading / writing so the second device never get any packet is there any thing wrong that I did ??


what is your suggestion to solve this ?


Thank you so much

8
Hi with ver 3.70 you have not to have this problem I have test it whithe 32 buttons and four meters holding registers and four input registers with tow PLCs in the same time and it worked perfect even with pooloveridde 0

I think you have a problem with your communication wires try to decreas the buade rate

And test again
Pleas look this picture

http://i.imgur.com/5dXN9is.png


Good luck

9
Support Questions / Re: Bug in the ModbusRTUCom Ver AdvancedHMIBeta363
« on: September 08, 2014, 05:24:44 AM »
This What I call PERFECT WORK  Archie congratulations
thank you so much

10
Support Questions / Re: Bug in the ModbusRTUCom Ver AdvancedHMIBeta363
« on: September 06, 2014, 12:06:05 PM »
Thank you so much Archie for all these efforts

what you describe make cense if the packet is coming faster than the PLC then the PLC definitely  will not respond

But I have to say what I noticed when I was debugging  I noticed that the packet which is related to the button click is coming out after the error occurred in other words it sounds like if there are some thing wrong with the queue    " Me.SendQue.Enqueue(item) "



Unfortunately I do not have  (Device Monitoring Studio by HHD software) to test with.
 it coast about 400$

So any way I think that I will wait until you relies the new 369 Ver to test again


thank you so much

11
Support Questions / Re: Bug in the ModbusRTUCom Ver AdvancedHMIBeta363
« on: September 04, 2014, 04:17:48 PM »
No I did not change PollRateOverride

And

The baud rate is 9600


12
Support Questions / Re: Bug in the ModbusRTUCom Ver AdvancedHMIBeta363
« on: September 04, 2014, 03:34:21 PM »
Thank you so much Archie I appreciate your reply infact now I have bothe version the 367 works great but same on over 368 is not working good  as I taled I just guess that is the point.

The setup that I am testing is 32 puttons from address 00001 to 00032
In toggel mode with plcvalue the same address and visible for all 00001

Plus eight holding registers 40001 to 40008

The problem occuers on click on the toggel switches sometimes it is OK sometimes

Read error always

 
Same arrangement on ver 367 do not miss a single click on the toggel switches

I will try to catch the problem if I can


Thank you so much

13
Support Questions / Re: Bug in the ModbusRTUCom Ver AdvancedHMIBeta363
« on: September 04, 2014, 12:56:33 PM »
Yes Archie I realise  this point what I mean that the CurrentTransactionNumber

as you can see in the pic

is not always correct especially if there are heavy traffic on the serial     

but with ver 367 this problem was not exist

I could not exactly find the problem but I am sure it is in this function


 Namespace MfgControl.AdvancedHMI.Drivers.ModbusRTU
    Public Class ModbusRTUDataLinkLayer
            
       Public Function GetNextTransactionNumber(ByVal max As Integer) As Integer

with ver 367 the NextTransactionNumber always comming right

pleas have a deeper look to the new method GetNextTransactionNumber

thank you so much

14
Support Questions / Re: Bug in the ModbusRTUCom Ver AdvancedHMIBeta363
« on: September 03, 2014, 11:16:03 AM »
Dear Archie Thank you so much for your efforts in this great project

I tested the new version 368 but unfortunately it is not working good like the previews one 367
so in my testing for function 1 one using a toggle switch it is not work So
I found one point that you have to have a look


'****************************************************************************************************
Namespace MfgControl.AdvancedHMI.Drivers.ModbusRTU
    Public Class ModbusRTUDataLinkLayer
'****************************************************************************************************   

   'The original Code ***********************************************************************************
        Public Function SendRTUFrame(ByVal RTUPacket As ModbusRTUFrame, ByVal OwnerObjectID As Long) As Integer
            Dim num As Integer
            Me.SendData(RTUPacket.GetByteStream, OwnerObjectID)
            Return num
        End Function
   '****************************************************************************************************

   'My Suggestion***************************************************************************************
        Public Function SendRTUFrame(ByVal RTUPacket As ModbusRTUFrame, ByVal OwnerObjectID As Long) As Integer
            Dim num As Integer = 0
            num = Me.SendData(RTUPacket.GetByteStream, OwnerObjectID)
            Return num
        End Function
   '****************************************************************************************************
 also I found that the returned value from function num = Me.SendData(RTUPacket.GetByteStream, OwnerObjectID)
 
 is not stable I mean it is not always reflect an index for valid data even if there is a response from PLC  Pleas Have a look to the attached Pic.
also I can notice that is the traffic is slower may be this is the point ??

So pleas Have a deeper look

Thank you

15
Thank you so much Archie for your efforts in this project

I tested the new version its work great when number of elements is les than 8 that means one byte so I made a small change and it is working great now

thanks



        Private Function ExtractData(ByVal RawData As List(Of Byte), ByVal startByte As Integer, ByVal address As ModbusAddress) As String()
            Dim values(address.NumberOfElements - 1) As String

            Dim NumberOfBytes As Integer = CInt(Math.Ceiling(address.BitsPerElement / 8))
            Dim i As Integer
            While i < address.NumberOfElements And (startByte + i) < Math.Floor(RawData.Count / NumberOfBytes)
                'Dim HexByte1 As String = Chr(RawData(startByte + i * NumberOfBytes)) & Chr(RawData(startByte + (i * NumberOfBytes) + 1))
                If NumberOfBytes > 1 Then
                    'Dim HexByte2 As String = Chr(RawData(startByte + (i * NumberOfBytes) + 2)) & Chr(RawData(startByte + (i * NumberOfBytes) + 3))
                    If Not m_TreatDataAsHex Then
                        values(i) = CStr(RawData(startByte + i * NumberOfBytes) * 256 + RawData(startByte + i * NumberOfBytes + 1))
                    Else
                        values(i) = CalculationsAndConversions.ByteToHex(RawData(startByte + i * NumberOfBytes)) & CalculationsAndConversions.ByteToHex(RawData(startByte + i * NumberOfBytes + 1))
                    End If
                Else
                    If Not m_TreatDataAsHex Then
                        If address.BitsPerElement > 1 Then
                            values(i) = CStr(RawData(startByte + i * NumberOfBytes)) '  + 1)) removed 21-AUG-14
                        Else
                            '* It is a bit read, so extract from the byte
                            Dim BitNumber As Integer = 0


                            '**The Bug********************************************************************************************
                            'While ((i + BitNumber) < address.NumberOfElements) And (BitNumber < 15)                                                 '<------------This one Because it is byte
                            'values(i + BitNumber) = CStr((((RawData(startByte + i * NumberOfBytes)) And CByte(2 ^ BitNumber)) > 0))  '<------------This one the location of the bit in the array
                            '**The Bug********************************************************************************************


                            '**The New Code ********************************************************************************************
                            While ((i + BitNumber) < address.NumberOfElements) And (BitNumber < 8)               '< 15)
                                values((i * 8) + BitNumber) = CStr((((RawData(startByte + i * NumberOfBytes)) And CByte(2 ^ BitNumber)) > 0))
                                '**The New Code ********************************************************************************************

                                BitNumber += 1
                            End While
                        End If
                    Else
                        values(i) = CalculationsAndConversions.ByteToHex(RawData(startByte + i * NumberOfBytes))
                    End If
                    End If

                i += 1
            End While

            Return values
        End Function
 

Pages: [1] 2