udamonic.com
  • Learn
    • What is a Scamp?
    • Order a Scamp
    • Getting Started
    • Learning Forth ... >
      • What is Forth?
      • Arithmetic
      • The Stack
      • Creating Words
      • Compilation Tricks
      • Comments
      • Characters and Strings
      • Constants, Variables and Values
      • Flow Control
      • Loops
      • Accessing Memory
      • Data Structures
      • Doubles, Triples and Quads
    • Extras... >
      • Starting up with turnkey
      • Formatting Text on Screen
      • Changing the Prompt
      • Delays and Tick Count
      • Processor Words
      • Temperature Sensor
      • Using the LED Array
    • Interfacing... >
      • Input/Output
      • Analog Input
      • Serial Communication
      • PWM
      • I2C Overview
      • I2C Commands
    • FlashForth Dictionary Reference
    • Scamp Dictionary Reference
  • Create
    • Adding LEDs
    • LED arc-welder effect
    • Measuring Temperature
    • Time Keeping
    • Model Train Control
    • FizzBuzz
    • Adding Extra GPIO
    • Adding a Low Side Switch
    • Adding an RTCC
  • Resources
  • Consult
  • About
  • Contact

Measuring Temperature Using the Onboard Sensor
​

Scamp1 (Rev C) and Scamp2 computers have an onboard PCT2075 temperature sensor, at I2C address $36. The datasheet for this sensor can be found here: https://www.nxp.com/docs/en/data-sheet/PCT2075.pdf. The sensor is compatible with the common LM75 temperature sensors, but with increased accuracy. Note that the sensor measures the temperature of the PCB to which it is attached, which may not be exactly the same as local ambient weather conditions. 

The word: 
temp
reads the sensor over the I2C bus and returns two values to the stack. ​The values are the (integer) temperature in degrees Celsius, and the fractional temperature in milli degrees Celsius.

For example, if temp returned  25  750, then the temperature reading is 25.750°C.
The absolute accuracy of the sensor is ±1°C ​over -25°C to +100°C range, so for most applications it makes sense to just drop the fractional component. To read the absolute temperature:
temp drop
The fractional part of the temperature reading is useful if you're interested in small differential changes over a short time, rather than an absolute reading. 

Site powered by Weebly. Managed by Hostwinds
  • Learn
    • What is a Scamp?
    • Order a Scamp
    • Getting Started
    • Learning Forth ... >
      • What is Forth?
      • Arithmetic
      • The Stack
      • Creating Words
      • Compilation Tricks
      • Comments
      • Characters and Strings
      • Constants, Variables and Values
      • Flow Control
      • Loops
      • Accessing Memory
      • Data Structures
      • Doubles, Triples and Quads
    • Extras... >
      • Starting up with turnkey
      • Formatting Text on Screen
      • Changing the Prompt
      • Delays and Tick Count
      • Processor Words
      • Temperature Sensor
      • Using the LED Array
    • Interfacing... >
      • Input/Output
      • Analog Input
      • Serial Communication
      • PWM
      • I2C Overview
      • I2C Commands
    • FlashForth Dictionary Reference
    • Scamp Dictionary Reference
  • Create
    • Adding LEDs
    • LED arc-welder effect
    • Measuring Temperature
    • Time Keeping
    • Model Train Control
    • FizzBuzz
    • Adding Extra GPIO
    • Adding a Low Side Switch
    • Adding an RTCC
  • Resources
  • Consult
  • About
  • Contact