MethodSCRIPT in action: introduction, demonstration and Q&A session
As an OEM supplier, PalmSens is aware of how important your own software is. We support our customers with several Software Development Kits (SDK), which make writing your own software easier and more efficient. Efficient programming for our potentiostat modules by our customers reached a new level with the release of the EmStat Pico. This small potentiostat is communicating to its software via MethodSCRIPT, a programming language developed by PalmSens to enable customers to write the software for their application on almost any programming platform. In this webinar recording, we will show you how to extract MethodSCRIPT code from PSTrace, how to make your instrument hibernate, perform a measurement after a trigger, and more.
MethodSCRIPT expert Hielke Veringa and Dr. Lutz Stratmann will give you a brief general introduction to MethodSCRIPT followed by a live demonstration and Q&A session It will last a total of 40 minutes comprising around 20 minutes for the introduction and demonstration followed by 20 minutes for questions.
Download the three PSMethod files used in the webinar using the button below. Connect a (virtual) EmStat Pico or EmStat4M module, and go to the MethodSCRIPT Sandbox editor. The three MethodSCRIPT examples are also shown below.
Download MethodSCRIPT documentation
Scroll down to the examplesTimestamps in the MethodSCRIPT webinar
- 00:00 Waiting for last people joining
- 01:45 Introduction of the speakers
- 03:34 Introduction to MethodSCRIPT
- 08:35 Demonstration of three MethodSCRIPT examples
- 09:39 First example: SWV with Sensit BT saved on onboard storage
- 10:45 Load first measurement from onboard storage
- 11:46 Second example: Temperature measurement on the Sensit BT using i2C, start with trigger button
- 15:12 More examples of using i2C
- 15:47 Third example: Peak detection on the EmStat4M Development Kit
- 19:30 Give feedback via green and red LED
- 22:08 Summary
- 22:53 What is hibernating mode?
- 24:20 Start Questions & Answer session
- 24:49 Can you perform three measurements and save the data of only one in the memory?
- 26:05 Is there an example how to use the onboard Real Time Clock?
- 27:36 Is it possible to start the measurement based on a timer?
- 28:34 Can MethodSCRIPT be used to perform multiple methods after each other?
- 30:40 Can you do a loop in a loop?
- 31:30 What is the different between MethodSCRIPT and Scripting in PSTrace?
- 34:18 Can you create MethodSCRIPT out of the PSTrace scripting window?
- 35:02 Combining MethodSCRIPT and PSTrace scripting window
- 37:15 When to use C# Software Development Kit and when to use MethodSCRIPT 49:09 Can you perform peak fitting within MethodSCRIPT?
MethodSCRIPT example 1: SWV on the Sensit BT, save on internal storage
e set_gpio_cfg 0x1E 2 file_open "https://assets.palmsens.com/Measurements/14-04-2022/SWV-10-49-16-0.dmeas" 1 set_script_output 3 var c var p var f var g set_pgstat_chan 1 set_pgstat_mode 0 set_pgstat_chan 0 set_pgstat_mode 2 set_max_bandwidth 200 set_range_minmax da -400m 400m set_range ba 59n set_autoranging ba 59n 59n set_e -300m cell_on meas_loop_swv p c f g -300m 300m 10m 100m 5 pck_start pck_add p pck_add c pck_add f pck_add g pck_end endloop on_finished: file_close cell_off
Attention: The current PSTrace version (5.9.4206) is not capable of loading measurements from the internal storage created by a MethodSCRIPT Sandbox measurement. These files have to be opened with our SDK examples. In PSTrace 5.10 this issue is fixed. You can download a BETA version of PSTrace 5.10 from my.palmsens.com
MethodSCRIPT example 2: Temperature measurement on the Sensit BT using i2C, start with trigger button
e ############# Hibernate and wait for button push ############# #Hibernate in low power mode, wake up on WAKE pin event (button push) #Could also have used get_gpio on with GPIO pin if saving power wasn't a concern hibernate 0x07i 60 ############# Declare measurement variables variables ############# var c var p var f var g ############# I2C Temperature measurement initialisation ############# # Declare variables for Temperature measurement # Most significant bits var m # Least significant bits var l # Acknowledge var a # Array with Write data array w 2 # Array with Read data array r 2 # Status register var s # Configure I2C GPIOs and set it to 100k clock, 7 bit address set_gpio_cfg 0x0300i 2 i2c_config 100k 7 # Configure the sensor for 16bit mode with continuous conversion store_var a 0i ja array_set w 0i 0x03i array_set w 1i 0x80i i2c_write 0x48i w 2 a ############# Measurement initialisation ############# set_pgstat_chan 0 set_pgstat_mode 2 set_max_bandwidth 200 set_range_minmax da -400m 400m set_range ba 59n set_autoranging ba 59n 59n set_e -300m cell_on ############# Run measurement ############# # Perform SWV measurement from -300 mV to 300 mV at 5 Hz meas_loop_swv p c f g -300m 300m 10m 100m 5 ############# Get I2C temperature ############# # Check if temperature sensor is ready store_var s 0x80i ja i2c_write_byte 0x48i 0x02i a i2c_read_byte 0x48i s a bit_and_var s 0x80i # Ignore if temperature sensor not ready. if s != 0x80i # Read temperature values i2c_write_byte 0x48i 0x00i a i2c_read 0x48i r 2 a array_get r 0i m array_get r 1i l # Convert to degrees Celcius bit_lsl_var m 8i add_var m l if m > 0x8000i sub_var m 0x10000i endif int_to_float m div_var m 128 endif ############# Send measurement package ############# pck_start # Sweep potential pck_add p # Current pck_add c # Temperature pck_add m pck_end endloop on_finished: cell_off
MethodSCRIPT example 3: Peak detection on the EmStat4M Development Kit
e ############# Declare measurement variables variables ############# var c var p var f var g ############# Init peak detect ############# # Declare variables var n var i var m var l array a 100i array b 100i store_var n 0i ja store_var m 0 ba store_var l 1M ba ############# Configure LED pins ############# set_gpio_cfg 0x7 1 set_gpio 0x0 ############# Measurement initialisation ############# set_pgstat_chan 0 set_pgstat_mode 2 set_max_bandwidth 200 set_range_minmax da -400m 400m set_range ba 59n set_autoranging ba 59n 59n set_e -300m cell_on ############# Run measurement ############# # Perform SWV measurement from -300 mV to 300 mV at 5 Hz meas_loop_swv p c f g -300m 300m 10m 100m 5 # Store measurement data in array array_set a n p array_set b n c add_var n 1i endloop ############# Simple peak search algorithm ############# # As an example, we just determine max and min value # Many applications will need a more sophisticated algorithm store_var i 0i ja loop i < n array_get b i c if c > m copy_var c m endif if c < l copy_var c l endif add_var i 1i endloop ############# Send measurement data ############# store_var i 0i ja loop i < n array_get a i p array_get b i c pck_start pck_add p pck_add c pck_add m pck_add l pck_end add_var i 1i endloop ############# Decision time ############# #subtract "min" value from "max" to get the relative peak height sub_var m l # Enable red LED if peak > nA, otherwise enable green LED if m > 2n set_gpio 0x1 else set_gpio 0x2 endif ############# Turn cell off, even if aborted ############# on_finished: cell_off