Jump to content
  • 0

Digital Discovery Scripting


engrpetero

Question

I've been playing a bit with the Digital Discovery Waverforms application scripting to help speed development of some SPI peripherals.  Although I find the scripting documentation mostly helpful, some things puzzle me (for example, where would one see 'true' or 'false'?  even when I step through a script using the debugger, I don't see return values).

image.png.7a56448811e189f2a8e567878efb44cc.png

 

And from a script perspective, I *think* the script 'honors' the pin descriptions identified in the 'Settings' portion of the Waveforms app.  So with this small script shown below...

  1. SPI Chip select is on pin DIO24 and is active low
  2. SPI clk is on DIO25 (even though the 'Settings' control indicates a frequency of 1MHz, the script sets the frequency to 100KHz)
  3. MOSI is on DIO27
  4. MISO is on DIO26

Then the script starting at line 7 merely starts the SPI function (pulling DIO24 low), then writes 8 bytes (lines 9-11), then waits 100ms, then writes 3 more bytes, then stops (pulling DIO24 high).  Is anything I've said about the script not accurate?

image.png

Edited by engrpetero
fixed typo, clarification
Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Darn... I forgot also ask in previous post so just doing in second post.  At the bottom of the scripting window, there is a button to 'Evaluate Script'.  What should happen when this button is pressed?  All I ever see in the box to the right of the button is the text 'undefined'...

image.png.3901c094323593726a95c0314e909a12.png

Link to comment
Share on other sites

  • 0
Posted (edited)

Thank you, @attila for the reply.  A few follow-up questions. 

While in the 'Script' window, I do see results when displaying the Output window and I use print statements.  That is cleared up so thanks.  

While in the 'Protocol' window - the one that has the Evaluate Script button - the text next to the button always says 'undefined'.  No pointer to a line or anything, just 'undefined'.  Searching the help, I don't find an entry that helps me move past the undefined item (or what it even means). 

Also, since in the protocol window - with the protocol being SPI - I don't *think* I need to prefix the methods/function calls with the object content (so in the Protocol window, I can use Write() instead of Protocol.SPI.Write()).  Is that true?  Can I use the entire object hierarchy (Protocol.SPI.Write()) if I want to? (Note int he picture showing the Protocol editor, I don't prefix Start nor Write with Protocol.SPI.).

image.png.7ddba84bf63af83909d6f8f129ecc999.png

Edited by engrpetero
added clarifying picture
Link to comment
Share on other sites

  • 0

Yes, you would have received some sort of error message if the script encountered an issue.

The screenshots you showed doesn't "request" any return value, so that's why the script shows as undefined as no return value was defined (or requested).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...