Migrating some SS4.7 Python scripts to SS+ 2.2 and the new interface and I don't find any documentation or examples that illustrate how to interface from Python to actual hardware via SS+ like I did in SS4.7.
Have I overlooked an example or something that explains this? I got SigmaStudioPlus-Rel2.2.0\Examples\ScriptingClient\Python\PythonScripting.py to run so I can see how to get the environment set up from Python (can't say I understand it yet).
Specifically I'm looking to migrate the following types of things from SS4.7 to SS+:
EEPROM EXAMPLE
# access the EEPROM peripheral, write and then read it
ic_name = VARIANT(pythoncom.VT_BYREF | pythoncom.VT_BSTR, "IC 1")
masterAddress = 0x68
busAddress = 0x69
chipAddress = 0x50
addrwidth = 2
# first we're going to write 0x00 to the 1st address
writeaddress =0x0000
writeNumberBytes = 1
writedata_ee = [0x00]
writedata_ee_v = VARIANT(pythoncom.VT_ARRAY | pythoncom.VT_BYREF | pythoncom.VT_UI1, writedata_ee)
stat = server.A2B_SLAVE_PERIREGISTER_WRITE(ic_name, masterAddress, busAddress, nodeID,
chipAddress, writeaddress, addrwidth, writeNumberBytes, writedata_ee_v)
...
readAddress = 0x0000
readNumberBytes = 1
readdata_ee = []
readdata_ee_v = VARIANT(pythoncom.VT_ARRAY | pythoncom.VT_BYREF | pythoncom.VT_UI1, readdata_ee)
stat = server.A2B_SLAVE_PERIREGISTER_READ(ic_name, masterAddress, busAddress, nodeID,
chipAddress, readAddress, addrwidth, readNumberBytes, readdata_ee_v)
AD24xx GPIO EXAMPLE
#GPIO_Bits is a bit mask (8 bits) for which GPIO to enable
#nodeID is the sequential (sub) node number, i.e. 0 to N
def GPIOSet(nodeID, GPIO_Bits):
ic_name = VARIANT(pythoncom.VT_BYREF | pythoncom.VT_BSTR, "IC 1")
masterAddress = 0x68
busAddress = 0x69
writedata = [GPIO_Bits]
writedata_v = VARIANT(pythoncom.VT_ARRAY | pythoncom.VT_BYREF | pythoncom.VT_UI1, writedata)
stat = server.A2B_SLAVE_REGISTER_WRITE(ic_name, masterAddress, busAddress, nodeID, GPIO_ADDR, 1, writedata_v)
return stat
ROOT NODE READ EXAMPLE
ic_name = VARIANT(pythoncom.VT_BYREF | pythoncom.VT_BSTR, "IC 1")
readdata = []
readdata_v = VARIANT( pythoncom.VT_ARRAY | pythoncom.VT_BYREF | pythoncom.VT_UI1, readdata)
stat = server.A2B_MASTER_REGISTER_READ(ic_name, 0x68, 0x02, 1, readdata_v)
I looked at a2b.thrift and could make a WAG that ReadWritePacket might have something to do with it along with PeripheralReadWrite() from SdkScripting.Thrift but there's no info I can find about them.
This is part of a hardware test environment that is migrating from AD242x to AD243x. Specifically need this to work with AD2433 and AD2437 devices.
Thanks,
Brewster
tried to fix the funky formatting, seems to be a bug in whatever the forum software is.
[edited by: Brewster at 3:09 AM (GMT -4) on 22 Jun 2024]