Author Topic: NETCMD$ ?Read or Write error  (Read 6523 times)

scott

  • Newbie
  • Posts: 5
  • I love YaBB 1G - SP1!
    • View Profile
NETCMD$ ?Read or Write error
« on: November 04, 2002, 02:40:54 AM »
How do I detect a network read or write error. I need to turn off outputs if this happens.

This is the code running.

Z$ = NETCMD$ (3,"@02RVS0101")
IF LEN(Z$) = 0 RETURN : ENDIF
RELAY[3] = HEXVAL(MID$ (Z$,7,4)

« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3171
    • View Profile
    • Internet Programmable PLCs
Re: NETCMD$ ?Read or Write error
« Reply #1 on: November 04, 2002, 07:31:21 AM »
If the communication is successful, Z$ will receive a string from the addressed slave. If you receive an empty string it indicates that the communication was not successful and you could use that for certain action.

You can also use the STATUS(1) function to give you the communication status of the NETCMD$ or READMODBUS or WRITEMODBUS function.
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

scott

  • Newbie
  • Posts: 5
  • I love YaBB 1G - SP1!
    • View Profile
Re: NETCMD$ ?Read or Write error
« Reply #2 on: November 04, 2002, 08:55:09 AM »
I was going to use status, but have not found any information on status command in manual.
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3171
    • View Profile
    • Internet Programmable PLCs
Re: NETCMD$ ?Read or Write error
« Reply #3 on: November 04, 2002, 10:42:57 AM »
It is in the on-line help in TRiLOGI Version 5.0. Press F1 when in TRiLOGI and select the "TBASIC Keyword Reference" link. I have reproduce it as follow:

-------------

STATUS (n)

Purpose Return the status of various system operations. Function Returned value
 
status (1) 0 - Normal power on reset
1 - Reset by Watch Dog Timer (WDT)
status (2) 0 - READMODBUS or WRITEMODBUS failure
1 - READMODBUS or WRITEMODBUS successful
status(8) PLC?s ID address stored in EEPROM for host communication
 
Examples IF STATUS(2)    'MODBUS READ/WRITE OK
?
ELSE           'MODBUS READ/WRITE failed
?
ENDIF

« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS