Jump to content
  • 0

Visualize Scope and parsed protocol analyzer data in same plot


david2

Question

I'm calculating and recording power through a load based on voltage and current measured on C1 and C2 of my Analog Discovery 2 scope, at 4kHz, for about an hour. Next to this I would like to log the temperature of the same load, or which the data is supplied through a UART.

Would it be possible to visualize both these measurements in the same plot using a script? Perhaps by writing to a reference or math channel? We would have to be able to see all the values and plots live. 

Thanks! David

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 1

Hi @david2

You could use the Scope in mixed mode by adding Channel/ Digital/ UART Set Format depending on your temperature value like to Decimal or Two's complement
Use a Script like this to translate UART data to temperature as Reference channel. You should adapt the data to temperature function...
Edit: Also make sure the sample rate is more than double of the UART rate.

image.thumb.png.9506db2373aa5eb38e114cf3f3a62457.png

var rg = []
var temp = 0

Scope.DigitalChannels.UART.data.forEach(
function(val){
    if(!isNaN(val)) {
        // convert data to temperature
        temp = 0.25*val
    }
    rg.push(temp)
})

// clone to have correct time position
Scope.Ref1.Clone(Scope.Channel1)
// set data
Scope.Ref1.data = rg
// other options
Scope.Ref1.Units.text = "C"
Scope.Ref1.Range.value = 100

 

Edited by attila
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...