GCBASIC Library and Demo – TC77 SPI Temperature Sensor
A new GCBASIC library and demonstration program is now available for the Microchip TC77 digital SPI temperature sensor. The TC77 provides a 13‑bit temperature reading with 0.0625°C resolution and supports both SPI and MICROWIRE interfaces.
This release includes full support for both Hardware SPI and Software (bit‑banged) SPI on microcontrollers.
The demo solution outputs temperature readings to a serial terminal. Both hardware and software SPI variants have been tested on real hardware, including correct Manufacturer ID detection (0x54xx) and stable, accurate temperature readings.
TC77_to_Serial_Terminal_HW_SPI_18F4550.gcb
(Hardware SPI demo using MSSP1)
TC77.h
(Full TC77 driver library)
20092B.pdf
(Microchip TC77 datasheet)
Wiring (single SI/O line)
The TC77 uses a shared SI/O pin. On the tested board:
CS → PortB.2
SCK → PortB.1
SI/O → PortB.0
Both TC77_DO and TC77_DI are defined as PortB.0. The library automatically releases the pin when required to avoid contention.
Hardware vs Software SPI
The demos share the same library. Only the port configuration differs:
Define TC77_HardwareSPI for MSSP1 hardware SPI
Omit the define for Software SPI bit‑bang mode
TC77 requires SPI Mode 0,0 (CPOL=0, CPHA=0)
On the microcontgroller tested the TC77 is wired to the SPI ports. The library includes implementation notes explaining why this works: direction toggling of TC77_DO (needed for Software SPI) must be skipped when using Hardware SPI - this is all automatic.
GCBASIC Library and Demo – TC77 SPI Temperature Sensor
A new GCBASIC library and demonstration program is now available for the Microchip TC77 digital SPI temperature sensor. The TC77 provides a 13‑bit temperature reading with 0.0625°C resolution and supports both SPI and MICROWIRE interfaces.
This release includes full support for both Hardware SPI and Software (bit‑banged) SPI on microcontrollers.
The demo solution outputs temperature readings to a serial terminal. Both hardware and software SPI variants have been tested on real hardware, including correct Manufacturer ID detection (0x54xx) and stable, accurate temperature readings.
Included Files
(Software SPI demo)
(Hardware SPI demo using MSSP1)
(Full TC77 driver library)
(Microchip TC77 datasheet)
Wiring (single SI/O line)
The TC77 uses a shared SI/O pin. On the tested board:
Both TC77_DO and TC77_DI are defined as PortB.0. The library automatically releases the pin when required to avoid contention.
Hardware vs Software SPI
The demos share the same library. Only the port configuration differs:
On the microcontgroller tested the TC77 is wired to the SPI ports. The library includes implementation notes explaining why this works: direction toggling of TC77_DO (needed for Software SPI) must be skipped when using Hardware SPI - this is all automatic.
Library API (TC77.h)
The library provides:
Key routines:
Demonstration Program
The included GCBASIC demo:
The program is fully commented and suitable as a reference for integrating the TC77 into other GCBASIC projects.
Download
The library, demos, and datasheet are included in the next release.
Feedback, improvements, and additional device tests are welcome.
Last edit: Anobium 6 days ago