Jump to content

Terribletrux

Members
  • Posts

    9
  • Joined

  • Last visited

Terribletrux's Achievements

  1. Thank you for all the reply's, its greatly appreciated. Mikell, The Do Loop is not needed. It was just used to demonstrate my problem.
  2. Thank you spudw2k & FireFox for your quick replies. I will investigate these options further, have a good weekend.
  3. Hello everyone, I'm trying to convert a number in nanowatts to watts, to do so I have to move the decimal 10−9. For example 5.6nW is the same as 0.0000000056W. I can't seem to figure out how to get AutoIT to show all the numbers. It seems I can only go as far as 10-4 before AutoIt converts the number back to exponent form. #include <MsgBoxConstants.au3> Local $num1 = 5.6 Local $num2 = 0 Do Local $Answer = ($num1/(10^$num2)) MsgBox($MB_SYSTEMMODAL, "", "The new number is " & $Answer) $num2 = $num2 + 1 Until $num2 = 9 Does anyone know of a different way to do this calculation and keep all the numbers (Zeros)??
  4. Not sure why I could not get this to work with CommAPI, but i was able to get this working using >VISA / GPIB library for AutoIt3. See my attached code. #include <Visa.au3> #include <MsgBoxConstants.au3> ;Open a connection to the instrument. Local $h_Instr = _viOpen("ASRL1::INSTR") ;"ASRL1::INSTR" is the VISA connection handle for COMM 1 on my PC. MsgBox($MB_SYSTEMMODAL, "Instrument Handle obtained", "$h_Instr = " & $h_Instr) ;Show the Session Handle. ;Query the instrument. Local $s_Answer = _viExecCommand($h_Instr, "*IDN?") ;$h_Instr is NOT A STRING now! MsgBox($MB_SYSTEMMODAL, "GPIB QUERY result", $s_Answer ) ;Show the answer. _viExecCommand($h_Instr, "OUTP ON") ;Turn output on. Sleep (1000) _viExecCommand($h_Instr, "VOLT 7.0") ;Adjust voltage to 7 volts. Sleep (1000) _viExecCommand($h_Instr, "VOLT 0.0") ;Adjust voltage to 0 volts. Sleep (1000) _viExecCommand($h_Instr, "OUTP OFF") ;Turn output off. Sleep (1000) $s_Answer = _viExecCommand($h_Instr, "VOLT?") ;Query the instruments current voltage setting. ; Close the instrument conection. _viClose($h_Instr) MsgBox($MB_SYSTEMMODAL, "Title", $s_Answer, 5)
  5. Hello, I'm trying to communicate with a Agilent E3649A DC Power Supply. I have written some code using the CommAPI and so far I am only able to send commands, I cannot receive anything. When I use the application that comes with the power supply everything is working as it should so that rules out the cable. Can someone look over my test code? I may have missed something... #include <CommInterface.au3> #include <MsgBoxConstants.au3> Local Const $iPort = 1 Local Const $iBaud = 9600 Local Const $iParity = 0 Local Const $iByteSize = 8 Local Const $iStopBits = 2 Local $hFile =_CommAPI_OpenCOMPort($iPort, $iBaud, $iParity, $iByteSize, $iStopBits) _CommAPI_ClearCommError($hFile) _CommAPI_PurgeComm($hFile) _CommAPI_TransmitString($hFile, "OUTP ON"&@LF) ;Turn output on Sleep (1000) _CommAPI_TransmitString($hFile, "VOLT 7.0"&@LF) ;Adjust voltage to 7 volts Sleep (1000) _CommAPI_TransmitString($hFile, "VOLT 0.0"&@LF) ;Adjust voltage to 0 volts Sleep (1000) _CommAPI_TransmitString($hFile, "OUTP OFF"&@LF) ;Turn output off Sleep (1000) _CommAPI_TransmitString($hFile, "*IDN?") ;Identify your-self Local $sResult =_CommAPI_ReceiveString($hFile, 1, 0);Recieve string _CommAPI_ClosePort($hFile) MsgBox($MB_SYSTEMMODAL, "Title", $sResult, 5) I know that the commands are being sent properly because I can see the output status change on the display of the power supply and my connected LED lights up and then goes out. Also here is a link to the user manual http://cp.literature.agilent.com/litweb/pdf/E3646-90001.pdf Thank you in advance!
  6. Hello, I'm trying to communicate with a Agilent E3649A DC Power Supply. I have written some code using the CommAPI and so far I am only able to send commands, I cannot receive anything. When I use the application that comes with the power supply everything is working as it should so that rules out the cable. Can someone look over my test code? I may have missed something... #include <CommInterface.au3> #include <MsgBoxConstants.au3> Local Const $iPort = 1 Local Const $iBaud = 9600 Local Const $iParity = 0 Local Const $iByteSize = 8 Local Const $iStopBits = 2 Local $hFile =_CommAPI_OpenCOMPort($iPort, $iBaud, $iParity, $iByteSize, $iStopBits) _CommAPI_ClearCommError($hFile) _CommAPI_PurgeComm($hFile) _CommAPI_TransmitString($hFile, "OUTP ON"&@LF) ;Turn output on Sleep (1000) _CommAPI_TransmitString($hFile, "VOLT 7.0"&@LF) ;Adjust voltage to 7 volts Sleep (1000) _CommAPI_TransmitString($hFile, "VOLT 0.0"&@LF) ;Adjust voltage to 0 volts Sleep (1000) _CommAPI_TransmitString($hFile, "OUTP OFF"&@LF) ;Turn output off Sleep (1000) _CommAPI_TransmitString($hFile, "*IDN?") ;Identify your-self Local $sResult =_CommAPI_ReceiveString($hFile, 1, 0);Recieve string _CommAPI_ClosePort($hFile) MsgBox($MB_SYSTEMMODAL, "Title", $sResult, 5) I know that the commands are being sent properly because I can see the output status change on the display of the power supply and my connected LED lights up and then goes out. Also here is a link to the user manual http://cp.literature.agilent.com/litweb/pdf/E3646-90001.pdf Thank you in advance!
×
×
  • Create New...