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

Pages: [1]
1
Support Questions / Re: Comms Failure Alarm on Modbus TCPIP
« on: February 14, 2016, 09:09:26 AM »
Godra

Thank you so much for your very concise and clear explanation!  Very helpful indeed!  It gave me a bit of Eureka moment in understanding events….

One final small niggle…. following from Archies explanation about how to write to a bit on two separate PLC’s I am now trying to sort out a momentary button I had set up as a toggle function…


I tried this in the code :

Private Sub MomentaryButton4_Click(sender As Object, e As EventArgs) Handles MomentaryButton4.Click
        If ModbusTCPCom1.Read("01027") = 0 Then

            ModbusTCPCom1.Write("01027", 1)
            ModbusTCPCom2.Write("01027", 1)
        Else
            ModbusTCPCom1.Write("01027", 0)
            ModbusTCPCom2.Write("01027", 0)
        End If

End Sub


But seems I am doing something wrong in trying to read from address 01027 in the first line…..

Any pointers….

Thanks again

Peterjung

2
Support Questions / Re: Comms Failure Alarm on Modbus TCPIP
« on: February 12, 2016, 04:31:14 AM »
Hi rbelknap

Thanks again for your input!  Ok I can get as far as...

"In the routines you would just need to write the appropriate code to change the color of the indicator for whatever condition the comms are in."

 :)

As you can no doubt tell I really have very limited knowledge of VB .... however I have just found the link to the video tutorials for VB absolute beginners....that's me!  I am going to try and see what I can learn from these....

Are there any other resources for VB particular to Advanced HMI that may be available?  I would really like to try and figure some of this out form myself!

Thanks

3
Support Questions / Comms Failure Alarm on Modbus TCPIP
« on: February 11, 2016, 04:15:49 AM »
Firstly I want to say a huge thanks you to Archie for a great programme and for making it free and accessible.  Secondly I want thank Archie and rbelknap for helping me out with developing my first Advanced HMI application.

With their help I have almost finished but there is one further thing I would like to try and implement.  This application is to create a simple test interface to connect to two PLC’s with separate comms set ups.

I would like to be able to light a basic indicator if comms to either of the PLC’s should fail.

I read on the other thread the two suggestions one of using a Watchdog Timer and the other frankly I didn’t understand at all.

I well understand the principle of a Watchdog but in practice how would you implement this on the HMI side?  Does a timer have to be created and controlled in VB?  If so any hints on how to do this?

Or, considering that I am using ModbusTCPIP is there a better (easier?) solution I can consider?

See below for my (almost) finished HMI – you can see the orange indicators that I would like to illuminate in the case of a comms. failure.

Once again….any help offered is very much appreciated!



4
Support Questions / Re: One HMI & Two PLC’s simultaneously on MODBUS TCP
« on: February 11, 2016, 01:55:41 AM »
Hi Archie

I got this to work after a bit of messing around:

Private Sub MomentaryButton1_Click(sender As Object, e As EventArgs) Handles MomentaryButton1.Click

        ModbusTCPCom1.Write("01025", 1)
        ModbusTCPCom2.Write("01025", 1)
        Delay(3)
        ModbusTCPCom1.Write("01025", 0)
        ModbusTCPCom2.Write("01025", 0)

    End Sub


As I wanted it to act like a pulse I added the Delay and writing to zero.  For the Delay I found a useful bit of code to make a wait function on Youtube at:

https://www.youtube.com/watch?v=JnYm1jBgRbI

Sub Delay(ByVal dblSecs As Double)

Const OneSec As Double = 1.0# / (1440.0# * 60.0#)
Dim dblWaitTil As Date
Now.AddSeconds(OneSec)
dblWaitTil = Now.AddSeconds(OneSec).AddSeconds(dblSecs)
Do Until Now > dblWaitTil
Application.DoEvents() ' Allow windows messages to be processed
Loop

End Sub


Seems to work ok!

Thanks again for your help!

5
Support Questions / Re: Digital Panel Meters and changing the display count
« on: February 11, 2016, 01:05:39 AM »
rbelknap

Thanks again for your input!  After some trial and error I got the following code working:

'Get the Set Value of the timer and store in a variable

RunTimerSV = getTimerSV(6)
FailToStartSV = getTimerSV(3)
ElapsedTimeSVFor = getTimerSV(4)
ElapsedTimeSVRev = getTimerSV(5)

'SB Run Timer

IF TESTIO(SBX_LSR)= 0
THEN
RunTimerDisplay = RunTimerSV - TIMERPV[6]
ELSE
RunTimerDisplay = 0
ENDIF

'Fail To Start Timer Display

IF TESTIO(FTS_TIMER_LATCH) = 1
THEN
FTSDisplay = FailToStartSV - TIMERPV[3]
ELSEIF
TESTIO(MB_SBX_FAIL_TO_S)=1
FTSDisplay = FailtoStartSV
ELSE
FTSDisplay = 0
ENDIF

