I want to control PLC omron CPM1A using this command
00KSCIO 000000 and the result must @00KSCIO 0000003D*. when i use
VB 6 the result is ok but when i convert to B4A the result missmatch become
@00KSCIO 0000003d*. I got lower case d. any mistake conversion to B4A? can anyone help me?:sign0163:
VB6
B4X:
Private Sub Command1_Click()
txt=txtcommandPLC.text
call send
end sub
Send:
Length = Len(txt)
R = Asc( "@")
For I = 1 To Length
K = Mid(txt , I , 1)
R = R Xor Asc(k)
Next
txtsend.text= "@" ; Txt ; Hex(R) ; "*" ; Chr(13)
B4A
B4X:
Dim type_PLC As String
dim length as string
type_PLC= edtPLC.Text
Length=type_PLC.Length
R = Asc( "@")
For I = 1 To Length
K = Asc(type_PLC.CharAt(I-1))
R=Bit.Xor(R,K)
Next
R=Bit.ToHexString(R)
edtSendPLC.Text ="@" & type_PLC & R & "*" & Chr(13)