Internet PLC Forum
General => Technical support => Topic started by: scott 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)
-
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.
-
I was going to use status, but have not found any information on status command in manual.
-
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