Jump to content
  • 0

Analogdicovery2 + Pmod TC1


yohara33

Question

Hi. I'm high school physics teacher and I use analogdiscovery2 in my physics experiments as voltometers, osciloscopes, DC power sources and so on. Analogdicovery2 is incredible device so that students can measure many kind of physical properties by only one device! Now I'm wondering if students can measure temperature by means of Pmod TC1 with Analogdiscovery2 without coding? If it is possible, how can I do that? Thanks.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hi @yohara33

The following Script should work.
You may have to adjust the thermocouple temperature conversion, the "*0.25+0.0"

image.png.bdc360d5ddbbaf2a9479625e11703b4f.png

if(!('Protocol' in this)) open("Protocol")
Protocol.Mode.text = "SPI"

print("Chip temperature, thermocouple temperature, eventual faults")

while(wait(1)){ // wait 1 second
    Protocol.SPI.Start()
    var bits = Protocol.SPI.Read(32, 1) // read 32 bits
    Protocol.SPI.Stop()

    var chip = ((bits<<16)>>20)*0.0625 // chip temperature, two's comp
    var temp = (bits>>18)*0.25+0.0 // thermocouple with .25*C resolution, two's comp

    var text = "Chip: "+chip+"*C\tThermo: "+temp+"*C\t"
    if(bits&0x10000 || bits&7){
        text += "Fault:"
        if(bits&4) text += " SCV"
        if(bits&2) text += " SCG"
        if(bits&1) text += " OC"
    }
    print(text)
}

 

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...