Improbs Posted August 24, 2017 Share Posted August 24, 2017 I need to remotely control an instrument that uses an IT-E131 cable - is this possible through Autoit? Link to comment Share on other sites More sharing options...
iamtheky Posted August 25, 2017 Share Posted August 25, 2017 (edited) just serial right? there are plenty of serial comm threads (i think a UDF as well) that should help. Edited August 25, 2017 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Improbs Posted August 25, 2017 Author Share Posted August 25, 2017 Yes, the IT-E131 is serial. I've been able to control other instruments through RS232, GPIB, and ethernet cables, but I've been unable to control a DC electronic load that uses the IT-E131 cable. I was wondering if Autoit supports communication through IT-E131 cables. I can't find any other mentions of IT-E131 in this forum. Link to comment Share on other sites More sharing options...
iamtheky Posted August 25, 2017 Share Posted August 25, 2017 What OS and terminal do you use with this setup? How can you not send commands, at the very least, as keystrokes to the terminal... ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Improbs Posted August 25, 2017 Author Share Posted August 25, 2017 "What OS and terminal do you use with this setup? " OS on computer: Windows 7 professional Terminal on computer I'm using: RS232 port Terminal on instrument I'm trying to use: TTL Link to comment Share on other sites More sharing options...
jchd Posted August 25, 2017 Share Posted August 25, 2017 Can you check e.g. with an oscilloscope that your TTL<-->RS232 cable and your load instrument (BK ?) TTL port are both correctly working independantly? Then port settings should obviously match. After that there is no reason why the setup shouldn't work. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Improbs Posted August 25, 2017 Author Share Posted August 25, 2017 I got it working, thanks. _CommSetPort initializes the instrument. I was having trouble sending commands to the instrument - it's resolved now. Link to comment Share on other sites More sharing options...
iamtheky Posted August 26, 2017 Share Posted August 26, 2017 (edited) any idea what the problem was, or can you show the working code? Comm threads are few and far between, as are troubleshooting steps. Plus then you reach 5 posts and can engage in the debauchery that is Chat. Edited August 26, 2017 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Improbs Posted August 26, 2017 Author Share Posted August 26, 2017 To turn the instrument on, I had to send an a 26 byte array to the instrument. Initially, I was having trouble building a byte array and sending that byte array to the instrument. I built a structure instead and sent it to the instrument and it worked. This code works to put the 8502 Electronic Load in 'remote' mode (needs to be done before any other commands can be sent to the instrument): expandcollapse popupGlobal $iPort = 1 Global $iBaud = 38400 Global $iByteSize = 8 Global $iParity = 0 Global $iStopBits = 1 Global $iSetFlow = 0 Global $sportSetError = '' Global $ValRTS = 0 Global $ValDTR = 0 Global $NumerOfBytes = 26 Func Initialize_8502_DC_Electronic_Load() _CommSetPort($iPort, $sportSetError, $iBaud, $iByteSize, $iParity, $iStopBits, $iSetFlow, $ValRTS, $ValDTR) Sleep(200) If @error <> 0 Then MsgBox(0, "ERROR", "Device did not connect. Will exit program.") Exit EndIf _CommClearInputBuffer() _CommClearOutputBuffer() sleep(500) $Struct1 = DllStructCreate("byte[" & $NumerOfBytes & "]") ;$NumerOfBytes = command length ConsoleWrite("Building command structure to turn on 'Remote' mode." & @CRLF) For $index = 1 To 26 ;for 26 bytes If $index = 1 Then $byte = 170 $sum = $byte ElseIf $index = 2 Then $byte = 0 $sum = $sum + $byte ElseIf $index = 3 Then $byte = 32 $sum = $sum + $byte ElseIf $index = 4 Then $byte = 1 $sum = $sum + $byte ElseIf $index < 26 Then $byte = 0 $sum = $sum + $byte ElseIf $index = 26 Then $byte = Mod($sum,256) ;last byte needs to be modulo of the total sum of previous 25 bytes and the integer 256 EndIf DllStructSetData($Struct1, 1, $byte, $index) ;builds the 26 byte structure Sleep(100) Next _CommSendByteArray(DllStructGetPtr($Struct1), $NumerOfBytes, 1) ;sends byte structure to instrument ;~ $return_data = Binary(_CommGetLineModified()) ;~ ConsoleWrite("Value of return data: " & $return_data & @CRLF) If @error Then MsgBox(0, 'ERROR', 'Unable to send byte array. Will exit program.') Exit EndIf _CommClearInputBuffer() _CommClearOutputBuffer() sleep(500) EndFunc iamtheky 1 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