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!