agaelema Posted July 5, 2017 Share Posted July 5, 2017 Hi, It's possible to execute the Waveforms software and in parallel execute some python script with waveforms API. I know, this can look crazy, but I'm thinking in add some physical knobs to control the values inside the Waveforms. Thanks. Link to comment Share on other sites More sharing options...
attila Posted July 6, 2017 Share Posted July 6, 2017 Hi @agaelema The device can be accessed by only one application at a time. However you could use the Script tool to create such features. - connect the physical buttons to DIO and use simple button or create a microcontroller project which processes the knob signals and communicates with the script using SPI, I2C.. - create a separate application/script which communicates using file with the Script tool. Your application writes to a file the knob position and the script periodically checks the current value and adjust the interface option by the difference. Here DIO 0 increases and DIO 1 decreases the time base. function find125(val){ var si = sign(val) var val2 = pow(10, ceil(log10(abs(val)))); if(val <= val2/5) return val = si*val2/5; if(val <= val2/2) return val = si*val2/2; return si*val2; } while(wait(0.1)){ if(StaticIO.Channel0.DIO0.Input.value == 1){ // up Scope1.Time.Base.value = find125(Scope1.Time.Base.value*2); wait(0.5); } if(StaticIO.Channel0.DIO1.Input.value == 1){ // down Scope1.Time.Base.value = find125(Scope1.Time.Base.value/3); wait(0.5) } } Link to comment Share on other sites More sharing options...
jpeyron Posted July 5, 2017 Share Posted July 5, 2017 Hi @agaelema, I do not think that you can have the Waveforms api connected to a device as well as an additional python scripts using the waveforms sdk to interact with the same device as the same time. ( @attila could you correct me if I am wrong) cheers, Jon Link to comment Share on other sites More sharing options...
agaelema Posted July 6, 2017 Author Share Posted July 6, 2017 Hi @jpeyron and @attila. The original idea is to use some microcontroller and send the values over SPI, i2c or uart. I noted that it is possible to create custom codes / scripts for the SPI and I2C, but not to UART. Is it possible to control it using a script? Some example? Thnaks Link to comment Share on other sites More sharing options...
attila Posted July 6, 2017 Share Posted July 6, 2017 Hi @agaelema You can find some examples under Protocol/ SPI | I2C / Custom. In order to have access to other instruments you will have to access Protocol functions from Script tool. Here the functions need to be prepended with Protocol.SPI or .I2C First open and configure the Protocol SPI or I2C (frequency, pins...) and select Custom tab. Then run the script which uses the SPI or I2C functions, like: Protocol.SPI.Start(); // activate CS Protocol.SPI.Write(8, [0x0A]); // write to MOSI, 0x0A as 8 bit command var rg = Protocol.SPI.Read(32, 4); // read from MISO 4 words of 32 bits Protocol.SPI.Stop(); // deactivate CS Scope1.Time.Base.value = 0.000001*rg[0] // use value as micro second From Script only the UART Send/TX function is available: Protocol.UART.Send("Hello\n") Link to comment Share on other sites More sharing options...
Question
agaelema
Hi,
It's possible to execute the Waveforms software and in parallel execute some python script with waveforms API.
I know, this can look crazy, but I'm thinking in add some physical knobs to control the values inside the Waveforms.
Thanks.
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.