User guide
62
VTB USER GUIDE
Example
Used variables:
pxco_nmt(2,1) ‘Set in STOP the node 1
READ_EMCY
Reads the last EMERGENCY OBJECT frame sent by a CAN OPEN node.
The emergency code is written in the system array _SYSTEM_EMCY(8) and it will contain all the 8 bytes of the
EMERGENCY OBJECT frame as from the DS301 specific of the CAN OPEN. Usually it is called cyclically. The emergency
code depends by type of connected device, therefore refer to its manual.
Hardware All
Syntax
READ_EMCY() as char
Return value
char 0 No error
<>0 Node that generated the emergency object.
_SYSTEM_EMCY
0
1
2
3
4
5
6
7
Emergency Error Code
Error
Register
Manufacturer specific Error Code
WARNING
The system doesn't buffer more than one message, then if more EMERGENCY OBJECT are sended along a single
task plc, only the last will be read.
An EMERGENCY OBJECT non significa che effettivamente ci sia un nodo in emergenza. The DS301 specific provide
that an EMERGENCY OBJECT are send also on alarm reset. Furthermore some devices can be send this frame at
start up.
Example
Used variables:
Err Long
NodeErr Char
function Alarm() as void
NodeErr=read_emcy()
if NodeErr=0 ' no error
return
endif
err=(_SYSTEM_EMCY(7)&0xff) ' Read 4 byte of Manufactured specific
err=err<<8 ' field masking eventual bit not
err=err|(_SYSTEM_EMCY(6)&0xff) ' interested
err=err<<8
err=err|(_SYSTEM_EMCY(5)&0xff)
err=err<<8
err=err|(_SYSTEM_EMCY(4)&0xff)
endfunction
11.6 DATA SAVING FUNCTIONS
All hardware are equipped with several type of memory usable for DATA SAVING. According to the type of memory (Fash,
Fram, etc.) some rules are to be implemented.










