Jump to content

Majkel

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by Majkel

  1. I don't know what kind of magic is it that but i just copied Your function and it works ! But when i added this line to my function then it returns parse Error. (Don't know why 🙄) Anyway it works, thanks for help ! _ Regards, Michal
  2. Hi Alan, Thanks for replay, unfortunately it is not working 😕 I gott parse error ==> Unable to parse line.: $iRet = DllStructGetData($tBinData, 1)? $iRet = DllStructGetData($tBinData, 1)^ ERROR
  3. Hi Everyone, I have a question about how shoud my function look to return hex bytes from com port. At this moment it returns number of bytes that have been read but where they go ? How to access them ? It would be perfect if they were returned as a hex string. I'm sending data like "0xBCFD0101000000AE" It should return "0xBCFD02000000FFAE" <- i want this to be returned as a result of function Func SendAndRead($data, $numBytesToRead, $readType = 1) $bBinData = Binary($data) $iNumbytes = BinaryLen($bBinData) $tBinData = DllStructCreate("byte["&$iNumbytes&"]") DllStructSetData($tBinData, 1, $bBinData) $iRet = _CommSendByteArray(DllStructGetPtr($tBinData),$iNumbytes,1) If (@error Or $iRet = -1) And $Initialized = 1 Then MsgBox($MB_SYSTEMMODAL, "Error while sending", "!Error: " & @error, 1) $iRet = _CommReadByteArray(DllStructGetPtr($tBinData),$numBytesToRead,$readType) If (@error Or $iRet = -1) And $Initialized = 1 Then MsgBox($MB_SYSTEMMODAL, "Error while reading", "!Error: " & @error, 1) Finalize() EndIf Return $iRet EndFunc Anyone can help ? Thanks !
×
×
  • Create New...