- Confirm power to thermocouple
- Obtain measurement from ADC
- Write measurement to screen
- Complete program and confirm it all works together.
Code: Select all
: CONVERT ( MEASUREMENT -- PRESSURE)
\ a word to convert the value from the circuit into a pressure value.
\ firstly I take the very small value from the TC Gauge, and jam it into an amplification circuit.
\ The range on the amplification circuit is 0 -> 71.2 * Vmax. Here Vmax is 14mV so max input is
\ This function currently assumes a 6343 or KJL 1518 type TC tube.
\ It implements an exponential function of the form y = 7,000,000 * x^(-2.032)
\ Where x is in the input measurement and y is the output in mTorr
s>df \ convert measurement value to fixed point
\ raise x to power -2.032
log2 2,032 f* \ take the log base 2 of x, multiply by our power
pow2 \ take the power of 2 to get rid of the log base 2
1,0 2swap f/ \ gotta divide our value into 1
7000000,0 f* \ put our scaling value for x on the stack and multiply
mfloor \ convert to integer by taking the nearest whole number
;