Author Topic: Modbus Master able to change Timers  (Read 7793 times)

Petty_boy

  • Jr. Member
  • **
  • Posts: 53
  • I'm a llama!
    • View Profile
Modbus Master able to change Timers
« on: June 02, 2008, 09:13:38 AM »
Hi,

Can you tell me if its possible for a modbus master to change the timer settings, read I/O condition within the ladder program?

i.e. change timer "t1" from 100 to 1000  and read or write inputs / outputs from a touch screen HMI as the configured as the modbus master.

Many Thanks

Marcus

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3171
    • View Profile
    • Internet Programmable PLCs
Re:Modbus Master able to change Timers
« Reply #1 on: June 02, 2008, 11:39:47 AM »
Yes, you can read input or write to output of the PLC by mapping them to the correct MODBUS address. See Chapter 5 of your T100MD+ User's Manual for the mapping addresses.

As for the timers or counters set value, these cannot be modified directly from Modbus master. However, you can always write your changes to some DM and a simple TBASIC program can monitor if the DM value has changed, and if so, the run a SETTIMERSV to write the new set value to the Timers. (You should avoid running SETTIMERSV repeatedly regardless of the DM value as it will wear out the EEPROM and also disrupt HMI communication.

Alternatively, MODBUS master can write to the DM the new SV for timers or counters, then set a relay in the PLC to ON so that a custom function is executed by this relay to run the SETTIMERSV or SETCTRSV functions to update the new S.Vs.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Petty_boy

  • Jr. Member
  • **
  • Posts: 53
  • I'm a llama!
    • View Profile
Re:Modbus Master able to change Timers
« Reply #2 on: June 02, 2008, 12:18:54 PM »
Ok Thanks, I'll give that a go.  

Regarding the EEPROM and HMI communication issues, what other functions if not all should I avoid using to much?

I was going to use the ADAM I-7000 units to add around 40 analogue I/O's to the TMD, store the data items in DM then have the HMI read these direct from there.  I need to store the value's so I can set alarm points around the values etc.

I'm sure I read on the forum you can write to the EEPROM 1000000 times, if I read 40 analogue values and store them in the DM every second or so, will I kill the EEPROM in next to no time? are the DM and EEPROM the same thing?

is it possible to replace after failure or upgrade the EEPROM to a bigger size?

I'm fairly new to the programing side of things so I appreciate the help.

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3171
    • View Profile
    • Internet Programmable PLCs
Re:Modbus Master able to change Timers
« Reply #3 on: June 02, 2008, 10:22:34 PM »
Yes, you should not be writing to the EEPROM every second since that will wear out the EEPROM quite quickly. Also EEPROM write is time consuming and also affect system interrupts because interrupt is shut off during EEPROM write. EEPROM can be used to back up data before system shut down. If you want a non-volatile backup of data all the time then we recommend using MX-RTC. With DIP switch #1 turned ON data read into DM are non-volatile.

T100MD+ EEPROM can be replaced with M2017P or M2018P. M2018P is expanded version and enable the PLC to have 8190 words of program memory and 7700 words of data EEPROM.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Petty_boy

  • Jr. Member
  • **
  • Posts: 53
  • I'm a llama!
    • View Profile
Re:Modbus Master able to change Timers
« Reply #4 on: June 03, 2008, 09:08:28 AM »
Hi, so are all DM values stored in the EEPROM?

When you read an ADC or a DAC are these values being taking from the EEPROM?

Is there another way to read the values & create alarm setpoints via TBASIC without writing to the EEPROM?

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3171
    • View Profile
    • Internet Programmable PLCs
Re:Modbus Master able to change Timers
« Reply #5 on: June 03, 2008, 10:06:42 AM »
DM values are all stored in RAM.

ADC and DAC values are not stored. If you need them to be non volatile then you read them into DM and have MX-RTC to back it up so that when there is power failure, a 1st.Scan pulse can set the DAC to the desired value and the DM that kept the last ADC reading will still be there.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Petty_boy

  • Jr. Member
  • **
  • Posts: 53
  • I'm a llama!
    • View Profile
Re:Modbus Master able to change Timers
« Reply #6 on: June 03, 2008, 12:28:30 PM »
OK,

so if I read the ADC and store the value in DM (RAM) then map the modbus to the DM, the HMI will read the values from the DM location.  This process doesn't write to the EEPROM, Correct?

Going back to the original question, to change a timer value, the HMI can write a new value to a specific DM location, then use a TBASIC function to monitor if the DM value has changed, and if so, the run a SETTIMERSV to write the new set value to the Timers.   As I only intend to change the timers manually once in a while I don't think EEPROM writes are an issue.

As you stated previously to keep the DM Value (timer settings, ADC channel values etc) after power down I would need the MX-RTC.

So now we've cleared that little lot up! is there an existing example of the two main functions needed above i.e.

1. Tbasic program that monitors the DM value and if it has changed use the SETTIMERSV to write the new setting.

2. Map the DM value to a modbus address i.e. read timer 1 setting DM[1] in Modbus address 401001

Kind regards

Marcus

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3171
    • View Profile
    • Internet Programmable PLCs
Re:Modbus Master able to change Timers
« Reply #7 on: June 03, 2008, 03:49:35 PM »
E.g. if you use DM[100] to store the setvalue of timer 1 and DM[101] to store the last value.

1) 1st.Scan pulse to run a CF that read the timer 1 setvalue in DM[100]:

   DM[100] = GETTIMERSV(1)
   DM[101] = DM[100]  ' so that the two values are the same initially.

2) setup a clock pulse to run a CF that monitors the change in DM[100] every 1 second.

IF DM[100] <> DM[101]
    SETTIMERSV 1,DM[100] ' store the new SV to Timer #1.
    DM[101] = DM[100]       ' so that the change is updated
ENDIF

Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Petty_boy

  • Jr. Member
  • **
  • Posts: 53
  • I'm a llama!
    • View Profile
Re:Modbus Master able to change Timers
« Reply #8 on: September 09, 2008, 04:17:27 PM »
Hi

I have two questions,

Q1. Do I need to do anything to the TMD to make it respond to polls from a modbus master (my HMI) on either serial port RS232 or RS485 or will it respond as per the memory mapping in chapter 5 of the TMD manual automatically?

Q2. How do I map the DM value to a modbus address i.e. if I store the ADC or DAC value in DM[1], how does this become a modbus address i.e. 40200

Many Thanks Marcus.

Petty_boy

  • Jr. Member
  • **
  • Posts: 53
  • I'm a llama!
    • View Profile
Re:Modbus Master able to change Timers
« Reply #9 on: September 09, 2008, 04:25:23 PM »
Hi, Just read the manual again! and both of my questions are answered. Thanks.

Marcus