No announcement yet.

new to plc - datalogging with plc via inputs

  • Filter
  • Time
  • Show
Clear All
new posts

  • new to plc - datalogging with plc via inputs

    I've been tasked with creating a sort of logger for inputs that applies a timestamp along with a duration count of the input being off/on. I trying to think of way to use one timer to record the event timestamp + duration of status change (on/off) any help with be appricated. (the dataview will suffice for now, its just premlimary data)

    Bascially for now i want to view when the status change, and how long until a change of state occured and store that data in a datatype.

    I would like to use one timer to do it so that I don't have to do it one as in the example program

    any help would be appricated.

    Attached Files

  • #2
    Originally posted by 7threalm View Post

    any help would be appricated.
    This is probably not what your after, but if you have an option, this would be a snap with BRX.
    I compiled a quick example with the simulator if your interested.
    There are tons of ways to compile your data, then you can email it in CSV fromat or log it to PLC Ram, or SD Card.
    Attached Files


    • #3
      if you have 16 inputs and each change once per second, just adding 16 time stamps along with new input state results in a great deal of data. you will need to transfer this data to an external storage.
      you should reserve a data block large enough to hold all input changes, yet small enough to allow serial transfer to another device. you should also reserve an alternate data block for use while the full data block dumps data to external device.
      start with this: what is your serial transfer speed. say 8600bps over modbus. that is 1kB/s
      if your inputs change to a resulting data rate comparable to 1kb/s, you will never be able to keep up.
      not sure how time is stored, but assume a dbl word. that is 4 bytes, maybe 5 bytes for each input.
      16 inputs changing once per second will result in 80bytes. you should be fine with dumping each second.

      as for the program itself, I would just store the input state in a control bit. when the state changes, I would note the time stamp, the new input state and would update the control bit. when the data block is full, I would dump the data to external and switch to alternate data block to keep receiving inout status during the dump.
      this method does not show the input change in real time. it only shows the changes once every second.