KSS 8.3
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 :
<RECEIVE>
<XML>
...
<ELEMENT Tag="Robot01" Set_Flag="1" />
</XML>
</RECEIVE>
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[5] 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[5] to True to ensure that the new message is written in variable -> While waiting for that FLAG[5] to become True in the main program (WAIT FOR $FLAG[5]==TRUE), but that only stopped the program:
Program Logic:
Main Program:
; Interrupt if ethernet message was received and set Flag 1 to TRUE
INTERRUPT DECL 89 WHEN $FLAG[1]==TRUE DO GET_FROM_PC()
INTERRUPT ON 89
; Reset Ethernet Receive Message
$FLAG[1]=FALSE
; ConXmlFile01.xml
serviceName[] = "ConXmlFile01"
RET=EKI_Init(serviceName[])
RET=EKI_Open(serviceName[])
....
WHILE (true)
...
;wait until data read
WAIT FOR $FLAG[1]
; Reset Ethernet Receive Message
$FLAG[1]=FALSE
;wait for FLAG 5 to be sure that message is read
WAIT FOR $FLAG[5]==TRUE
$FLAG[5]=FALSE
...
ENDWHILE
Display More
and in GET_FROM_PC:
DEF GET_FROM_PC( )
; Reset Ethernet Receive Message
$FLAG[1]=FALSE
;Flag that entire message is read
$FLAG[5]=FALSE
...
EKI_Get ...
...
$FLAG[5]=TRUE
END
Display More
Do you have any advice on how to solve this problem?
Thanks in advance