1. Purpose
FN-TEMP8 is the one-byte temperature representation used throughout the FNmega128 platform. It encodes an integer temperature in degrees Celsius using sign-magnitude form.
2. Bit Layout
- Bit 7 — sign (0 = positive, 1 = negative)
- Bits 6–0 — magnitude (absolute temperature, 0–127)
Representable range: −127 to +127 degrees Celsius.
3. Zero Handling
Two encodings map to zero. 0x00 is positive (canonical) zero; 0x80 is negative zero. Both decode to 0 °C. Encoders emit 0x00 for zero.
| Encoding | Value |
|---|---|
| 0x00 | +0 °C (canonical) |
| 0x80 | −0 °C (normalized to 0) |
4. Examples
| Temperature (°C) | Binary | Hex |
|---|---|---|
| -30 | 10011110 | 9E |
| -24 | 10011000 | 98 |
| -18 | 10010010 | 92 |
| -12 | 10001100 | 8C |
| +0 | 00000000 | 00 |
| +8 | 00001000 | 08 |
| +24 | 00011000 | 18 |
| +30 | 00011110 | 1E |
| +100 | 01100100 | 64 |
| +125 | 01111101 | 7D |
| +127 | 01111111 | 7F |
5. Conversion
encode(t): if t >= 0: byte = t & 0x7F
else: byte = 0x80 | ((-t) & 0x7F)
decode(b): mag = b & 0x7F
value = -mag if (b & 0x80) else mag
The simulator recognizes valid FN-TEMP8 values across the entire representable range, including values outside the ranges offered by the ordinary configuration interface.