• March 23, 2023, 06:29:16 AM

Login with username, password and session length

Author Topic: Slope on DirectSoft 5  (Read 1384 times)


  • Full Member
  • ***
  • Posts: 23
Slope on DirectSoft 5
« on: July 12, 2018, 04:05:46 PM »
I'm needing to determine the slope of an analog input on a DL06.  I have been spoiled with Do-More, and now I can't figure out how to write a slope function. 

Ideally, I would like to measure the slope over about a 1 second period, but a time based stack sounds complicated so I was thinking of a set number of values (ex. 16).

Could somebody please point me in the right direction, or is this too complicated for this plc?  Thanks in advance.


  • Full Member
  • ***
  • Posts: 23
Re: Slope on DirectSoft 5
« Reply #1 on: July 13, 2018, 01:42:42 PM »
Can I do a pointer for the output of the accumulator like I tried below?  Is my method of shifting the new location by 1 correct?

Code: [Select]
LD V3000 | (Flow Meter Value)
OUT P12000 | (Contains the value of where the data will be going in Hex (Ex. For V10,000 it would contain 2710))
MathBCD "v12003" = V12004 | (Average Before)
MathBCD "(v10000+v10001…+v10017)/k16" = V12003 | (Average Now (assuming that I need 16 spaces for 1 second))
MathBCD "(v12003-v12004)*k1000/v7775" = V12007 | (change in sccm/sec where v7775 = scantime in miliseconds)

LDA O1 | (sets the offset position)
LDX v12000 | (Loads value of the address)
OUT v12000 | (Sets the next location of placement (ring buffer) for the address)

If v12000>100F then MathBCD "k1000" = v12000 | (to be written in rung format when the next location is outside of the range, set it to v10000)