thestormdragon Posted December 1, 2015 Share Posted December 1, 2015 HiI'm trying to use Martin's CommMG.au3 to send commands to my monitor (controlled via RS232) and to retrieve the result from the monitor.I've got the "sending" part down pat but never seem to receive anything - here's the relevant code ;set the port settings $CMPort = "1" $CmBoBaud = "9600" $CmboDataBits = "8" $CmBoParity = "none" $CmBoStop = "1" ;convert the HEX string to its decimal equivalent $bBinData = Binary("0xA6010000000301AD08",8)) $iNumbytes = BinaryLen($bBinData) $tBinData = DllStructCreate("byte["&$iNumbytes&"]") DllStructSetData($tBinData, 1, $bBinData) ;Open the port with the settings _CommSetPort($CMPort, $sportSetError, $CmBoBaud, $CmboDataBits, $CmBoParity, $CmBoStop, 0, 1, 1) ;send the converted data to the monitor $iRet = _CommSendByteArray(DllStructGetPtr($tBinData),$iNumbytes,1) ;msgbox(1,"1","----- " & BinaryToString(_CommReadByteArray()) & " -----") <<<<<<-------- EDIT THIS LINE TO DISPLAY THE RECEIVED DATA If @error Or $iRet = -1 Then ConsoleWrite("!Error: " & @error & @CRLF) _CommClearOutputBuffer() _CommClearInputBuffer() _CommCloseport()The monitor is supposed to return 21 01 00 00 05 01 AD FD 04 70 Does anyone have any ideas as how what that line should be? I've looked on the forums / google and am obviously not doing the right thing Many thanks in advanceDavid 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