Author Topic: Customizing the nano-10 webpage  (Read 13153 times)

StefanA

  • Newbie
  • *
  • Posts: 29
  • I'm a llama!
    • View Profile
Customizing the nano-10 webpage
« on: September 06, 2012, 10:15:35 AM »
Having some trouble with customizing the nano-10 webpages. I want to add more "clickable boxes" for controlling internal relay bit 137 and upwards.

I managed to display some boxes on the webpage and I can turn them on and off from the plc program. But how do I toggle them from the webpage? If I understand the comments in javascript file M, 512 internal relays are accessable.

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re: Customizing the nano-10 webpage
« Reply #1 on: September 06, 2012, 05:49:29 PM »
Note that customization of the JavaScript file (M.JS) is currently not supported and is only recommended for experienced JavaScript programmers.

If you have already added more boxes linked to relay bits in the PLC, then you have probably updated the drawRelay() function.

You also need to edit the doClick() function, which is used in the drawRelay() function. You will need to repeat the code in the If statement but modify the repeated code to write to the next 8 relay bits (assuming those are the bits you want to add). The following line of code from that function is what dictates which bits are written to in the PLC:

    cmd="HOSTLINK/WR11"+d2h(rly)+timestamp()

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

StefanA

  • Newbie
  • *
  • Posts: 29
  • I'm a llama!
    • View Profile
Re: Customizing the nano-10 webpage
« Reply #2 on: September 07, 2012, 09:55:27 AM »

To bad that customization is not supported. This stuff isn't easy for a average joe like me. I'm not quite sure what I did exactly when I added more boxes. I changed one
thing in the drawrelay() function (as you pointed out in your replay). Have been fiddeling with the doclick() function aswell but got stuck.




function drawRelay(){
  var el
  var ioname;      // replace space with " "
  var value = RELAY[9]  // Internal Relay #129 to 140
  for (i=0;i<14;i++) { //-------------------------I changed this line
    el = document.getElementById("IO"+(i+1))
    if (el==null) {
      ioname=""
      for (j=0;j<IOname.length;j++) {
           ch=IOname.charAt(j)
           if (ch==' ') ioname += "&nbsp;"
           else ioname += ch
      }



function doClick(el) {
  var xmlhttpClick= createXMLhttp()
  clickBusy =1
  clearInterval(intervalID);
  if ((el.id).substring(0,2)=="IO") {  
    var rly = RELAY[9]

    var pos = el.id.substring(2)-1
    rly ^= bitMask[pos]          // toggles bit
    cmd="HOSTLINK/WR10"+d2h(rly)+timestamp()
    clearInterval(intervalID);
    xmlhttpClick.open("GET",cmd,true);
    try {
      xmlhttpClick.onreadystatechange=function() {
       if (xmlhttpClick.readyState==4) {
         checkSvrResp(xmlhttpClick,"doClick")
         clickBusy=0        
         doUpdate()
         getRelay()


Is Relay[9] the same as relay channel 10, as in cmd="HOSTLINK/WR10"+d2h(rly)+timestamp()

Repeat code? Please explain.

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re: Customizing the nano-10 webpage
« Reply #3 on: September 07, 2012, 01:35:40 PM »
RELAY[n] are 16-bit variables used to represent internal relay bits 1-512. RELAY[1] is for relay bit #1 to #16, RELAY[2] is for relay bit #17 to #32, and so on.

The reason web control programming are not supported is because these are all Javascript programming questions and not the PLC programming questions and we at tech support are not that familiar with Javascript. We can advise how to configure the 0.htm document based on the standard template without changing the core M.JS javascript files.

You can try to post your Javascript related questions to the web programming community and get help from (possibly) millions of Javascript programming experts on the web.
« Last Edit: September 07, 2012, 01:37:32 PM by support »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

StefanA

  • Newbie
  • *
  • Posts: 29
  • I'm a llama!
    • View Profile
Re: Customizing the nano-10 webpage
« Reply #4 on: September 08, 2012, 02:25:17 AM »
Ok, thank you for the info.