VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

ironPython API question

I'm learning to use python script with VeriStand, but have problem setting values to channels.

 

I try to write a value to an input channel called "Memory Address", and read the value from the same channel to see if it's written correctly.

But no matter what the value is written to the channel, it's always read back as "0".

 

Here is the *.py code snippet:

 

    print "set the memory address"
    wks.SetSingleChannelValue("Controller/Custom Devices/GSE Interface/Inputs/Memory Address", 115948)
    GSETest1 = wks.GetSingleChannelValue("Controller/Custom Devices/GSE Interface/Inputs/Memory Address")

    print "memory address is %d" %GSETest1

 

Can I read back value from input channels?

What is the format of the value written to channels?

If the python script runs properly, is WorkSpace going to be launched? (I tried to run sinewave script but it showed me test failed, so i don't know what the expect result looks like).

 

Thanks.

0 Kudos
Message 1 of 5
(6,714 Views)

I tried again with the WorkSpace launched before running the python script. It works! Amazing!

 

It looks like set API can write values to input channels only and get API can read values from output channels only.

 

 

0 Kudos
Message 2 of 5
(6,711 Views)

There are also functions to programmatically deploy a system definition, so you don't have to rely on it already being running before you run a script. Here is another thread with some good starter material on the IronPython API. The API is built on the same automation API that the VeriStand Workspace and Project utilize, so it has extensive features you can take advantage of.

 

Good luck and let us know how it goes!

Jarrod S.
National Instruments
0 Kudos
Message 3 of 5
(6,701 Views)

Thank you, Jarrod. That thread was very helpful.

 

One more question - is it possible to set value to aliases via SetSingleChannelValue()?

I created aliases for those channels and tried to set and get channel values to/from aliases, but it didn't work.

0 Kudos
Message 4 of 5
(6,678 Views)

Is it possible to access already configured FPGA PWM channels using veristand python?

0 Kudos
Message 5 of 5
(2,853 Views)