Author Topic: Digital Panel Meters and changing the display count  (Read 1785 times)

peterjung

  • Newbie
  • *
  • Posts: 15
    • View Profile
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

rbelknap

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Re: Digital Panel Meters and changing the display count
« Reply #1 on: February 10, 2016, 08:38:40 AM »
Rather than have 2 tags being transmitted, can you do the math in the PLC?

I don't know what PLC you are using, so I don't know if it's possible, but if you can do the math in the PLC and put the count up value in a new memory location for AHMI to look at.

peterjung

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Digital Panel Meters and changing the display count
« Reply #2 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! :)

rbelknap

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Re: Digital Panel Meters and changing the display count
« Reply #3 on: February 10, 2016, 01:40:08 PM »
If you can figure out which variables to use and how to setup the call in ladder, I/we can help with basic commands.

It should be as simple as calling the function when the timer is running and one line of code to make it happen.


peterjung

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Digital Panel Meters and changing the display count
« Reply #4 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