'Elasped Time Display

IF TESTIO(SBX_LSR)=0 AND TESTIO(SBX_LSF)=0 AND TESTIO(LSF_LATCH)=0
THEN
ETDisplay = ElapsedTimeSVFor - TIMERPV[4]
ELSEIF
TESTIO(SBX_LSR)=0 AND TESTIO(LSF_LATCH)=1
ETDisplay = ElapsedTimeSVRev - TIMERPV[5]
ELSE
ETDisplay = 0
ENDIF

6
Support Questions / Re: Digital Panel Meters and changing the display count
« on: February 10, 2016, 09:23:38 AM »
Hi rbelkanp

Thanks for your response and sure I think it makes better sense to do the math in the PLC.  I am using a Trilogic Nano-10 PLC which has the facility the write custom functions in Basic.

Thanks for your input.... I think I need to get a good book on Basic! :)

7
Support Questions / Digital Panel Meters and changing the display count
« on: February 10, 2016, 07:50:18 AM »
Hi

Apologies again for yet another newbie question....

I have a couple of Digital Panel Meters that are reading values and displaying nicely from my PLC.  Problem is the timers in the PLC start at the present total value and then decrement to 0.  I can get the meters to display this quite nicely.

However I would rather have the meters count up from zero to the present total - I am assuming I need to do this through code?

So I assume I need to get the preset total for the particular timer and then subtract the current timer count to do this and display the result on the meter?

Can anyone advise the correct VB syntax to achieve this?

Thanks again in advance

8
Support Questions / Re: One HMI & Two PLC’s simultaneously on MODBUS TCP
« on: February 09, 2016, 08:09:58 AM »
Archie

OK, thanks for the pointers.  Not too up with VB but I will give it a shot.

Thanks again!

9
Support Questions / One HMI & Two PLC’s simultaneously on MODBUS TCP
« on: February 08, 2016, 10:47:04 PM »
Can anyone please advise if it is possible to have a single control (PB, etc.) from a single HMI that can write to the same address in two different PLC’s (different IP addresses) simultaneously?

In addition can I have two display controllers (i.e. digital panel meter) display values from each PLC simultaneously on the same HMI?

I am using MODBUS TCP comms.

Thanks in advance!

10
Support Questions / Re: MODBUS TCP/IP
« on: February 04, 2016, 07:25:10 AM »
OK... I worked it out.  I just figured out that I do not need to send the MODBUS function code - I guess it is implicit in the type of control......doh!

So If I want to read from Bit 1025 I need to address it as 11025
If I want to write to Bit 1025 then I need to address it as 01025

Simple when you know how I guess.....!!

11
Support Questions / Re: MODBUS TCP/IP
« on: February 04, 2016, 05:17:24 AM »
Is there anywhere I can get some documentation on the MODBUS TCP driver?

Still having problems figuring out how to correct map address and function code

12
Support Questions / Re: MODBUS TCP/IP
« on: February 04, 2016, 05:01:15 AM »
Hmm

Tried the same format to write to a bit from a Momentary PB but no dice....

Bit address is 1025, when I use 51025 I get "Invalid Address51025 - Invalid first digit in Address"

13
Support Questions / Re: MODBUS TCP/IP
« on: February 04, 2016, 04:41:43 AM »
Archie - you are a Star!

It is the format 11029!  The other thing I have just learned is that we are using Modicon stype 1 based addressing....so the actual address is 11030!!

Eureka!

Thank you very much indeed...have been pulling my hair out with this!

14
Support Questions / Re: MODBUS TCP/IP
« on: February 04, 2016, 04:07:40 AM »
Archie

Many thanks for the reply - I read through the thread you linked and downloaded the sample programme however none of it helped I am afraid!

My question is really simple - what is the format and place to enter a Modbus address for a single bit?

Here is an example of what I am trying to do:

Create a simple Pilot Light
CommComponent Set to: ModbusTCPCom1
PLCAddressValue set to: 01:1029

I though that this shoould read the bit at 1029 and control teh pilot light accordingly but nothing happens?

I have teh correct IP adress and I can see teh PLC online with another pice of software.

Hmm...any pointers what I am doing wrong here?


Thanks

15
Support Questions / MODBUS TCP/IP
« on: February 03, 2016, 09:42:50 AM »
Hi there

Can someone please help me out with addressing a MODBUS TCP/IP slave device from Advanced HMI?

I have been able to set up comms and put pushbuttons and indicators on a basic HMI but when it comes to putting the PLC address in the properties of the HMI control item I am a bit lost.  I am not clear on what format  the MODBUS address should be?

I keep getting errors on the comms - what is the correct format to put the MODBUS address - do I need the MODBUS control code as part of the address.

Any help would be very much appreciated!

Thanks in advance....

Pages: [1]