Hello I wrote a simple code to access hardware CAN channel from chassis using Ironpython Workspace2 SetsingleChannel method.
I ran into an exception :
Unexpected Exception Consult NI VeriStand help for error code 0xfffb4e32 error m
essage Could not find channel 'Targets\Controller\Hardware\Chassis\DAQ\PXI1Slot2
It seems I am not able to access XNET port using IronPython.
Please see my implementation below:
APPDATADIR = r"C:\Users\Public\Documents\National Instruments\NI VeriStand 2016"
CANPROJECTDIR = APPDATADIR + '\\Projects\TestPWM'
CANSDF = CANPROJECTDIR + '\\TestPWM.nivssdf'
print CANSDF
LOGGINGDIR = CANPROJECTDIR + '\\Logs'
TIMECHAN = 'Targets/Controller/System Channels/System Time'
CANCHAN = 'Targets/Controller/Hardware/Chassis/NI-XNET/CAN/CAN1/Outgoing/Cyclic Event/BodyInfo_HS3 (946)/Ignition_Status'
DIOCHANNEL = "Targets\Controller\Hardware\Chassis\DAQ\PXI1Slot2\Digital Output\port0\DO7"
print CANCHAN
print "Before Veristand Workspace Open"
wks = NIVeriStand.Workspace2("localhost")
print "After Veristand Open"
try:
print "Running %s" % CANSDF
print "Inside System Definition File"
wks.ConnectToSystem(CANSDF,1,60000)
print "after Connect to system"
print "NI VeriStand Running and Client Connected!"
CanVal = wks.SetSingleChannelValue(CANCHAN,4)
print "Ignition sent"
while (state == 2):
CanVal = wks.SetChannelValues(CANCHAN,4)
print "If Veristand is open send ignition "
time.sleep(1)
raw_input("\n\nPress the enter key to exit.")
except NIVeriStandException, e:
TEST_COMMENT = "Unexpected Exception " + e.message()
print TEST_COMMENT
time.sleep(10)
except:
print sys.exc_info()
time.sleep(10)
finally:
wks.DisconnectFromSystem("",1)
Can anyone please suggest me how to access hardware ->Chassis->CAN or DAQ or FPGA using Veristand and Ironpython ?