joseLB Posted May 18, 2016 Share Posted May 18, 2016 How can I read a byte with valule=0 that comes from serial ? I´m using: $comRs232 = ObjCreate("NETCommOCX.NETComm") and $comRs232.inputData Local $a[8] while 1 If $comRs232.InBufferCount > 7 Then $X= $comRs232.InBufferCount $Z= StringToASCIIArray($comRs232.inputData,0,$X,1) _ArrayDisplay($Z) MsgBox(4096,$X,StringLen($Z) &@cr& $Z) For $J= 0 To 7 $a[$J]= chr(StringMid($Y,$J+1,1)) Next _ArrayDisplay($a) terminaExecucao() EndIf WEnd Seems to me that the problem is that $comRs232.inputData is already a string for AU3, and so when there is a byte=0, it stops reading the string. No matter what I put arround $coRs232.inputData, AU3 don´t goes further the byte=0. I already tried binary , bynaryToSring and it´s variants, combinations betwen bynaryxxx and stringToASCxxx and vice versa, Could DLLxxx be useful in this case? At the end the desirable result would be $a[0]= 1st byte, .... $a[6]= 7th byte (all as a number (integer, from 0 - 255). If I have to use other dlls or onother way to communicate with serial port, OK too (send and receive). Today my only problem is when a byte value 0 arrives. All the other values (1..255) are OK. Thanks in advance Jose Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now