Author Topic: Heartbeat Signal  (Read 1584 times)

NewControls

  • Newbie
  • *
  • Posts: 11
    • View Profile
Heartbeat Signal
« on: February 09, 2018, 11:11:08 AM »
I was hoping for some direction on how to make a heartbeat signal between the AdvancedHMI program i have running and a compact logix L18ER processor over ethernet.

I do not want the PLC to be able to run the equipment without communication established.

Thanks!


bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
Re: Heartbeat Signal
« Reply #1 on: February 09, 2018, 11:49:30 AM »
There is more than one, for ex., you can set up a free running timer in PLC and if DN bit is on then disable machine.
On the AAHMI side, reset the ACC count as long as communication is good.
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

NewControls

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Heartbeat Signal
« Reply #2 on: February 09, 2018, 11:58:45 AM »
What would i use in AdvancedHMI to constantly write the the ACC though?

I'm unfamiliar with how you would write the code for that.

bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
Re: Heartbeat Signal
« Reply #3 on: February 09, 2018, 01:03:51 PM »
Again there is more than one way, a simple way is to drop a timer to your form, then set appropriate  time & enable it, double click and enter code like PLCDriver.Write("freetimer.acc",0)
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

qsiguy

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Heartbeat Signal
« Reply #4 on: March 01, 2023, 10:24:17 AM »
I tried this method and I get one pulse when the timer runs out but how do I make the timer reset and start again? I have it set for 2000ms but need continuous pulses every 2000ms.

This is my code so far for the pulse and I do get one pulse out on the correct Modbus channel.  Tried adding some code to stop and start the timer but either I didn't write the code correctly or that's not the right method.

=======
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        ModbusTCPCom1.Write("000030", 1)
End Sub
=======

Thanks.

Again there is more than one way, a simple way is to drop a timer to your form, then set appropriate  time & enable it, double click and enter code like PLCDriver.Write("freetimer.acc",0)

qsiguy

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Heartbeat Signal
« Reply #5 on: March 01, 2023, 07:47:56 PM »
I'm sure there are other/better ways but I ended up using two timers with offset times. One turns the bit on, the other turns it off. They aren't exactly xx seconds on and xx seconds off but for my application I just need the bit to turn on/off at least once per 60 seconds to ensure the Modbus is talking.  Timer1 is set for 1000ms and timer2 is 2250ms and that give me a good random pulse.

------------------------------------------------
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        ModbusTCPCom1.Write("000030", 1)
End Sub

Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
        ModbusTCPCom1.Write("000030", 0)
End Sub
-------------------------------------------------