In the main program:
1. EthernetKRL communication is opened in XML form:
2. an interrupt is also declared
which is called when entire message arrives (FLAG 1 becomes true in that case, which, as you already know, is set in the config file :
<ELEMENT Tag="Robot01" Set_Flag="1" />
3. In this interrupt function, values are actually written from memory into some variables
This all works as it should for a while, but then it happens that the message that was sent arrives incorrectly, in the sense that I see that the variable True was sent from the PC, but the program read it as False
I thought that EKI_ClearBuffer before the message arrived would help, but that didn't help,
Another thing I tried is to set the new flag (FLAG in Program Logic ) to False at the beginning of the function GET_FROM_PC().
When the end of the function is reached -> that is, everything has been read from memory, to set the FLAG to True to ensure that the new message is written in variable -> While waiting for that FLAG to become True in the main program (WAIT FOR $FLAG==TRUE), but that only stopped the program:
; Interrupt if ethernet message was received and set Flag 1 to TRUE INTERRUPT DECL 89 WHEN $FLAG==TRUE DO GET_FROM_PC() INTERRUPT ON 89 ; Reset Ethernet Receive Message $FLAG=FALSE ; ConXmlFile01.xml serviceName = "ConXmlFile01" RET=EKI_Init(serviceName) RET=EKI_Open(serviceName) .... WHILE (true) ... ;wait until data read WAIT FOR $FLAG ; Reset Ethernet Receive Message $FLAG=FALSE ;wait for FLAG 5 to be sure that message is read WAIT FOR $FLAG==TRUE $FLAG=FALSE ... ENDWHILE
and in GET_FROM_PC:
DEF GET_FROM_PC( ) ; Reset Ethernet Receive Message $FLAG=FALSE ;Flag that entire message is read $FLAG=FALSE ... EKI_Get ... ... $FLAG=TRUE END
Do you have any advice on how to solve this problem?
Thanks in advance