Msinclair you where right you get the tag information when you open the file to work with (with the open file command on pag 7-13)
Jiri Toman after playing for a littler bit this are my results
I used this command to open
visual basic code:
WriteToSend =
Chr(16) +
Chr(2)
'destination and source
WriteToSend = WriteToSend +
Chr(RemoteNodeAddress) +
Chr(DHNodeAddress)
'command type
WriteToSend = WriteToSend +
Chr(15)
'status of the message
WriteToSend = WriteToSend +
Chr(MessageStatus)
'transaction value 2 bytes long
WriteToSend = WriteToSend +
Chr(TransactionNumber) +
Chr(0)
'function
WriteToSend = WriteToSend +
Chr(129)
'Protection
WriteToSend = WriteToSend +
Chr(3)
'FileNumber 2bytes
WriteToSend = WriteToSend +
Chr(3) +
Chr(0)
'FileType
WriteToSend = WriteToSend +
Chr(133)
'termination of the message
WriteToSend = WriteToSend +
Chr(16) +
Chr(3)
And get the tag
lowtag =
Asc(
Mid(WriteFromPlc, 9, 1))
hightag =
Asc(
Mid(WriteFromPlc, 10, 1))
and send this one to write
WriteToSend =
Chr(16) +
Chr(2)
'destination and source
WriteToSend = WriteToSend +
Chr(RemoteNodeAddress) +
Chr(DHNodeAddress)
'command type
WriteToSend = WriteToSend +
Chr(15)
'status of the message
WriteToSend = WriteToSend +
Chr(MessageStatus)
'transaction value 2 bytes long
WriteToSend = WriteToSend +
Chr(TransactionNumber) +
Chr(0)
'function
WriteToSend = WriteToSend +
Chr(175)
'Size
WriteToSend = WriteToSend +
Chr(2)
'tag 2bytes
WriteToSend = WriteToSend +
Chr(lowtag) +
Chr(hightag)
'Offset
WriteToSend = WriteToSend +
Chr(0) +
Chr(0)
'filetype and data to write
WriteToSend = WriteToSend +
Chr(133) +
Chr(128) +
Chr(0)
'termination of the message
WriteToSend = WriteToSend +
Chr(16) +
Chr(3)
And send finally this to close it
WriteToSend =
Chr(16) +
Chr(2)
'destination and source
WriteToSend = WriteToSend +
Chr(RemoteNodeAddress) +
Chr(DHNodeAddress)
'command type
WriteToSend = WriteToSend +
Chr(15)
'status of the message
WriteToSend = WriteToSend +
Chr(MessageStatus)
'transaction value 2 bytes long
WriteToSend = WriteToSend +
Chr(TransactionNumber) +
Chr(0)
'function
WriteToSend = WriteToSend +
Chr(130)
'tag 2bytes
WriteToSend = WriteToSend +
Chr(lowtag) +
Chr(hightag)
'termination of the message
WriteToSend = WriteToSend +
Chr(16) +
Chr(3)
before
after
The code change the word B3:0
But actually this is not what I want I want to change just the bit B3:0/7
Best regards Hidroilio Pérez