i am new to in-can. i need to send 22 of data flames to ECU,and get the ECU respond. As attached are complete VB6.0 code.
i use this method to send all 22 data flames., and use ncwaitforstate,ncread to read the ECU respond. But, i couldn`t get it directly,
i need to place about 30seconds delay after the ncwrite, so that i can get the desire respond. i knew that this is not the right way to get the
respond,as the respond are expected return immediatly. i would expect respond from ECU without such a long delay. Anyway one, please advice. Thanks
For y = 0 To 21 Step 1
data = List2.List(x)
Data_1 = Mid(data, 1, 2)
Data_2 = Mid(data, 3, 2)
Data_3 = Mid(data, 5, 2)
Data_4 = Mid(data, 7, 2)
Data_5 = Mid(data, 9, 2)
Data_6 = Mid(data, 11, 2)
Data_7 = Mid(data, 13, 2)
Data_8 = Mid(data, 15, 2)
x = x + 1
Transmit.data(0) = "&H" & Data_1
Transmit.data(1) = "&H" & Data_2
Transmit.data(2) = "&H" & Data_3
Transmit.data(3) = "&H" & Data_4
Transmit.data(4) = "&H" & Data_5
Transmit.data(5) = "&H" & Data_6
Transmit.data(6) = "&H" & Data_7
Transmit.data(7) = "&H" & Data_8
Status = ncWrite(TxHandle, Len(Transmit), Transmit)
wait 30s
Next y
Status = ncWaitForState(RxHandle, (NC_ST_READ_AVAIL), 2000, State)
If (CheckStatus(Status, "ncWaitForState") = True) Then GoTo Error
Status = ncRead(RxHandle, Len(Receive), Receive)
If (CheckStatus(Status, "ncRead") = True) Then GoTo Error